Advanced JAVA Solved MCQs

Multiple Choice Questions 59 Pages
FT

Contributed by

Falguni Talwar
Loading
  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA
    MANE
    SUBJECT CODE: 602 SUBJECT NAME: ADVANCED JAVA
    Unit 1 : JDBC
    1) Which of the following contains both date and time?
    A) Java.io.date
    B) Java.sql.date
    C) Java.util.date
    D) Java.util.dateTime
    Answer:D
    2) Which of the following is advantage of using JDBC connection pool?
    A) Slow performance
    B) Using more memory
    C) Using less memory
    D) Better performance
    Answer:D
    3) Which of the following is advantage of using PreparedStatement in Java?
    A) Slow performance
    B) Encourages SQL injection
    C) Prevents SQL injection
    D) More memory usage
    Answer:C

    Page 1

  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA MANE
    4) Which one of the following contains date information?
    A) Java.sql.TimeStamp
    B) Java.sql.Time
    C) java.io.Time
    D) java.io.TimeStamp
    Answer:A
    5) What does setAutoCommit(false) do?
    A) commits trAnsweraction after each query
    B) explicitly commits trAnsweraction
    C) does not commit trAnsweraction automatically after each query
    D) never commits trAnsweraction
    Answer:C
    6) Which of the following is used to call stored procedure?
    A) Statement
    B) PreparedStatement
    C) CallableStatment
    D) CalledStatement
    Answer:C
    7) Which of the following is used to limit the number of rows returned?
    A) setMaxRows(int i)
    B) setMinRows(int i)

    Page 2

  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA MANE
    C) getMaxrows(int i)
    D) getMinRows(int i)
    Answer:A
    8) Which of the following is method of JDBC batch process?
    A) setBatch()
    B) deleteBatch()
    C) removeBatch()
    D) addBatch()
    Answer:D
    9) Which of the following is used to rollback a JDBC trAnsweraction?
    A) rollback()
    B) rollforward()
    C) deleteTrAnsweraction()
    D) RemoveTrAnsweraction()
    Answer:A
    10) Which of the following is not a JDBC connection isolation levels?
    A) TRANSWERACTION_NONE
    B) TRANSWERACTION_READ_COMMITTED
    C) TRANSWERACTION_REPEATABLE_READ
    D) TRANSWERACTION_NONREPEATABLE_READ

    Page 3

  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA MANE
    Answer:D
    11) Which driver uses ODBC driver to connect to the database?
    A) JDBC-ODBC bridge driver
    B) Native - API driver
    C) Network Protocol driver
    D) Thin driver
    Answer:A
    12) How many JDBC product components does the Java software provides?
    A)3
    B) 2
    C) 4
    D) 5
    Answer:A
    13) How many types of JDBC drivers are available?
    A) 3
    B) 4
    C) 2
    D) 5
    Answer:B

    Page 4

  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA MANE
    14) Which result set generally does not show changes to the underlying database
    that are made while it is open. The membership, order, and column values of
    rows are typically fixed when the result set is created?
    A) TYPE_FORWARD_ONLY
    B) TYPE_SCROLL_INSENSITIVE
    C) TYPE_SCROLL_SENSITIVE
    D) ALL MENTIONED ABOVE
    Answer:B
    15) JDBC is a Java API that is used to connect and execute query to the database
    A) True
    B) False
    Answer:A
    16) Which method is used for an SQL statement that is executed frequently?
    A) prepare Statement
    B) prepare Call
    C) create Statement
    D) None of the above
    Answer:A

    Page 5

  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA MANE
    17) What is used to execute parameterized query?
    A) Statement interface
    B) PreparedStatement interface
    C) ResultSet interface
    D) None of the above
    Answer:B
    18) Which JDBC product components does the Java software provide?
    A) The JDBC driver manager
    B) The JDBC driver test suite
    C) The JDBC-ODBC bridge
    D) All mentioned above
    Answer:D
    19) JDBC stands for?
    A) Java database connectivity
    B) Java database concept
    C) Java database communications
    D) None of the above
    Answer:A
    20) Which class has traditionally been the backbone of the JDBC architecture?
    A) JDBC driver manager
    B) JDBC driver test suite

    Page 6

  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA MANE
    C) JDBC-ODBC bridge
    D) All mentioned above
    Answer:A
    21) The JDBC-ODBC Bridge supports multiple concurrent open statements per
    connection?
    A) True
    B) False
    Answer: A
    22) Which of the following allows non repeatable read in JDBC Connection?
    A) TRANSWERACTION_READ_UNCOMMITTED
    B) TRANSWERACTION_READ_COMMITTED
    C) TRANSWERACTION_SERIALIZABLE
    D) TRANSWERACTION_REPEATABLE_READ
    Answer: D
    23) Which of the following statements is false as far as different type of
    statements is concern in JDBC?
    A) Regular Statement
    B) Prepared Statement
    C) Callable Statement
    D) Interim Statement
    Answer: D
    24) Which of the following methods are needed for loading a database driver in
    JDBC?
    A) registerDriver() method
    B) Class.forName()
    C) Both A and B
    D) getConnection()
    Answer: C

    Page 7

  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA MANE
    25) Which of the following is false as far as type 4 driver is concern?
    A) Type 4 driver is “native protocol, pure java” driver
    B) Type 4 drivers are 100% Java compatible
    C) Type 4 drivers uses Socket class to connect to the database
    D) Type 4 drivers can not be used with Netscape
    Answer: D
    26) To execute a stored procedure “totalStock” in a database server, which of the
    following code snippet is used?
    A) Statement stmt =
    connection.createStatement();stmt.execute(“totalStock()”);
    B) CallableStatement clbstmnt = con.prepareCall(“{call
    totalStock}”);cs.executeQuery();
    C) StoreProcedureStatement
    stmt=connection.createStoreProcedure(“totalStock()”);spstmt.executeQuery();
    D) PrepareStatement pstmt =
    connection.prepareStatement(“totalStock()”);pstmt.execute();
    Answer: B
    27) Which driver is efficient and always preferable for using JDBC applications?
    A) Type 4
    B) Type 1
    C) Type 3
    D) Type 2
    Answer: A
    28) JDBC facilitates to store the java objects by using which of the methods of
    PreparedStatement
    setObject () 2. setBlob() 3. setClob()
    A) 1, 2
    B) 1,2,3
    C) 1,3
    D) 2,3
    Answer: B
    29) Which statement is static and synchronized in JDBC API?
    A) executeQuery()
    B) executeUpdate()
    C) getConnection()

    Page 8

  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA MANE
    D) prepareCall()
    Answer: C
    30) The JDBC-ODBC bridge is
    A) Three tiered
    B) Multithreaded
    C) Best for any platform
    D) All of the above
    Answer: B
    31) All raw data types (including binary documents or images) should be read and
    uploaded to the database as an array of
    A) byte
    B) int
    C) boolean
    D) char
    Answer: A
    32) The class javA)sql.Timestamp has its super class as
    A) javA)sql.Time
    B) javA)util.Date
    C) javA)util.Time
    D) None of the above
    Answer: B
    33) BLOB, CLOB, ARRAY and REF type columns can be updated in
    A) JDBC 1.0
    B) JDBC 4.0
    C) JDBC 2.0
    D) JDBC 3.0
    Answer: D
    34) Which of the following methods finds the maximum number of connections
    that a specific driver can obtain?
    A) Database.getMaxConnections
    B) Connection.getMaxConnections
    C) DatabaseMetaDatA)getMaxConnections
    D) ResultSetMetaDatA)getMaxConnections
    Answer: C

    Page 9

  • DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI,PUNE
    -
    45
    www.dacc.edu.in
    PROF . SUPRIYA MANE
    35) Are prepared statements actually compiled?
    A) Yes, they compiled
    B) No, they are bound by the JDBC driver
    Answer: A
    36) When the message “No Suitable Driver” occurs?
    A) When the driver is not registered by Class.forname() method
    B) When the user name, password and the database does not match
    C) When the JDBC database URL passed is not constructed properly
    D) When the type 4 driver is used
    Answer: C
    37) Which driver is called as thin-driver in JDBC?
    A) Type-4 driver
    B) Type-1 driver
    C) Type-3 driver
    D) Type-2 driver
    Answer: A
    38) How many trAnsweraction isolation levels are defined in javA)sql.Connection
    interface?
    A) 4
    B) 3
    C) 5
    D) 2
    Answer: C
    39) Which method is used to perform DML statements in JDBC?
    A) execute()
    B) executeQuery()
    C) executeUpdate()
    D) executeResult()
    Answer: C
    40) What is the disadvantage of Type-4 Native-Protocol Driver?
    A) At client side, a separate driver is needed for each database.
    B) Type-4 driver is entirely written in Java
    C) The driver converts JDBC calls into vendor-specific database protocol
    D) It does not support to read MySQL datA)
    Answer: A

    Page 10

Download this file to view remaining 49 pages

logo StudyDocs
StudyDocs is a platform where students and educators can share educational resources such as notes, lecture slides, study guides, and practice exams.

Contacts

Links

Resources

© 2025 StudyDocs. All Rights Reserved.