0

programming languages Online Quiz - 329

Description: programming languages Online Quiz - 329
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

Which type of Statements can execute parameterized queries?

  1. O (a) PreparedStatement

  2. O (b) ParameterizedStatement

  3. O (c) ParameterizedStatement and CallableStatement

  4. O (d) All kinds of Statements (i.e. which implement a sub interface of Statement)


Correct Option: A

How can you retrieve information from a ResultSet?

  1. O (a) By invoking the method get (..., String type) on the ResultSet, where type is the database

  2. O (b) By invoking the method get (..., Type type) on the ResultSet, where Type is an object

  3. O (c) By invoking the method getValue (...), and cast the result to the desired java type.

  4. O (d) By invoking the special getter methods on the ResultSet: getString (...), get Boolean (...),


Correct Option: D

How can you execute DML statements (i.e. insert, delete, update) in the database?

  1. O (a) By making use of the InsertStatement, DeleteStatement or UpdateStatement classes

  2. O (b) By invoking the execute(...) or executeUpdate(...) method of a normal Statement object

  3. O (c) By invoking the executeInsert(...), executeDelete(...) or executeUpdate(...) methods of

  4. O (d) By making use of the execute(...) statement of the DataModificationStatement object


Correct Option: B

How do you know in your Java program that a SQL warning is generated as a result of executing a SQL statement in the database?

  1. O (a) You must catch the checked SQLException which is thrown by the method which executes

  2. O (b) You must catch the unchecked SQLWarningException which is thrown by the method

  3. O (c) You must invoke the getWarnings() method on the Statement object (or a sub interface

  4. O (d) You must query the ResultSet object about possible warnings generated by the database


Correct Option: C

What is, in terms of JDBC, a DataSource?

  1. O (a) A DataSource is the basic service for managing a set of JDBC drivers

  2. O (b) A DataSource is the Java representation of a physical data source

  3. O (c) A DataSource is a registry point for JNDI-services

  4. O (d) A DataSource is a factory of connections to a physical data source


Correct Option: D

What is the meaning of ResultSet.TYPE_SCROLL_INSENSITIVE

  1. O (a) This means that the ResultSet is insensitive to scrolling

  2. O (b) This means that the Resultset is sensitive to scrolling, but insensitive to updates, i.e. not

  3. O (c) This means that the ResultSet is sensitive to scrolling, but insensitive to changes made

  4. O (d) The meaning depends on the type of data source, and the type and version of the driver


Correct Option: C

Are ResultSets updateable?

  1. O (a) Yes, but only if you call the method openCursor() on the ResultSet, and if the driver and

  2. O (b) Yes, but only if you indicate a concurrency strategy when executing the statement, and

  3. O (c) Yes, but only if the ResultSet is an object of class UpdateableResultSet, and if the driver

  4. O (d) No, ResultSets are never updateable. You must explicitly execute DML statements (i.e.


Correct Option: B

What statements are correct about JDBC transactions (2 answers)?

  1. [_] [a] A transaction is a set of successfully executed statements in the database

  2. [_] [b] A transaction is finished when commit() or rollback() is called on the Connection object,

  3. [_] [c] A transaction is finished when commit() or rollback() is called on the Transaction object

  4. [_] [d] A transaction is finished when close() is called on the Connection object.


Correct Option: B,D

How can you start a database transaction in the database?

  1. O (a) By asking a Transaction object to your Connection, and calling the method begin() on it

  2. O (b) By asking a Transaction object to your Connection, and setting the autoCommit property

  3. O (c) By calling the method beginTransaction() on the Connection object

  4. O (d) By setting the autoCommit property of the Connection to false, and execute a statement


Correct Option: D

What is the meaning of the transaction isolation level TRANSACTION_REPEATABLE_READ

  1. O (a) Dirty reads, non-repeatable reads and phantom reads can occur

  2. O (b) Dirty reads are prevented; non-repeatable reads and phantom reads can occur

  3. O (c) Dirty reads and non-repeatable reads are prevented; phantom reads can occur

  4. O (d) Dirty reads, non-repeatable reads and phantom reads are prevented


Correct Option: C

What statements are correct about positioned updates (i.e. cursor updates) in ResultSets? (2 answers)

  1. [_] [a] Using the cursor technique is currently the only possible way to change the data in the

  2. [_] [b] Insert statements are not supported when using cursors.

  3. [_] [c] Only scrollable updateable ResultSets can use this approach to change the data in the

  4. [_] [d] The name of the cursor is specified by the setCursorName(String name) method the


Correct Option: B,D

How can you execute a stored procedure in the database?

  1. O (a) Call method execute() on a CallableStatement object

  2. O (b) Call method executeProcedure() on a Statement object

  3. O (c) Call method execute() on a StoredProcedure object

  4. O (d) Call method run() on a ProcedureCommand object


Correct Option: A

What happens if you call the method close() on a ResultSet object?

  1. O (a) the method close() does not exist for a ResultSet. Only Connections can be closed.

  2. O (b) the database and JDBC resources are released

  3. O (c) you will get a SQLException, because only Statement objects can close ResultSets

  4. O (d) the ResultSet, together with the Statement which created it and the Connection from


Correct Option: B

What happens if you call deleteRow() on a ResultSet object?

  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

What statements are correct about batched insert and updates? (2 answers)

  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

What is correct about DDL statements (create, grant,...)?

  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

Which of the following java.util classes support Internationalization?

  1. a)Locale

  2. b)ResourceBundle

  3. c)Country

  4. d)Language


Correct Option: A,B

Given the following to JSP files select the right answers. ////////// different file Hello

  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

What are correct statements about creating scripting variables for a Tag::

  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
- Hide questions