- Spring Core Basics
- Spring - Home
- Spring - Overview
- Spring - Architecture
- Spring - Environment Setup
- Spring - Hello World Example
- Spring - IoC Containers
- Spring - Bean Definition
- Spring - Bean Scopes
- Spring - Bean Life Cycle
- Spring - Bean Post Processors
- Spring - Bean Definition Inheritance
- Spring - Dependency Injection
- Spring - Injecting Inner Beans
- Spring - Injecting Collection
- Spring - Beans Auto-Wiring
- Annotation Based Configuration
- Spring - Java Based Configuration
- Spring - Event Handling in Spring
- Spring - Custom Events in Spring
- Spring - AOP with Spring Framework
- Spring - JDBC Framework
- Spring - Transaction Management
- Spring - Web MVC Framework
- Spring - Logging with Log4J
- Spring Questions and Answers
- Spring - Questions and Answers
- Spring Useful Resources
- Spring - Quick Guide
- Spring - Useful Resources
- Spring - Discussion
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 - What is spring?
A - Spring is an open source development framework for enterprise Java.
B - Spring is a proprietary framework.
C - Spring is a development framework for .Net applications.
D - Spring is a development framework for PHP based applications.
Answer : A
Explanation
Spring is an open source development framework for enterprise Java.
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 <props> 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 : A
Explanation
<props> tag is used to inject a collection of name-value pairs where name and value are both Strings.
Q 4 - What is byName mode of autowiring?
A - Default setting which means no autowiring and you should use explicit bean reference for wiring.
D - Similar to byType, but type applies to constructor arguments.
Answer : B
Explanation
byName mode of autowiring is autowiring by property name. Spring tries to match and wire its properties with the beans defined by the same names in the configuration file.
Q 5 - What is ContextClosedEvent event?
A - This event is published when the Servlet Context is either initialized or refreshed.
B - This event is published when the HTTP Request is received.
C - This event is published when the HTTP Response is returned.
Answer : D
Explanation
This event is published when the ApplicationContext is closed using the close() method on the ConfigurableApplicationContext interface.
Q 6 - What is Weaving?
A - Weaving is the process of injecting values in objects to create an advised object.
Answer : B
Explanation
Weaving is the process of linking aspects with other application types or objects to create an advised object.
Q 7 - How to get object of a service in spring framework?
Answer : B
Explanation
In spring, dependency injection is used to get any object.
Q 8 - If a bean is scoped to HTTP request, scope is
Answer : D
Explanation
If a bean is scoped to HTTP request, scope is request.
Answer : C
Explanation
Stateful bean is of prototype scope.
Q 10 - What BeanPostProcessor does?
A - It processes beans once a bean is initialized.
Answer : B
Explanation
BeanPostProcessor defines callback methods that you can implement to provide your own instantiation logic, dependency-resolution logic etc.