MCQ

Spring MCQs – Multiple Choice Questions and Answers – Part 4

Multiple choice questions and answers (MCQs) on Spring to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as Spring Data, JPA, Spring MVC, XML, Hibernate, and more. This quiz will easily prepare anyone to pass their online test.
 

1. How many proxy types are there in the Spring framework?

A One

B Two

C Three

D Four

B
  1. Static
  2. Dynamic

 

 

2. What are the features offered by Spring?

A Resource management

B Resource unwrapping

C Exception handling

D Transaction participation

E All the answers are true

E

 

 
 

3. Choose the correct option:

A The first version was written by Rod Johnson, released in October 2002.

B The framework was first released under the Apache 2.0 license in June 2003.

C The Spring 1.2.6 framework won a productivity award and an innovation award in 2006.

D All the answers are true

D

 

 

4. Choose the correct option:

A The Spring framework is an open source application.

B The Spring framework is a Java platform.

C The Spring framework is used by the .NET framework.

D All the answers are true

D

 

 

5. Spring is an MVC framework based on requests?

A Yes

B No

A

 

 
 

6. What does MVC mean for Spring?

A Model view Controller

B Middle view Controller

C Module view Controller

D None of the above

A

 

 

7. What does AOP mean to Spring?

A Aspect Oriented Programs

B Aspect Oriented Programming

C Aspect Oriente Programming

D None of the above

B

 

 

8. How to externalize constants from a Spring configuration file or a Spring annotation in the .properties file?

A Using the tag util:constant

B By declaring the post-processor of the ConstantPlaceholderConfigurer bean

C Using the tag contexte:property-placeholder

D Using the namespace c:

C
  1. The <util:constant static-field="constant_name"/> tag is used to reference a Java constant or enumeration in a spring configuration file.
  2. ConstantPlaceholderConfigurer does not exist. You can think of the PropertyPlaceholderConfigurer post-processor.
  3. The <context:property-placeholder location = "file: /maApp.properties" /> tag enables placeholder replacement $ {…}, resolved from the specified property file.
  4. The c: namespace is intended to simplify the constructor syntax (since Spring 3.1) and does not provide such a feature.

 

 

9. How many dynamic proxy types are available in Spring?

A One

B Two

C Three

D Four
 

 
B
  1. JDK Dynamic Proxy
  2. CGLIB Dynamic Proxy

 

 

10. Select the correct statement to reference a Spring configuration file inside the com.stackhowto.myapp package in the example below?
ApplicationContext context = new 
ClassPathXmlApplicationContext("classpath:/com.stackhowto.myapp.config.xml");

A The classpath: prefix can be omitted

B The name of the package with the dot is not well formatted

C The slash before com.stackhowto can be omitted

D All the answers are true

D
  1. When you use the ClassPathXmlApplicationContext, the prefix classpath: is the default prefix. So you can remove it.
  2. The location of a resource in Spring, the package separator is a slash and not a dot. Thus, the syntax com/stackhowto/myapp/config.xml should be used.
  3. ClassPathXmlApplicationContext starts searching from the root of the class path, whether or not you specify “/”

 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *