MCQOPTIONS
Saved Bookmarks
This section includes 104 Mcqs, each offering curated multiple-choice questions to sharpen your Java Spring Framework knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
How does the Spring JDBC framework know that state 23505 should be mapped to DuplicateKeyException? |
| A. | error code |
| B. | SQL state |
| C. | all of the mentioned |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |
| 52. |
Error code for The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint. |
| A. | -1 |
| B. | 0 |
| C. | 23505 |
| D. | 1 |
| Answer» B. 0 | |
| 53. |
The direct parent class of DataAccessException is:- |
| A. | RuntimeException |
| B. | NestedRuntimeException |
| C. | Exception |
| D. | Throwable |
| Answer» C. Exception | |
| 54. |
Interface whose instances can be obtained from an EntityManagerFactory instance. |
| A. | Entity |
| B. | EntityManager |
| C. | All of the mentioned |
| D. | None of the mentioned |
| Answer» C. All of the mentioned | |
| 55. |
To accept a session factory via dependency injection. |
| A. | HibernateCourseDao |
| B. | HibernateCourse |
| C. | HibernateDao |
| D. | All of the mentioned |
| Answer» B. HibernateCourse | |
| 56. |
The exceptions thrown by Hibernate are of type HibernateException, while those thrown by JPA may be of type PersistenceException. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 57. |
Interface whose instances can be obtained from a SessionFactory instance. |
| A. | Session |
| B. | Session Factory |
| C. | All of the mentioned |
| D. | None of the mentioned |
| Answer» B. Session Factory | |
| 58. |
Spring HibernateTemplate can simplify your DAO implementation by managing sessions and transactions for you. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 59. |
SimpleJdbcTemplate offers a convenient batch update method in the form of:- |
| A. | Vector |
| B. | Set |
| C. | Map |
| D. | List |
| Answer» E. | |
| 60. |
Method has a warning from the Java compiler because of an unchecked conversion from List to List. |
| A. | findAll() |
| B. | query() |
| C. | update() |
| D. | batchUpdate() |
| Answer» B. query() | |
| 61. |
The return type of the queryForObject() method will be determined by the class argument (e.g., String.class). |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 62. |
Named SQL parameters are specified by name (starting with a colon) rather than by position. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 63. |
JdbcTemplate require statement parameters to be passed as an object array. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 64. |
To use SimpleJdbcTemplate:- |
| A. | instantiate it directly |
| B. | retrieve its instance by extending the SimpleJdbcDaoSupport class |
| C. | all of the mentioned |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |
| 65. |
Named parameters are supported only in SimpleJdbcTemplate. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 66. |
The Spring framework offers a consistent data access exception-handling mechanism for its data access module. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 67. |
RowCallbackHandler purpose is to map a single row of the result set to a customized object. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» C. May be | |
| 68. |
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. |
| A. | mapRow() |
| B. | query() |
| C. | update() |
| D. | none of the mentioned |
| Answer» B. query() | |
| 69. |
RowMapper implementation which can automatically map a row to a new instance of the specified class. |
| A. | BeanPropertyRowMapper |
| B. | BeanPropertyRow |
| C. | All of the mentioned |
| D. | None of the mentioned |
| Answer» B. BeanPropertyRow | |
| 70. |
JdbcTemplate that takes advantage of Java 1.5 features such as autoboxing, generics, and variable-length arguments to simplify its usage. |
| A. | org.springframework.jdbc.core.JdbcTemplate |
| B. | org.springframework.jdbc.core.simple.SimpleJdbcTemplate |
| C. | org.springframework.jdbc.* |
| D. | none of the mentioned |
| Answer» C. org.springframework.jdbc.* | |
| 71. |
The primary interface that allows you to process the current row of the result set. |
| A. | PreparedStatementSetter |
| B. | PreparedStatementCreator |
| C. | RowCallbackHandler |
| D. | All of the mentioned |
| Answer» D. All of the mentioned | |
| 72. |
Method which provides list of maps. |
| A. | queryForList() |
| B. | update |
| C. | query() |
| D. | all of the mentioned |
| Answer» B. update | |
| 73. |
Spring JDBC framework offers a convenient class, to simplify your DAO implementation. |
| A. | org.springframework.jdbc.core.support |
| B. | org.springframework.jdbc.core.support.JdbcDaoSupport |
| C. | all of the mentioned |
| D. | none of the mentioned |
| Answer» C. all of the mentioned | |
| 74. |
If you are deploying into a Java EE 5 (or better) container, you may simply create a bean that is annotated with:- |
| A. | javax.jws.WebService |
| B. | javax.jws.WebServiceProvider |
| C. | all of the mentioned |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |
| 75. |
In the bean configuration file for Hibernate (i.e., beans-hibernate.xml), you have to declare a HibernateTransactionManager instance for this application and enable declarative transaction via:- |
| A. | tx:annotation |
| B. | tx:annotationdriven |
| C. | tx:annotation-driven |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |
| 76. |
Instance to translate the native Hibernate exceptions into data access exceptions in Spring DataAccessException hierarchy. |
| A. | PersistenceExceptionPostProcessor |
| B. | PersistenceExceptionTranslation |
| C. | PersistenceException |
| D. | PersistenceExceptionTranslationPostProcessor |
| Answer» E. | |
| 77. |
Endpoint Classes for JDOM:- |
| A. | AbstractDomPayloadEndpoint |
| B. | AbstractJDomPayloadEndpoint |
| C. | AbstractDom4jPayloadEndpoint |
| D. | AbstractXomPayloadEndpoint |
| Answer» C. AbstractDom4jPayloadEndpoint | |
| 78. |
Which concrete exception in the DataAccessException hierarchy should be thrown? |
| A. | errorCode |
| B. | SQLState properties of the caught SQLException |
| C. | All of the mentioned |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 79. |
EJB support classes provide access to the Spring IoC container for you to implement your business logic in POJOs and wrap them with EJB components. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 80. |
Method to retrieve the JDBC template. |
| A. | setJdbcTemplate() |
| B. | getTemplate() |
| C. | getJdbc() |
| D. | getJdbcTemplate() |
| Answer» E. | |
| 81. |
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 |
| Answer» D. None of the mentioned | |
| 82. |
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 |
| Answer» C. javax.sql.Data | |
| 83. |
When implementing the PreparedStatementCreator interface, you will get the database connection as the createPreparedStatement() method’s argument. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 84. |
You can omit the transaction-manager attribute in the element if your transaction manager has the name transactionManager. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 85. |
To help you control the overall transaction management process and transaction exception handling. |
| A. | SpringTransactionTemplate |
| B. | TransactionTemplate |
| C. | Transaction |
| D. | None of the mentioned |
| Answer» C. Transaction | |
| 86. |
You just have to encapsulate your code block in a callback class that implements the TransactionCallback interface and pass it to the TransactionTemplate execute method for execution. In this way, you don’t need to repeat the boilerplate transaction management code for this block. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 87. |
A TransactionTemplate can accept a transaction callback object that implements:- |
| A. | TransactionCallback |
| B. | TransactionCallbackWithoutResult class |
| C. | All of the mentioned |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 88. |
PlatformTransactionManager is an abstract unit for transaction management. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 89. |
Method that allows you to start a new transaction (or obtain the currently active transaction). |
| A. | getTransaction() |
| B. | commit() |
| C. | rollback() |
| D. | all of the mentioned |
| Answer» B. commit() | |
| 90. |
Endpoint Classes for XOM:- |
| A. | AbstractDomPayloadEndpoint |
| B. | AbstractJDomPayloadEndpoint |
| C. | AbstractDom4jPayloadEndpoint |
| D. | AbstractXomPayloadEndpoint |
| Answer» E. | |
| 91. |
Endpoint Classes for Event-based StAX:- |
| A. | AbstractDomPayloadEndpoint |
| B. | AbstractSaxPayloadEndpoint |
| C. | AbstractDom4jPayloadEndpoint |
| D. | AbstractStaxEventPayloadEndpoint |
| Answer» E. | |
| 92. |
Annotation to find a transaction and then fail, complaining that no Hibernate session been bound to the thread. |
| A. | @Transaction |
| B. | @Transactional |
| C. | @Transactions |
| D. | None of the mentioned |
| Answer» C. @Transactions | |
| 93. |
Spring (since version 2.0) offers a transaction advice that can be easily configured via the:- |
| A. | rx:advice |
| B. | bx:advice |
| C. | tx:advice |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |
| 94. |
Implementations of the SqlParameterSource interface:- |
| A. | MapSqlParameterSource |
| B. | BeanPropertySqlParameterSource |
| C. | none of the mentioned |
| D. | all of the mentioned |
| Answer» E. | |
| 95. |
The org.springframework.jdbc.core.support.JdbcDaoSupport class has a setDataSource() method and a setJdbcTemplate() method. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 96. |
The default JNDI name for a remote EJB 3.0 component is the EJB class name with Remote as its suffix . |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 97. |
Annotation used for entity manager injection in EJB components. |
| A. | @PersistenceContext |
| B. | @Persistence |
| C. | @PersistenceCon |
| D. | None of the mentioned |
| Answer» B. @Persistence | |
| 98. |
Marshaller for XStream:- |
| A. | org.springframework.oxm.jaxb.Jaxb1Marshaller |
| B. | org.springframework.oxm.jaxb.Jaxb2Marshaller |
| C. | org.springframework.oxm.xstream.XStreamMarshaller |
| D. | org.springframework.oxm.jibx.JibxMarshaller |
| Answer» D. org.springframework.oxm.jibx.JibxMarshaller | |
| 99. |
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. |
| A. | True |
| B. | False |
| C. | May be |
| D. | Can't say |
| Answer» B. False | |
| 100. |
Method to start a new transaction with that definition:- |
| A. | getTransaction() |
| B. | commit() |
| C. | rollback() |
| D. | none of the mentioned |
| Answer» B. commit() | |