Sail E0 Webinar

MCQs

Total Questions : 25 | Page 1 of 3 pages
Question 1. Which method is used to perform DML statements in JDBC?
  1.    execute()
  2.    executeQuery()
  3.    executeUpdate()
  4.    executeResult()
 Discuss Question
Answer: Option C. -> executeUpdate()




Question 2. The interface ResultSet has a method, getMetaData(), that returns a/an
  1.    Tuple
  2.    Value
  3.    Object
  4.    Result
 Discuss Question
Answer: Option C. -> Object




Question 3. Which of the following methods are needed for loading a database driver in JDBC?
  1.    registerDriver() method
  2.    Class.forName()
  3.    Both A and B
  4.    getConnection()
 Discuss Question
Answer: Option C. -> Both A and B




Question 4. _______ is an open source DBMS product that runs on UNIX, Linux and Windows.
  1.    MySQL
  2.    JSP/SQL
  3.    JDBC/SQL
  4.    Sun ACCESS
 Discuss Question
Answer: Option C. -> JDBC/SQL




Question 5. How can you execute a stored procedure in the database?
  1.    Call method execute() on a CallableStatement object
  2.    Call method executeProcedure() on a Statement object
  3.    Call method execute() on a StoredProcedure object
  4.    Call method run() on a ProcedureCommand object
 Discuss Question
Answer: Option A. -> Call method execute() on a CallableStatement object




Question 6. What happens if you call deleteRow() on a ResultSet object?
  1.    The row you are positioned on is deleted from the ResultSet, but not from the database
  2.    The row you are positioned on is deleted from the ResultSet and from the database
  3.    The result depends on whether the property synchronizeWithDataSource is set to true or false
  4.    You will get a compile error: the method does not exist because you cannot delete rows from a ResultSet
 Discuss Question
Answer: Option B. -> The row you are positioned on is deleted from the ResultSet and from the database




Question 7. What is not true of a Java bean?
  1.    There are no public instance variables
  2.    It may have many constructors as necessary
  3.    All persistent values are accessed using getxxx and setxxx methods
  4.    All of the above are true of a Java bean
 Discuss Question
Answer: Option B. -> It may have many constructors as necessary




Question 8. The method on the result set that tests whether or not there remains at least one unfetched tuple in the result set, is said to be
  1.    Fetch method
  2.    Current method
  3.    Next method
  4.    Access method
 Discuss Question
Answer: Option C. -> Next method




Question 9. Which type of Statement can execute parameterized queries?
  1.    PreparedStatement
  2.    ParameterizedStatement
  3.    ParameterizedStatement and CallableStatement
  4.    All kinds of Statements (i.e. which implement a sub interface of Statement)
 Discuss Question
Answer: Option A. -> PreparedStatement




Question 10. Which of the following is an advantage of using PreparedStatement in Java?
  1.    Slow performance
  2.    Encourages SQL injection
  3.    Prevents SQL injection
  4.    More memory usage
 Discuss Question
Answer: Option C. -> Prevents SQL injection




Latest Videos

Latest Test Papers