×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

Spring Multiple-Choice Questions (MCQs)

The Spring Framework is an application framework of Java. It is light-weight and supports various frameworks like struts, hibernate, tapestry, etc. Its core features can be used by any Java application.

Spring MCQs: This section contains multiple-choice questions and answers on the various topics of Spring. Practice these MCQs to test and enhance your skills on Spring.

List of Spring MCQs

1. Spring framework was released in ____.

  1. 2001
  2. 2002
  3. 2003
  4. 2005

Answer: C) 2003

Explanation:

The spring framework was released in June 2003.

Discuss this Question


2. Is Spring framework open-source?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Yes, the Spring framework is open-source.

Discuss this Question


3. What is IOC?

  1. Integral of conversion
  2. Integrated oriented control
  3. Inversion of conversion
  4. Inversion of control

Answer: D) Inversion of control

Explanation:

IOC stands for Inversion of control.

Discuss this Question


4. IOC is also known as ____.

  1. Dependency injection
  2. Bean Factory
  3. Application dependency

Answer: A) Dependency injection

Explanation:

IOC is also known as Dependency injection.

Discuss this Question


5. Which of the following clearly states the role of IOC in Spring?

  1. To instantiate the application class
  2. To setup the object
  3. To assemble the object dependencies
  4. All of the above

Answer: D) All of the above

Explanation:

Following are the responsibilities of IOC in Spring:

  • To instantiate the application class
  • To setup the object
  • To assemble the object dependencies

Discuss this Question


6. How many types of IOC containers are there?

  1. 5
  2. 4
  3. 3
  4. 2

Answer: D) 2

Explanation:

There are two types of IOC containers:

  • BeanFactory
  • ApplicationContext

Discuss this Question


7. Which is better to use, ApplicationContext or BeanFactory?

  1. BeanFactory
  2. ApplicationContext

Answer: B) ApplicationContext

Explanation:

The ApplicationContext interface is constructed on top of the BeanFactory interface. So, it provides more capabilities than BeanFactory, therefore it is better to use ApplicationContext than BeanFactory.

Discuss this Question


8. ____ are the objects that constitute the backbone of your application and are maintained by the Spring IoC container?

  1. Threads
  2. Process
  3. Beans
  4. Application

Answer: C) Beans

Explanation:

Beans are the objects that constitute the backbone of your application and are maintained by the Spring IoC container.

Discuss this Question


9. ____ is a design technique that eliminates dependencies from programming code to make the application easier to manage and test.

  1. Dependency Injection (DI)
  2. Dependency Lookup (DL)
  3. Dependency constructor (DC)

Answer: A) Dependency Injection (DI)

Explanation:

Dependency Injection (DI) is a design technique that eliminates dependencies from programming code to make the application easier to manage and test.

Discuss this Question


10. The ____ method obtains the resource after the demand

  1. Dependency Injection (DI)
  2. Dependency Lookup (DL)
  3. Dependency constructor (DC)

Answer: B) Dependency Lookup (DL)

Explanation:

The Dependency Lookup method obtains the resource after demand.

Discuss this Question


11. In how many ways you can inject dependency?

  1. 4
  2. 2
  3. 5
  4. 7

Answer: B) 2

Explanation:

The Spring framework provides two methods for injecting dependencies:

  • By constructor
  • By Setter method

Discuss this Question


12. The dependency lookup technique strongly couples the code?

  1. True
  2. False

Answer: A) True

Explanation:

Yes, The dependency lookup technique strongly couples the code, which makes it a problem to use this approach.

Discuss this Question


13. Does the Dependency Lookup technique causes several issues when testing the program, particularly in black box testing?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

The Dependency Lookup technique causes several issues when testing the program, particularly in black box testing.

Discuss this Question


14. Spring framework's ____ capability allows you to insert object dependencies indirectly.

  1. Autowiring
  2. Autoreferences
  3. Applicationbean
  4. AutoBeans

Answer: A) Autowiring

Explanation:

Spring framework's autowiring capability allows you to insert object dependencies indirectly.

Discuss this Question


15. Does Autowiring requires more coding?

  1. Yes
  2. No

Answer: B) No

Explanation:

No, Autowiring needs the least amount of coding.

Discuss this Question


16. Which of the following is the default autowiring mode?

  1. Byname
  2. ByType
  3. No
  4. Constructor

Answer: C) No

Explanation:

No is the standard autowiring mode. It signifies that autowiring is off by default.

Discuss this Question


17. When using ____ autowiring mode, the bean id and reference name must be identical.

  1. Byname
  2. ByType
  3. No
  4. Constructor

Answer: A) Byname

Explanation:

When using byName autowiring mode, the bean id and reference name must be identical.

Discuss this Question


18. Which of the following scope, restricts the bean specification to a single instance per Spring IoC container?

  1. Singleton
  2. Prototype
  3. Session
  4. Global-session

Answer: A) Singleton

Explanation:

Singleton scope, restricts the bean specification to a single instance per Spring IoC container.

Discuss this Question


19. Which of the following scope allows a single bean specification to have an unlimited number of object instances?

  1. Singleton
  2. Prototype
  3. Session
  4. Global-session

Answer: B) Prototype

Explanation:

Prototype scope allows a single bean specification to have an unlimited number of object instances.

Discuss this Question


20. The scope is always ____ by default?

  1. Singleton
  2. Prototype
  3. Session
  4. Global-session

Answer: A) Singleton

Explanation:

The scope is always singleton by default.

Discuss this Question


21. Singleton scope should be used with ____.

  1. EJB stateless session
  2. EJB stateful session bean.

Answer: A) EJB stateless session

Explanation:

Singleton scope should be used with EJB stateless session bean.

Discuss this Question


22. Prototype scope should be used with ____.

  1. EJB stateless session
  2. EJB stateful session bean.

Answer: B) EJB stateful session bean.

Explanation:

Prototype scope should be used with EJB stateful session bean.

Discuss this Question


23. What is AOP?

  1. Aspect object programming
  2. Aspect-oriented programming
  3. Artificial-oriented programming
  4. Artificial object programming

Answer: B) Aspect-oriented programming

Explanation:

AOP stands for Aspect-oriented programming

Discuss this Question


24. ____ beans are defined inside the scope of another bean.

  1. Core
  2. Outer
  3. Peripheral
  4. Inner

Answer: D) Inner

Explanation:

Inner beans are defined inside the scope of another bean.

Discuss this Question


25. ____ denotes an action taken by an aspect at a specific join point.

  1. Interceptor
  2. Advice
  3. Pointcut
  4. Target Object

Answer: B) Advice

Explanation:

Advice denotes an action taken by an aspect at a specific joint point.

Discuss this Question


26. Which of the following type of advice executes before and after a joint point?

  1. Before advice
  2. After Returning Advice
  3. After Throwing Advice
  4. Around Advice

Answer: D) Around Advice

Explanation:

Around Advice is a type of advice that is executed before and after a joint point.

Discuss this Question


27. Which of the following type of advice executes if the method exits by throwing an exception?

  1. Before advice
  2. After Returning Advice
  3. After Throwing Advice
  4. Around Advice

Answer: C) After Throwing Advice

Explanation:

After throwing advice is a type of advice that is executed if the method exits by throwing an exception.

Discuss this Question


28. Which of the following type of advice executes after a joint point has been completed properly?

  1. Before advice
  2. After Returning Advice
  3. After Throwing Advice
  4. Around Advice

Answer: B) After Returning Advice

Explanation:

After Returning Advice executes after a joint point has been completed properly.

Discuss this Question


29. How many types of collection configuration element does Spring offers?

  1. 3
  2. 4
  3. 2
  4. 5

Answer: B) 4

Explanation:

Spring provides the following four types of collection configuration elements:

  • <LIST>
  • <MAP>
  • <SET>
  • <PROPS>

Discuss this Question


30. ____ aids in wiring a group of values that are not duplicated?

  1. <LIST>
  2. <MAP>
  3. <SET>
  4. <PROPS>

Answer: C) <SET>

Explanation:

<SET> aids in wiring a group of values that are not duplicated.

Discuss this Question


31. Which of the following is useful for wiring, such as injecting a list of variables and allowing for duplication?

  1. <LIST>
  2. <MAP>
  3. <SET>
  4. <PROPS>

Answer: A) <LIST>

Explanation:

<LIST> is useful for wiring, such as injecting a list of variables and allowing for duplication.

Discuss this Question


32. ____ can be employed to inject a collection of name-value pairs with any type of name and value?

  1. <LIST>
  2. <MAP>
  3. <SET>
  4. <PROPS>

Answer: B) <MAP>

Explanation:

<MAP> can be employed to inject a collection of name-value pairs with any type of name and value.

Discuss this Question


33. How many different ways may Spring-based apps be configured?

  1. Java-based configuration
  2. XML-based configuration
  3. Annotation-based configuration
  4. All of the above

Answer: D) All of the above

Explanation:

Spring-based apps be configured in the following ways:

  • Java-based configuration
  • XML-based configuration
  • Annotation-based configuration

Discuss this Question


34. How many autowiring modes are there in Spring?

  1. 4
  2. 5
  3. 2
  4. 3

Answer: A) 4

Explanation:

There are 4 autowiring modes:

  • No
  • ByName
  • Bytype
  • Constructor

Discuss this Question


35. What are the limitations of autowiring in spring?

  1. Simple attributes like as primitives, Strings, and Classes cannot be autowired.
  2. Autowiring is not as precise as explicit wiring.
  3. All of the above

Answer: C) All of the above

Explanation:

Following are the disadvantages of autowiring:

  • Simple attributes like as primitives, Strings, and Classes cannot be autowired.
  • Autowiring is not as precise as explicit wiring.

Discuss this Question


36. ____ is a class that accepts incoming requests and routes them to the appropriate resources such as controllers, models, and views.

  1. DispatcherServlet
  2. Servlet
  3. ServletContext
  4. HandlerApapter

Answer: A) DispatcherServlet

Explanation:

DispatcherServlet is a class that accepts incoming requests and routes them to the appropriate resources such as controllers, models, and views.

Discuss this Question


37. With Spring Web MVC, which class serves as the front controller?

  1. DispatcherServlet
  2. Servlet
  3. ServletContext
  4. HandlerApapter

Answer: A) DispatcherServlet

Explanation:

The DispatcherServlet class serves as the front controller in Spring Web MVC.

Discuss this Question


38. Which annotation designates a class as the controller?

  1. @cont
  2. @controller
  3. @_controller
  4. @__controller

Answer: B) @controller

Explanation:

The @Controller annotation designates a class as the controller.

Discuss this Question


39. A ____ contains an application's business logic.

  1. Model
  2. View
  3. Controller

Answer: C) Controller

Explanation:

A controller contains an application's business logic.

Discuss this Question


40. We can construct only one controller in Spring MVC at the same time?

  1. True
  2. False

Answer: B) False

Explanation:

We can construct many controllers in Spring MVC at the same time.

Discuss this Question


41. In the controller class, ____ is used to read the HTML form data that the user has given.

  1. HttpServletRequest
  2. Model
  3. HttpModel

Answer: A) HttpServletRequest

Explanation:

HttpServletRequest is used to read the HTML form data that the user has given.

Discuss this Question


42. What are the responsibilities of JdbcTemplate class?

  1. Takes care of resource generation
  2. We can carry out all database operations.
  3. Handles the exception and displays useful error messages
  4. All of the above

Answer: D) All of the above

Explanation:

Following are the responsibilities of Jdbctemplate class:

  • Takes care of resource generation
  • We can carry out all database operations.
  • Handles the exception and displays useful error messages

Discuss this Question


43. Using the ____ function of the JdbcTemplate class, we can simply get records from the database.

  1. Fetch()
  2. Query()
  3. Get()

Answer: B) Query()

Explanation:

Using the query() function of the JdbcTemplate class, we can simply get records from the database.

Discuss this Question


44. ____ is used to increase modularity by cross-cutting concerns.

  1. JVM
  2. Jdbctemplate class
  3. OOP
  4. AOP

Answer: D) AOP

Explanation:

AOP is used to increase modularity by cross-cutting concerns.

Discuss this Question


45. The ResultSetExtractor is used ____.

  1. To get records from a database
  2. To set records of a database
  3. None

Answer: A) To get records from a database

Explanation:

The ResultSetExtractor is used to get records from a database.

Discuss this Question


46. Which of the following helps us to fetch the record from the database?

  1. ResultSetExtractor
  2. RowMapper
  3. Both
  4. None

Answer: C) Both

Explanation:

ResultSetExtractor, and RowMapper both are used to fetch the record from the database.

Discuss this Question


47. Which of the following annotation is used to associate a URL with a whole class or a specific handler function?

  1. @RequestMapping
  2. @RequestMap
  3. @RequestMapper
  4. @Mapper

Answer: A) @RequestMapping

Explanation:

The @RequestMapping annotation is used to associate a URL with a whole class or a specific handler function.

Discuss this Question


48. Among Local and Global transactions, which is easier to implement?

  1. Local Transactions
  2. Global transactions

Answer: A) Local Transactions

Explanation:

Local transactions are easier to implement.

Discuss this Question


49. Which transaction management is required in a distributed computing environment?

  1. Local Transactions
  2. Global transactions

Answer: B) Global transactions

Explanation:

Global transaction management is required in a distributed computing environment, whereas Local transaction management is required in a centralized computing environment.

Discuss this Question


50. How many types of transaction management does spring support?

  1. 3
  2. 4
  3. 5
  4. 2

Answer: D) 2

Explanation:

Spring supports two types of transaction management:

  • Programmatic transaction management
  • Declarative transaction management

Discuss this Question


51. Which type of transaction management is preferred?

  1. Programmatic transaction management
  2. Declarative transaction management

Answer: B) Declarative transaction management

Explanation:

Declarative transaction management is preferred over programmatic transaction management.

Discuss this Question


52. Which type of transaction management enables you to handle transactions using programming in your source code?

  1. Programmatic transaction management
  2. Declarative transaction management

Answer: A) Programmatic transaction management

Explanation:

The programmatic transaction management solution enables you to handle transactions using programming in your source code.

Discuss this Question


53. Which type of transaction management allows you to handle transactions using configuration rather than hard-coding in your source code?

  1. Programmatic transaction management
  2. Declarative transaction management

Answer: B) Declarative transaction management

Explanation:

The declarative transaction management solution allows you to handle transactions using configuration rather than hard-coding in your source code.

Discuss this Question


54. What is DAO?

  1. Data-accurate object
  2. Data access oriented
  3. Data access object

Answer: C) Data access object

Explanation:

DAO stands for Data Access Object.

Discuss this Question


55. The key unit of modularity in OOP is the ____?

  1. Module
  2. Class
  3. Aspect
  4. Objects

Answer: B) Class

Explanation:

The key unit of modularity in OOP is the class.

Discuss this Question


56. The key unit of modularity in AOP is the ____?

  1. Module
  2. Class
  3. Aspect
  4. Objects

Answer: C) Aspect

Explanation:

The key unit of modularity in AOP is the Aspect.

Discuss this Question


57. Which Annotation indicates that a particular parameter, return value, or field is null?

  1. @null
  2. @nullable
  3. @nullify

Answer: B) @nullable

Explanation:

@nullable annotation indicates that a particular parameter, return value, or field is null.

Discuss this Question


58. ____ is the technique of connecting aspects with other types of applications.

  1. Weaving
  2. Interceptor
  3. Jointpoint

Answer: A) Weaving

Explanation:

Weaving is the technique of connecting aspects with other types of applications.

Discuss this Question


59. ____ is a class-like feature that just includes one piece of advice.

  1. Weaving
  2. Interceptor
  3. Jointpoint

Answer: B) Interceptor

Explanation:

Interceptor is a class-like feature that just includes one piece of advice.

Discuss this Question


60. SpEL stands for ____.

  1. Spring expression language
  2. Spring ejection language
  3. Spring ejection Locator

Answer: A) Spring expression language

Explanation:

SpEL stands for Spring expression language.

Discuss this Question




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.