- 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 - Which are the modules of core container?
A - Beans, Core, Context, SpEL
Answer : A
Explanation
Beans, Core, Context, SpEL are the modules in core container.
Q 2 - What is singleton scope?
A - This scopes the bean definition to a single instance per Spring IoC container.
B - This scopes the bean definition to a single instance per HTTP Request.
C - This scopes the bean definition to a single instance per HTTP Session.
D - This scopes the bean definition to a single instance per HTTP Application/ Global session.
Answer : A
Explanation
singleton scope instructs Spring IoC container to create a single instance per IoC container.
Q 3 - What is prototype scope?
A - This scopes a single bean definition to have any number of object instances.
B - This scopes the bean definition to a single instance per HTTP Request.
C - This scopes the bean definition to a single instance per HTTP Session.
D - This scopes the bean definition to a single instance per HTTP Application/ Global session.
Answer : A
Explanation
prototype scope allows Spring IoC container to create any number instances per IoC container.
Q 4 - What is bean autowiring?
B - Autowiring injects values in spring beans.
C - Autowiring injects one bean into another.
D - Autowiring helps in wiring a list of values, allowing duplicates.
Answer : A
Explanation
Using Bean autowiring, Spring resolve collaborators (other beans) for your bean by inspecting the contents of the BeanFactory without using <constructor-arg> and <property> elements..
Q 5 - What is ContextStartedEvent 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.
D - This event is published when the HTTP Response is returned.
Answer : C
Explanation
ContextStartedEvent event is published when the ApplicationContext is started using the start() method on the ConfigurableApplicationContext interface.
Q 6 - How around advice works?
A - Run advice before and after the advised method is invoked.
B - Run advice before and after a class is loaded.
Answer : A
Explanation
around advice runs before and after the advised method is invoked.
Q 7 - Which ORM Spring supports ?
Answer : D
Explanation
Spring supports all the mentioned ORMs.
Answer : B
Explanation
By default a bean is eagerly loaded.
Q 9 - What is the scope of stateless bean?
Answer : B
Explanation
Stateless bean is of singleton scope.
Q 10 - Where do you define DispatcherServlet?
Answer : B
Explanation
DispatcherServlet is defined in web.xml of web application.
To Continue Learning Please Login
Login with Google