What does JDBC stand for?
Which SQL command is used to
a) Java Database Compiler retrieve all records from a table?
b) Java Database Connectivity a) SELECT * FROM table_name
c) Java Data Communication b) GET * FROM table_name
d) Java Data Compiler c) FETCH * FROM table_name
Answer: b) Java Database Connectivity d) QUERY * FROM table_name
Answer: a) SELECT * FROM table_name
Which Java package contains JDBC
classes and interfaces? Which JDBC interface is used to
a) [Link] establish a connection to a database?
b) [Link] a) Connection
c) [Link] b) Statement
d) [Link] c) ResultSet
Answer: a) [Link] d) QueryManager
Answer: a) Connection
Which method is used to load a
JDBC driver in Java? Which method is used to execute
a) [Link]() an INSERT, UPDATE, or DELETE
b) [Link]() statement?
c) [Link]() a) executeUpdate()
d) [Link]() b) executeQuery()
Answer: b) [Link]() c) executeCommand()
d) modify()
Which JDBC object is used to Answer: a) executeUpdate()
execute SQL queries?
a) Connection Which JDBC interface provides a
b) Statement way to interact with a database using
c) ResultSet SQL?
d) Query a) QueryInterface
Answer: b) Statement b) Statement
c) Executor
Which method is used to execute a d) DBQuery
SELECT query in JDBC? Answer: b) Statement
a) executeUpdate()
b) executeQuery() Which method is used to close a
c) runQuery() database connection in JDBC?
d) queryExecute() a) close()
Answer: b) executeQuery() b) disconnect()
c) shutdown()
Which object holds the result of an d) stop()
SQL query in JDBC? Answer: a) close()
a) QueryResult
b) ResultSet What is the purpose of
c) Statement PreparedStatement in JDBC?
d) Connection a) It speeds up database transactions
Answer: b) ResultSet b) It allows parameterized queries to
prevent SQL injection
c) It automatically commits database b) ResultSet cannot be updated once
transactions created
d) It is used for reading images from the c) ResultSet can be scrollable and
database updatable
Answer: b) It allows parameterized d) ResultSet automatically refreshes
queries to prevent SQL injection when new records are added
Answer: c) ResultSet can be scrollable
Which Java data type is used for and updatable
storing multimedia (such as images) in
a database? Which SQL clause is used to filter
a) String records in a database search?
b) Blob a) WHERE
c) File b) GROUP BY
d) Multimedia c) ORDER BY
Answer: b) Blob d) HAVING
Answer: a) WHERE
Which JDBC feature allows
transactions to be managed manually What is the main purpose of JDBC
instead of auto-committing? in web applications?
a) setAutoCommit(false) a) To send HTTP requests to a database
b) disableAutoCommit() b) To provide database connectivity for
c) setManualCommit() dynamic web applications
d) beginTransaction() c) To replace SQL queries with Java
Answer: a) setAutoCommit(false) methods
d) To store Java objects in the cloud
Which JDBC driver type uses native Answer: b) To provide database
database client libraries for connectivity for dynamic web
communication? applications
a) Type 1 (JDBC-ODBC Bridge)
b) Type 2 (Native API) Which Java technology is
c) Type 3 (Network Protocol) commonly used alongside JDBC for
d) Type 4 (Thin Driver) web applications?
Answer: b) Type 2 (Native API) a) Servlets
b) Applets
What is the role of c) Swing
DatabaseMetaData in JDBC? d) AWT
a) It stores large data files in a database Answer: a) Servlets
b) It retrieves information about the
database structure and capabilities
c) It optimizes query execution
d) It manages database transactions
Answer: b) It retrieves information about
the database structure and capabilities
Which of the following statements
about ResultSet is correct?
a) ResultSet is always forward-only