R4RIN
MCQS
Spring MCQ Quiz Hub
Spring Mcq Set 11
Choose a topic to test your knowledge and improve your Spring skills
1. Spring supports most of the popular ORM (or data mapper) frameworks.
Hibernate
JDO
JPA
All of the mentioned
2. ORM which isn’t supported by Spring:-
Hibernate
JDO
TopLink
All of the mentioned
3. An ORM framework persists your objects according to the mapping metadata you provide.
True
False
none
all the mentoined
4. Database Engine which uses low memory consumption and easy configuration.
SQL
MySQL
Apache Derby
None of the mentioned
5. Mode which Derby prefers to run in:-
embedded
client/server
all of the mentioned
None of the mentioned
6. For testing purposes, the client/server mode is more appropriate.
True
False
none
all the mentoined
7. To start the Derby server in the client/server mode.
startNetworkServer java file
startNetworkServer script
startNetwork script
All of the mentioned
8. JDBC Properties for Connecting to the Application Database.
Driver Class
URL
Username
All of the mentioned
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.
True
False
none
all the mentoined
10. To access the database with JDBC:-
DAO interface
DAO Class
DataAccess interface
None of the mentioned
11. Standard interface defined by the JDBC specification that factories Connection instances.
javax.sql.DataAccess
javax.sql.DataSource
javax.sql.Data
javax.sql.DataSourceAccess
12. Data source implementations provided by different vendors and projects.
C3PO
Apache Commons DBCP
All of the mentioned
None of the mentioned
13. Spring also provides several convenient but less powerful data source implementations.
DriverManagerDataSource
DriverManagerData
DriverManagerDataAccess
DriverManagerDataSourceAccess
14. SingleConnectionDataSource (a DriverManagerDataSource subclass). As its name indicates, this maintains only a single connection.
True
False
none
all the mentoined
15. Which DataSource is not stable in MultiThreaded Environment?
DriverManagerDataSource
SingleConnectionDataSource
All of the mentioned
None of the mentioned
16. Class which declares a number of overloaded update() template methods to control the overall update process.
org.springframework.jdbc.core.JdbcTemplate
org.springframework.jdbc.core.*
org.springframework.jdbc.*
none of the mentioned
17. You implement this interface to override the statement creation task.
PreparedStatement
PreparedStatementCreator
PreparedCreator
None of the mentioned
18. When implementing the PreparedStatementCreator interface, you will get the database connection as the createPreparedStatement() method’s argument.
True
False
none
all the mentoined
19. It is better to implement the PreparedStatementCreator interface and other callback interfaces as inner classes if they are used within one method only.
True
False
none
all the mentoined
20. PreparedStatementSetter, as its name indicates, create a PreparedStatement object on this connection the parameter as well as binding task of the overall update process.
True
False
none
all the mentoined
21. The JdbcTemplate class offers template method for batch update operations.
batchUpdate()
update()
all of the mentioned
None of the mentioned
22. The JdbcTemplate class declares a number of overloaded query() template methods to control the overall query process.
True
False
none
all the mentoined
23. The primary interface that allows you to process the current row of the result set
PreparedStatementSetter
PreparedStatementCreator
PreparedStatementCreator
All of the mentioned
24. RowCallbackHandler purpose is to map a single row of the result set to a customized object.
True
False
none
all the mentoined
25. Method of RowMapper interface in which, you have to construct the object that represents a row and return it as the method’s return value.
mapRow()
query()
update()
None of the mentioned
26. RowMapper implementation which can automatically map a row to a new instance of the specified class.
BeanPropertyRowMapper
BeanPropertyRow
All of the mentioned
None of the mentioned
27. Method which provides list of maps.
queryForList()
update
query()
All of the mentioned
28. Spring JDBC framework offers a convenient class, to simplify your DAO implementation.
org.springframework.jdbc.core.support
org.springframework.jdbc.core.support.JdbcDaoSupport
all of the mentioned
None of the mentioned
29. The org.springframework.jdbc.core.support.JdbcDaoSupport class has a setDataSource() method and a setJdbcTemplate() method.
True
False
none
all the mentoined
30. Method to retrieve the JDBC template.
setJdbcTemplate()
getTemplate()
getJdbc()
getJdbcTemplate()
31. JdbcTemplate that takes advantage of Java 1.5 features such as autoboxing, generics, and variable-length arguments to simplify its usage.
JdbcTemplate that takes advantage of Java 1.5 features such as autoboxing, generics, and variable-length arguments to simplify its usage.
org.springframework.jdbc.core.simple.SimpleJdbcTemplate
org.springframework.jdbc.*
none of the mentioned
32. JdbcTemplate require statement parameters to be passed as an object array.
True
False
none
all the mentoined
33. To use SimpleJdbcTemplate:-
instantiate it directly
retrieve its instance by extending the SimpleJdbcDaoSupport class
all of the mentioned
None of the mentioned
34. SimpleJdbcTemplate offers a convenient batch update method in the form of:-
Vector
Set
Map
List
35. Method has a warning from the Java compiler because of an unchecked conversion from List to List.
findAll()
query()
update()
batchUpdate()
36. The return type of the queryForObject() method will be determined by the class argument (e.g., String.class).
True
False
none
all the mentoined
37. Named SQL parameters are specified by name (starting with a colon) rather than by position.
True
False
none
all the mentoined
38. Named parameters are supported only in SimpleJdbcTemplate.
True
False
all of the mentioned
None of the mentioned
39. Implementations of the SqlParameterSource interface:-
MapSqlParameterSource
BeanPropertySqlParameterSource
none of the mentioned
All of the mentioned
40. The Spring framework offers a consistent data access exception-handling mechanism for its data access module.
True
False
none
None of the mentioned
41. In your DAO methods, you neither need to surround the code with a try/catch block nor declare throwing an exception in the method signature.
True
False
none
all the mentoined
42. The direct parent class of DataAccessException is:-
RuntimeException
NestedRuntimeException
Exception
Throwable
43. Which concrete exception in the DataAccessException hierarchy should be thrown?
errorCode
SQLState properties of the caught SQLException
All of the mentioned
none of the mentioned
44. Error code for The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint.
-1
0
23505
1
45. How does the Spring JDBC framework know that state 23505 should be mapped to DuplicateKeyException?
error code
SQL state
all of the mentioned
none of the mentioned
46. Class which represents a real-world entity and its instances will be persisted to a database.
entity
persistent
all of the mentioned
None of the mentioned
47. Each entity class to be persisted by an ORM framework, a default constructor with no argument is required.
True
False
none
all the mentoined
48. If the identifier value is null, this entity will be treated as a new and unsaved entity.
True
False
none
None of the mentioned
49. To allow the identifier to be null, you should choose a primitive wrapper type:-
java.lang.Integer
java.lang.Long
all of the mentioned
None of the mentioned
50. A set of persistent annotations for you to define mapping metadata.
JPA
JSR
XML
none of the mentioned
Submit