Spring Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to Spring Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - Which are the modules of Data Access/ integration layer?
Answer : A
Explanation
JDBC, ORM, OXM, JMS, Transactions are the modules of Data Access/ Integration layer.
Q 2 - What types of Dependency injection does spring supports?
A - Constructor based, Setter based
B - Constructor based, Setter based, Getter Based
Answer : A
Explanation
Spring supports Constructor based, Setter based injections.
Q 3 - What is true about <set> collection configuration elements?
A - This helps in wiring a list of values, allowing duplicates.
B - This helps in wiring a list of values but without any duplicates.
Answer : B
Explanation
<set> tag is used to wire a list of values, but without any duplicates.
Q 4 - What is byType mode of autowiring?
A - Default setting which meas no autowiring and you should use explicit bean reference for wiring.
Answer : D
Explanation
byType mode of autowiring is autowiring by property type. Spring tries to match and wire a property if its type matches with exactly one of the beans name in configuration file.
Q 5 - What is aspect?
A - Aspect is a way to do the dependency injection.
B - A module which has a set of APIs providing cross-cutting requirements.
C - Aspect is used to log information of application.
D - Aspect represents properties of spring based application.
Answer : B
Explanation
aspect module has a set of APIs to provide cross-cutting requirements.
Q 6 - How after-throwing advice works?
A - Run advice after a method execution only if method exits by throwing an exception.
B - Run advice after a class loads only if class throws exception during load time.
C - Run advice after http response is returned with error status.
D - Run advice after http request is processed and an exception occurred.
Answer : A
Explanation
after-throwing advice runs after http request is processed and an exception occurred.
Q 7 - What are the ways to access Hibernate by using Spring?
A - Inversion of Control with a Hibernate Template and Callback.
B - Extending HibernateDAOSupport and Applying an AOP Interceptor node.
Answer : C
Explanation
Hibernate can be accessed by both ways either using Inversion of Control with a Hibernate Template and Callback or extending HibernateDAOSupport and applying an AOP Interceptor node.
Answer : B
Explanation
By default a bean is eagerly loaded.
Q 9 - What is the scope of bean in portlet context?
Answer : B
Explanation
Scope of bean in portlet context is global-session.
Q 10 - Which of the following class can be used to execute Sql queries in spring?
Answer : B
Explanation
JdbcTemplate class can be used to execute Sql queries in spring.