This set of Java Spring Multiple Choice Questions & Answers (MCQs) focuses on “Problems with Direct JDBC”.
1. Spring supports most of the popular ORM (or data mapper) frameworks.
a) Hibernate
b) JDO
c) JPA
d) All of the mentioned
View Answer
Explanation: Spring supports most of the popular ORM (or data mapper) frameworks, including Hibernate, JDO, iBATIS, and the Java Persistence API (JPA).
2. ORM which isn’t supported by Spring:-
a) Hibernate
b) JDO
c) TopLink
d) All of the mentioned
View Answer
Explanation: Classic TopLink isn’t supported starting from Spring 3.0 (the JPA implementation still supported, of course).
3. An ORM framework persists your objects according to the mapping metadata you provide.
a) True
b) False
View Answer
Explanation: XML- or annotation-based, such as the mappings between classes and tables, properties and columns, and so on.
4. Database Engine which uses low memory consumption and easy configuration.
a) SQL
b) MySQL
c) Apache Derby
d) None of the mentioned
View Answer
Explanation: Derby is an open source relational database engine provided under the Apache License and implemented in pure Java.
5. Mode which Derby prefers to run in:-
a) embedded
b) client/server
c) all of the mentioned
d) none of the mentioned
View Answer
Explanation: Derby can run in either the embedded mode or the client/server mode.
6. For testing purposes, the client/server mode is more appropriate.
a) True
b) False
View Answer
Explanation: It allows you to inspect and edit data with any visual database tools that support JDBC—for example, the Eclipse Data Tools Platform (DTP).
7. To start the Derby server in the client/server mode.
a) startNetworkServer java file
b) startNetworkServer script
c) startNetwork script
d) all of the mentioned
View Answer
Explanation: To start the Derby server in the client/server mode, just execute the startNetworkServer script for your platform (located in the bin directory of the Derby installation).
8. JDBC Properties for Connecting to the Application Database.
a) Driver Class
b) URL
c) Username
d) All of the mentioned
View Answer
Explanation: JDBC Properties for Connecting to the Application Database
Property Value
Driver class org.apache.derby.jdbc.ClientDriver
URL jdbc:derby://localhost:1527/vehicle;create=true
Username app
Password app
9. The general purpose of the Data Access Object (DAO) pattern is to avoid these logic related problems by separating data access logic from business logic and presentation logic.
a) True
b) False
View Answer
Explanation: This pattern recommends that data access logic be encapsulated in independent modules called data access objects.
10. To access the database with JDBC:-
a) DAO interface
b) DAO Class
c) DataAccess interface
d) None of the mentioned
View Answer
Explanation: Because your DAO implementation has to connect to the database to execute SQL statements, you may establish database connections by specifying the driver class name, database URL, username, and password.
11. Standard interface defined by the JDBC specification that factories Connection instances.
a) javax.sql.DataAccess
b) javax.sql.DataSource
c) javax.sql.Data
d) javax.sql.DataSourceAccess
View Answer
Explanation: The javax.sql.DataSource interface is a standard interface defined by the JDBC specification that factories Connection instances.
12. Data source implementations provided by different vendors and projects.
a) C3PO
b) Apache Commons DBCP
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: C3PO and Apache Commons DBCP are popular open source options, and most applications servers will provide their own implementation.
13. Spring also provides several convenient but less powerful data source implementations.
a) DriverManagerDataSource
b) DriverManagerData
c) DriverManagerDataAccess
d) DriverManagerDataSourceAccess
View Answer
Explanation: The simplest one is DriverManagerDataSource, which opens a new connection every time one is requested.
14. SingleConnectionDataSource (a DriverManagerDataSource subclass). As its name indicates, this maintains only a single connection.
a) True
b) False
View Answer
Explanation: Another data source implementation provided by Spring is SingleConnectionDataSource (a DriverManagerDataSource subclass). As its name indicates, this maintains only a single connection that’s reused all the time and never closed.
15. Which DataSource is not stable in MultiThreaded Environment?
a) DriverManagerDataSource
b) SingleConnectionDataSource
c) All of the mentioned
d) None of the mentione
View Answer
Explanation: As its name indicates, this maintains only a single connection that’s reused all the time and never closed. Obviously, it is not suitable in a multithreaded environment.
Sanfoundry Global Education & Learning Series – Java Spring.
To practice all areas of Java Spring, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Information Technology Books
- Check Spring Books
- Practice Programming MCQs
- Apply for Spring Internship
- Apply for Programming Internship