Spring MCQ Quiz Hub

Spring Mcq Set 11

Choose a topic to test your knowledge and improve your Spring skills

Spring supports most of the popular ORM (or data mapper) frameworks.





✅ Correct Answer: 4

ORM which isn’t supported by Spring:-





✅ Correct Answer: 4

An ORM framework persists your objects according to the mapping metadata you provide.





✅ Correct Answer: 1

Database Engine which uses low memory consumption and easy configuration.





✅ Correct Answer: 3

Mode which Derby prefers to run in:-





✅ Correct Answer: 3

For testing purposes, the client/server mode is more appropriate.





✅ Correct Answer: 1

To start the Derby server in the client/server mode.





✅ Correct Answer: 2

JDBC Properties for Connecting to the Application Database.





✅ Correct Answer: 4

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.





✅ Correct Answer: 1

To access the database with JDBC:-





✅ Correct Answer: 1

Standard interface defined by the JDBC specification that factories Connection instances.





✅ Correct Answer: 2

Data source implementations provided by different vendors and projects.





✅ Correct Answer: 3

Spring also provides several convenient but less powerful data source implementations.





✅ Correct Answer: 1

SingleConnectionDataSource (a DriverManagerDataSource subclass). As its name indicates, this maintains only a single connection.





✅ Correct Answer: 1

Which DataSource is not stable in MultiThreaded Environment?





✅ Correct Answer: 3

Class which declares a number of overloaded update() template methods to control the overall update process.





✅ Correct Answer: 1

You implement this interface to override the statement creation task.





✅ Correct Answer: 2

When implementing the PreparedStatementCreator interface, you will get the database connection as the createPreparedStatement() method’s argument.





✅ Correct Answer: 1

It is better to implement the PreparedStatementCreator interface and other callback interfaces as inner classes if they are used within one method only.





✅ Correct Answer: 1

PreparedStatementSetter, as its name indicates, create a PreparedStatement object on this connection the parameter as well as binding task of the overall update process.





✅ Correct Answer: 2

The JdbcTemplate class offers template method for batch update operations.





✅ Correct Answer: 3

The JdbcTemplate class declares a number of overloaded query() template methods to control the overall query process.





✅ Correct Answer: 1

The primary interface that allows you to process the current row of the result set





✅ Correct Answer: 3

RowCallbackHandler purpose is to map a single row of the result set to a customized object.





✅ Correct Answer: 1

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.





✅ Correct Answer: 1

RowMapper implementation which can automatically map a row to a new instance of the specified class.





✅ Correct Answer: 1

Method which provides list of maps.





✅ Correct Answer: 1

Spring JDBC framework offers a convenient class, to simplify your DAO implementation.





✅ Correct Answer: 2

The org.springframework.jdbc.core.support.JdbcDaoSupport class has a setDataSource() method and a setJdbcTemplate() method.





✅ Correct Answer: 1

Method to retrieve the JDBC template.





✅ Correct Answer: 4

JdbcTemplate that takes advantage of Java 1.5 features such as autoboxing, generics, and variable-length arguments to simplify its usage.





✅ Correct Answer: 2

JdbcTemplate require statement parameters to be passed as an object array.





✅ Correct Answer: 1

To use SimpleJdbcTemplate:-





✅ Correct Answer: 3

SimpleJdbcTemplate offers a convenient batch update method in the form of:-





✅ Correct Answer: 4

Method has a warning from the Java compiler because of an unchecked conversion from List to List.





✅ Correct Answer: 1

The return type of the queryForObject() method will be determined by the class argument (e.g., String.class).





✅ Correct Answer: 1

Named SQL parameters are specified by name (starting with a colon) rather than by position.





✅ Correct Answer: 1

Named parameters are supported only in SimpleJdbcTemplate.





✅ Correct Answer: 1

Implementations of the SqlParameterSource interface:-





✅ Correct Answer: 4

The Spring framework offers a consistent data access exception-handling mechanism for its data access module.





✅ Correct Answer: 1

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.





✅ Correct Answer: 1

The direct parent class of DataAccessException is:-





✅ Correct Answer: 2

Which concrete exception in the DataAccessException hierarchy should be thrown?





✅ Correct Answer: 3

Error code for The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint.





✅ Correct Answer: 1

How does the Spring JDBC framework know that state 23505 should be mapped to DuplicateKeyException?





✅ Correct Answer: 3

Class which represents a real-world entity and its instances will be persisted to a database.





✅ Correct Answer: 3

Each entity class to be persisted by an ORM framework, a default constructor with no argument is required.





✅ Correct Answer: 1

If the identifier value is null, this entity will be treated as a new and unsaved entity.





✅ Correct Answer: 1

To allow the identifier to be null, you should choose a primitive wrapper type:-





✅ Correct Answer: 3

A set of persistent annotations for you to define mapping metadata.





✅ Correct Answer: 1