Tag: technology

Questions Related to technology

  1. O (a) The row you are positioned on is deleted from the ResultSet, but not from the database.

  2. O (b) The row you are positioned on is deleted from the ResultSet and from the database

  3. O (c) The result depends on whether the property synchonizeWithDataSource is set to true or

  4. O (d) You will get a compile error: the method does not exist because you can not delete rows


Correct Option: B
Explanation:

The correct answer to the question is B. The row you are positioned on is deleted from the ResultSet and from the database.

The deleteRow() method of the ResultSet interface deletes the current row from the ResultSet object and from the underlying database table. This means that the row will no longer be visible in the ResultSet object, and it will also be deleted from the database.

The deleteRow() method only works if the ResultSet object is updatable. An updatable ResultSet object is one that can be used to modify data in the database. To create an updatable ResultSet object, you must set the CONCUR_UPDATABLE property of the Statement object that you use to execute the query.

The deleteRow() method does not throw any exceptions. If you try to delete a row from a ResultSet object that is not updatable, the method will simply do nothing.

Here is an example of how to use the deleteRow() method:

import java.sql.*;

public class DeleteRowExample {

    public static void main(String[] args) throws SQLException {
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/mydatabase", "username", "password");
        Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
        String sql = "SELECT * FROM customers";
        ResultSet resultSet = statement.executeQuery(sql);

        // Move the cursor to the first row.
        resultSet.first();

        // Delete the current row.
        resultSet.deleteRow();

        // Close the connection.
        connection.close();
    }
}

This code will delete the first row in the customers table.

  1. [_] [a] To create a batch of insert and update statements, you create an object of type Batch,

  2. [_] [b] Batch insert and updates are only possible when making use of parameterized queries.

  3. [_] [c] To do a batched update/insert, you call addBatch(String statement) on a Statement

  4. [_] [d] To execute a batched update/insert, you call the executeBatch() method on a Statement


Correct Option: C,D
  1. O (a) DDL statements are treated as normal sql statements, and are executed by calling the

  2. O (b) To execute DDL statements, you have to install additional support files

  3. O (c) DDL statements can not be executed by making use of JDBC, you should use the native

  4. O (d) Support for DDL statements will be a feature of a future release of JDBC


Correct Option: A
Explanation:

To answer this question, the user needs to have knowledge about DDL (Data Definition Language) statements and their characteristics.

Now, let's go through each option and explain why it is right or wrong:

A. O (a) DDL statements are treated as normal SQL statements, and are executed by calling them. This statement is correct. DDL statements are used to define or modify the structure of database objects like tables, indexes, etc. and they are executed like normal SQL statements.

B. O (b) To execute DDL statements, you have to install additional support files. This statement is incorrect. There is no requirement for additional support files to execute DDL statements.

C. O (c) DDL statements cannot be executed by making use of JDBC, you should use the native database SQL interface. This statement is incorrect. DDL statements can be executed using JDBC (Java Database Connectivity) API like any other SQL statement.

D. O (d) Support for DDL statements will be a feature of a future release of JDBC. This statement is incorrect. DDL statements are already supported by JDBC.

Therefore, the correct option is:

The Answer is: A

  1. 1) File container.jsp will compile if the directive page comes before the directive include

  2. 2) File container will compile and when executed it will show:”Hello”.

  3. 3) File container.jsp will compile if the errorPage in container.jsp is the same as in file included.jsp.

  4. 4) File container.jsp will compile if instead of directive include () it is used the action include ()


Correct Option: D
  1. 1) It is necessary to implement TagExtraInfo interface.

  2. 2) You have to insert into the tag element of the taglib descriptor file an entry for tei-class element.

  3. 3) The interface you have to implement has a method called getVariableInfo.

  4. 4) None of the above.


Correct Option: A,B,C

Which of the following staments are correct about the following jsp lines:

  1. 1) It won't compile.

  2. 2) It is a valid jsp line and it will print the variable called name.

  3. 3) It will compile but it will always produce null as the output.

  4. 4) It will work if you create a javabean class with only one variable of type java.lang.String.


Correct Option: B
  1. 1) It is a valid line that can be used to initialize the servlet that implements the jsp file.

  2. 2) It won't compile as no identifer can start with jsp not _jsp.

  3. 3) It will serve as the servlet initialization if the function's name is _jspInit.

  4. 4) There is no way to initialize a jsp's implementation class servlet.


Correct Option: A

What will be printed out if this jsp code?

  1. 1) It won't compile.

  2. 2) It will print the default client's Web browser locale.

  3. 3) It will print the default web server Locale.

  4. 4) It will the first language specified in the Accept-Language request's header.


Correct Option: A