- 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 of the following is correct about dependency injection?
A - It helps in decoupling application objects from each other.
B - It helps in deciding the dependencies of objects.
Answer : A
Explanation
Dependency injection helps in decoupling application objects from each other.
Q 2 - Which is the correct implementation class of BeanFactory?
Answer : A
Explanation
XmlBeanFactory is the implementation class of BeanFactory. Other mentioned classes do not exists.
Q 3 - What is session scope?
A - This scopes a bean definition to an HTTP session.
B - This scopes the bean definition to Spring IoC container.
C - This scopes the bean definition to HTTP request.
D - This scopes the bean definition to HTTP Application/ Global session.
Answer : A
Explanation
session scope instructs Spring IoC container to create a instance per HTTP session.
Answer : A
Explanation
null and empty string values can be injected in spring beans.
Q 5 - What is true about @Autowired annotation?
A - The @Autowired annotation can be used to autowire bean on the setter method.
Answer : B
Explanation
@Autowired annotation provides more fine-grained control over where and how autowiring should be accomplished.
Q 6 - How after-returning advice works?
A - Run advice after a class loads only if class loads successfully.
B - Run advice after a method execution only if method completes successfully.
C - Run advice after http response is returned only if http response is success.
D - Run advice after http request is processed with no exception.
Answer : B
Explanation
before advice runs after a method execution only if method completes successfully.
Q 7 - How to use ref keyword in beans.
xml?B - Using constructor argument only.
Answer : C
Explanation
ref is used to reference already defined bean and it can be used using both setter method and constructor argument.
Answer : A
Explanation
Struts can be integrated with spring.
Q 9 - How to handle shut down of IoC container?
Answer : D
Explanation
Using registerShutdownHook() method, shut down of IoC container can be handled. Other methods do not exists.
Answer : A
Explanation
Both values and ref can be injected at a time in a bean.
To Continue Learning Please Login
Login with Google