- 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 Useful Resources
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 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 constructor mode of autowiring?
Answer : D
Explanation
Constructor mode of autowiring is similar to byType, but type applies to constructor arguments. If there is not exactly one bean of the constructor argument type in the container, a fatal error is raised.
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 - What is Introduction?
A - An introduction represents a point in your application where you can plug-in AOP aspect.
B - This is used to inject values in objects.
C - This is not invoked during program execution by Spring AOP framework.
D - An introduction allows you to add new methods or attributes to existing classes.
Answer : D
Explanation
An introduction allows you to add new methods or attributes to existing classes.
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 : B
Explanation
By default a bean is eagerly loaded.
Q 9 - If a bean is scoped to HTTP session, scope is
Answer : B
Explanation
If a bean is scoped to HTTP session, scope is session.
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.