Learn. Practice. Feel prepared.
Spring Objective Questions and Answers
Test and improve your knowledge of the Spring Framework with expertly curated MCQs covering IoC, Dependency Injection, Bean lifecycle, annotations, AOP, Spring JDBC, transactions, and Spring MVC. Perfect for Spring interviews, backend developers, and Java professionals aiming to strengthen their framework fundamentals.
Practice Spring MCQs with Detailed Explanations
Answer at least 12 questions to submit and verify answers.
1 What is Spring ?
Correct answer:
an open source framework
2 What is IOC ?
Correct answer:
Design Pattern
3 Which of the following is not a Spring Module ?
Correct answer:
HTML/JSP
4 Beans defined in spring framework are by default .. .?
Correct answer:
Singleton
5 What are different types of Bean Injections ?
Correct answer:
constructor and setter
6 Which are different points where weaving can be applied ?
Correct answer:
Compile Time , Classload Time , load time
7 What is a controller in Spring ?
Correct answer:
Interface
8 Which of the following is actual representation of the Spring IoC container ?
Correct answer:
BeanFactory
9 How container load configuration metadata from a variety of external resources such as the local file system from the Java CLASSPATH ?
Correct answer:
ApplicationContext constructor
10 Which of following is correct way to load bean definitions from another file ?
Correct answer:
<import resource="something.xml"/>
11 What do you mean by inner bean?
Correct answer:
A <bean/> element inside the <property/> or <constructor-arg/> elements is used to define a so-called inner bean.
12 What are responsibilities included for bean factory do ? A.Instantiating or sourcing application objects B.configuring such objects C.Assembling the dependencies between these objects D.Manage lifecycle of spring
Correct answer:
A,B,C
13 What are the responsibilities of XmlBeanFactory included ? A.This implementation allows you to express the objects that compose your application B.Resolve inter-dependencies between such objects, in terms of XML C.The XmlBeanFactory takes this XML configuration metadata and uses it to create a fully configured system or application D.Non of these
Correct answer:
A,B,C
14 What are the correct ways to instantiate bean? A.Using default (empty) constructor B.Instantiation using a static factory method C.Instantiation using an instance factory method D.Using the container E.All these above are true
Correct answer:
E
15 Which statements are true about IOC(Inversion of Control) ? A.Decoupling of the execution of a certain task from implementation. B.Each module can focus on what it is designed for. C.Replacing modules should not affect to other modules. D.Modules should observe about what other systems do . E.All the above
Correct answer:
A,B,C