
- 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
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Spring Mock Test
This section presents you various set of Mock Tests related to Spring Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Spring Mock Test IV
Answer : B
Explanation
By default a bean is eagerly loaded.
Answer : B
Explanation
By default a bean is eagerly loaded.
Q 3 - If a bean is scoped to HTTP request, scope is
Answer : D
Explanation
If a bean is scoped to HTTP request, scope is request.
Q 4 - If a bean is created once per Ioc Container, scope is
Answer : A
Explanation
If a bean is created once per Ioc Container, scope is singleton.
Q 5 - Thread scoped bean is introduced in which version of spring framework.
Answer : C
Explanation
Thread scoped bean is introduced in 3.0 version of spring framework.
Q 6 - If a bean can be created any number of times, scope is
Answer : C
Explanation
In prototype scope, a bean can be created any number of times.
Q 7 - What is the scope of stateless bean?
Answer : B
Explanation
Stateless bean is of singleton scope.
Answer : C
Explanation
Stateful bean is of prototype scope.
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 - 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.
Q 11 - How bean life cycle can be controlled?
B - Using InitializingBean class only
Answer : D
Explanation
Life cycle of a bean can be controlled using init() method or using InitializingBean / DisposableBean classes.
Q 12 - What is the scope of bean in portlet context?
Answer : B
Explanation
Scope of bean in portlet context is global-session.
Q 13 - How after advice works?
A - Run advice after a method execution regardless of its outcome.
B - Run advice after a class loads.
Answer : A
Explanation
after advice runs after a method execution regardless of its outcome.
Q 14 - Which class is used to map a database row to a java object in spring?
Answer : B
Explanation
RowMapper class is used to map a database row to a java object in spring.
Answer : B
Explanation
Id is not a mandatory attribute in beans configuration file.
Q 16 - 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.
Q 17 - Which of the following class can be used to call Stored Procedures in spring?
Answer : D
Explanation
SimpleJdbcCall class can be used to call Stored Procedures in spring.
Q 18 - What is a DispatcherServlet?
A - DispatcherServlet is used for transaction management.
B - DispatcherServlet is used for AOP.
C - DispatcherServlet handles all the HTTP requests and responses.
Answer : C
Explanation
DispatcherServlet handles all the HTTP requests and responses.
Q 19 - What is ACID in transactional management?
A - Accurate, Controlled, Isolation, Durability
B - Atomicity, Consistency, Independent, Done
Answer : C
Explanation
ACID stands for Atomicity, Consistency, Isolation, Durability.
Q 20 - Where do you define DispatcherServlet?
Answer : B
Explanation
DispatcherServlet is defined in web.xml of web application.
Q 21 - What is true about BeanPostProcessor?
Answer : B
Explanation
BeanPostProcessor is an interface.
Q 22 - 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.
Answer : A
Explanation
A bean can be configured to have an inner bean.
Answer : A
Explanation
Both values and ref can be injected at a time in a bean.
Q 25 - Following class can be extended to create custom event in spring.
Answer : C
Explanation
ApplicationEvent is used to create custom events.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | B |
3 | D |
4 | A |
5 | C |
6 | C |
7 | B |
8 | C |
9 | B |
10 | D |
11 | D |
12 | B |
13 | A |
14 | B |
15 | B |
16 | A |
17 | D |
18 | C |
19 | C |
20 | B |
21 | B |
22 | B |
23 | A |
24 | A |
25 | C |