- 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 I
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 - Which of the following is correct assertion about spring?
A - Spring enables developers to develop enterprise-class applications using POJOs.
Answer : D
Explanation
Spring provides all above mentioned functionalities.
Q 3 - What is Dependency Injection?
A - It is a design pattern which implements Inversion of Control for software applications.
B - It is one of the spring module.
Answer : A
Explanation
Dependency Injection is a design pattern which implements Inversion of Control for software applications.
Q 4 - 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.
Answer : A
Explanation
AOP stands for Aspect Oriented Programming.
Q 6 - What is true about cross-cutting concerns?
A - The functions that span multiple points of an application are called cross cutting concerns.
B - Cross-cutting concerns are conceptually separate from the application's business logic.
C - Logging is one of the examples of cross cutting concerns.
Answer : A
Explanation
Cross-cutting concerns are the functions that span multiple points of an application.
Q 7 - 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 8 - Which are the modules of Data Access/ integration layer?
Answer : A
Explanation
JDBC, ORM, OXM, JMS, Transactions are the modules of Data Access/ Integration layer.
Q 9 - Which are the modules of Web layer?
A - WebSocket, Servlet, Web, Portlet
Answer : A
Explanation
WebSocket, Servlet, Web, Portlet are the modules of Web layer.
Q 10 - Which of the statement is not correct?
Answer : D
Explanation
All of the above statements are correct.
Q 11 - Which of the statement is correct?
C - The Java Messaging Service JMS module contains features for producing and consuming messages.
Answer : D
Explanation
All of the above statements are correct.
Q 12 - Which of the statement is correct?
Answer : D
Explanation
All of the above statements are correct.
Q 13 - 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 14 - Which are the IoC containers in Spring?
A - BeanFactory, ApplicationContext
B - BeanFactory, ApplicationContext, IocContextFactory
Answer : A
Explanation
BeanFactory, ApplicationContext classes acts as IoC containers in Spring.
Q 15 - 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 16 - Which are the correct implementation classes of ApplicationContext?
A - FileSystemXmlApplicationContext, ClassPathXmlApplicationContext, WebXmlApplicationContext
B - FileSystemApplicationContext, ClassPathApplicationContext, WebApplicationContext
C - AdvancedApplicationContext, FileApplicationContext
D - FileSystemApplicationContext, ClassPathApplicationContext
Answer : A
Explanation
FileSystemXmlApplicationContext is the implementation class of ApplicationContext. Other mentioned classes do not exists.
Q 17 - Which of the following stands true for spring beans?
A - Spring beans are managed by the Spring IoC container.
B - Spring beans are instantiated, assembled, and otherwise managed by a Spring IoC container.
Answer : D
Explanation
All of the above statements are correct.
Q 18 - Which is the way to provide configuration metadata to spring?
A - XML Based configuration file.
Answer : D
Explanation
All of the above statements are correct.
Q 19 - What is bean scope?
A - Bean scope forces Spring to produce a new bean instance as per the scope defined.
B - Bean scope defines the accessibility of bean in a java class.
C - Bean scope defines the accessibility of bean in a java package.
D - Bean scope defines the accessibility of bean in a web application.
Answer : A
Explanation
Bean scope instructs Spring Container to produce a new bean instance as per the scope defined.
Q 20 - 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 21 - 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 22 - What is request scope?
A - This scopes a bean definition to an HTTP request.
B - This scopes the bean definition to Spring IoC container.
C - This scopes the bean definition to HTTP Session.
D - This scopes the bean definition HTTP Application/ Global session.
Answer : A
Explanation
request scope instructs Spring IoC container to create a instance per HTTP request.
Q 23 - 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.
Q 24 - What is global-session scope?
A - This scopes a bean definition to an HTTP Application/ Global session.
B - This scopes the bean definition to Spring IoC container.
Answer : A
Explanation
global-session scope instructs Spring IoC container to create a instance per HTTP application.
Q 25 - What is default scope of bean in Spring framework?
Answer : A
Explanation
singleton is the default scope of any spring bean.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | A |
2 | D |
3 | A |
4 | A |
5 | A |
6 | A |
7 | A |
8 | A |
9 | A |
10 | D |
11 | D |
12 | D |
13 | A |
14 | A |
15 | A |
16 | A |
17 | D |
18 | D |
19 | A |
20 | A |
21 | A |
22 | A |
23 | A |
24 | A |
25 | A |