Spring Flashcards

1
Q

ApplicationContext will pre-instantiate beans with the ________ bean scope.
Select one:
a. Global Session
b. Singleton
c. Prototype
d. ApplicationContext never pre-instantiates beans

A

b. Singleton

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
How do you turn ON annotation support in Spring MVC?
Select one:
a. beans annotation-driven
b. mvc annotation-driven 
c. mvc annotation-config
d. context annotation-config
A

b. mvc annotation-driven

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
How do you turn ON annotation-based autowiring in Spring?
Select one:
a. context annotation-driven
b. mvc annotation-driven
c. beans annotation-driven
d. context annotation-config
A

d. context annotation-config

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the minimum number of beans needed in the xml file to integrate Spring and Hibernate assuming that you must use the xml to wire beans, and transaction management by Spring is required?

Select one:

a. 2
b. 3
c. 4
d. 1

A

b. 3

Hibernate Contextual Session
Context Annotation-Config
-Data Source
-Hibernate Transaction Manager
-Session Factory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

My Contextual Session integration is not working! I have a setter for my SessionFactory in my DAO class to inject the SessionFactory. I wired my DataSource bean into the SessionFactory bean. I also wired the SessionFactory bean into the DAO bean. I annotated (Transactional) each CRUD method to a transaction in the DAO class and use the tag in appContext.xml.
Select one:
a. Contextual Sessions is a deprecated process. Just use Hibernate Template.
b. Create a TransactionManager bean and wire the DataSource bean into it.
c. Create a TransactionManager bean and wire the DAO bean into it.
d. Create a TransactionManager bean and wire the SessionFactory bean into it.

A

d. Create a TransactionManager bean and wire the SessionFactory bean into it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Select the core component of the Spring MVC module.

Select one:

a. ActionServlet
b. FrontControllerServlet
c. Faces-Servlet
d. DispatcherServlet

A

d. DispatcherServlet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Select the following correct statement regarding Spring.
Select one:
a. Does not encourage tight coupling.
b. Does not have enough modules to be considered a true framework.
c. Does not allow for transaction management.
d. Does not allow for integration into an application at any point in development
e. Does not provide developers with vast amounts of community supported documentation.

A

a. Does not encourage tight coupling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Select the incorrect annotation from the list.

Select one:

a. @Autowired
b. @Controller
c. @Transactional
d. @Component
e. @Dao

A

e. @Dao

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Select the incorrect module of Spring

Select one:

a. Core
b. Data Source
c. Beans
d. Context

A

b. Data Source

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
The \_\_\_\_ takes the request and calls the appropriate service methods based on used GET or POST method.
Select one:
a. DispatcherServlet
b. HandlerMapping
c. Controller
d. ViewResolver
A

c. Controller

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
The DispatcherServlet will take help from \_\_\_\_\_ to pickup the defined view for the request
Select one:
a. HandlerMapping
b. DispatcherServlet
c. Controller 
d. ViewResolver
A

d. ViewResolver

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
The Spring MVC DispatcherServlet consults the \_\_\_\_ to call the appropriate Controller.
Select one:
a. Controller
b. HandlerMapping
c. ViewResolver 
d. DispatcherServlet
A

b. HandlerMapping

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
The Spring Web MVC framework is designed around a \_\_\_\_\_ that handles all the HTTP requests and responses
Select one:
a. HandlerMapping 
b. DispatcherServlet
c. Controller
d. ViewResolver
A

b. DispatcherServlet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
This annotation identifies the method as a request handler type for a given path.
Select one:
a. @Controller
b. @RequestMapping 
c. @Handler
d. @Path
A

b. @RequestMapping

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
This annotation registers the class as a controller and must be used in conjunction with  tag in the XML to automatically discover and register the controllers as Spring beans.
Select one:
a. @Path
b. @Controller 
c. @Handler
d. @RequestMapping
A

b. @Controller

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the different ways in which you can integrate Spring/Hibernate?

Select one:

a. HibernateTemplate, HibernateDaoSupport, ContextualSessions
b. JDBCTemplate, HibernateDaoSupport, ContextualSessions
c. HibernateTemplate, DelegatingActionProxy, ContextualSessions
d. HibernateTemplate, HibernateDaoSupport, TransactionManagement

A

a. HibernateTemplate, HibernateDaoSupport, ContextualSessions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are the scopes of a Spring bean?

Select one:

a. Singleton, Prototype, Session, Global Session, Request
b. Request, Response, Session, Global Session
c. Singleton, Prototype, Session, Request
d. Request, Session, Application, Page

A

a. Singleton, Prototype, Session, Global Session, Request

18
Q

What do you mean by autowiring?
Select one:
a. Spring automatically defining the concrete class dependency to be injected
b. None of the above
c. Spring auto-resolves collaborators for your bean by inspecting the contents of the BeanFactory
d. Spring automatically locates a beans concrete class in the classpath

A

c. Spring auto-resolves collaborators for your bean by inspecting the contents of the BeanFactory

19
Q

What do you mean by bean wiring?
Select one:
a. The act of creating associations between beans within the Spring container
b. The act of Spring deploying beans to a Web servlet container
c. The act of defining the concrete class dependency to be injected
d. The act of naming a bean to locate it in the ApplicationContext

A

a. The act of creating associations between beans within the Spring container

20
Q

What is Application Context?
Select one:
a. All of the above
b. The core component of Spring that deploys concrete components to a Servlet container
c. A BeanFactory with more features, such as text messaging, generic resource loaders, and bean event listeners
d. A BeanFactory that does not pre-instantiate its singleton beans

A

c. A BeanFactory with more features, such as text messaging, generic resource loaders, and bean event listeners

21
Q

What is Bean Factory?
Select one:
a. A class you define and create in your Spring application that implements the Factory design pattern
b. A Web GUI tool that allows you to access your bean definitions
c. Holds Bean Definitions of multiple beans within itself and then instantiates the bean when requested
d. A means for resolving text messages, including support for internationalization

A

c. Holds Bean Definitions of multiple beans within itself and then instantiates the bean when requested

22
Q

What is dependency injection?
Select one:
a. A design pattern used when we want to locate various services using JNDI lookup
b. A design pattern that creates an object while making sure that only single object gets created
c. A design pattern that passes concrete instances during object creation or initialization
d. A design pattern that hides the complexities of the system and provides an interface to the client

A

c. A design pattern that passes concrete instances during object creation or initialization

23
Q

What is Spring AOP?
Select one:
a. A programming technique that allows programmers to modularize crosscutting concerns
b. A technique to modularize behavior that cuts across the typical divisions of responsibility
c. All of the above
d. A Spring module that can provide declarative enterprise services

A

c. All of the above

24
Q

What is Spring MVC?

Select one:

a. A module that provides for integration with Struts.
b. Allows for component scanning through the component-scan tag in the applicationContext.xml.
c. Required for DI (Dependency Injection).
d. A fully featured MVC framework that is a module of Spring.

A

d. A fully featured MVC framework that is a module of Spring.

25
Q

What is Spring?
Select one:
a. An open source tool to perform continuous integration and build automation
b. An open source framework created to address the complexity of enterprise application development
c. An open-standard, XML-based messaging protocol for exchanging information among computers
d. An open source Java persistence framework that performs powerful object relation

A

b. An open source framework created to address the complexity of enterprise application development

26
Q
What is the current core container in Spring?
Select one:
a. ApplicationContext 
b. BeanFactory
c. XMLBeanFactory
d. WebContext
A

a. ApplicationContext

27
Q

What is the typical Bean life cycle in Spring Bean Factory Container?
Select one:
a. Instantiate, populate properties, pre-init PostProcessor, afterPropertiesSet, post-init PostProcessor, in use, destroy
b. SetBeanName, setBeanFactory, pre-init PostProcessor, instantiate, populate properties, post-init PostProcessor, in use, destroy, custom destroy
c. Instantiate, populate properties, setBeanName, setBeanFactory, pre-init PostProcessor, afterPropertiesSet, custom init, post-init PostProcessor, in use, destroy, custom destroy
d. Instantiate, custom init, populate properties, afterPropertiesSet, setBeanName, setBeanFactory, pre-init PostProcessor, post-init PostProcessor, in use, destroy, custom destroy

A

c. Instantiate, populate properties, setBeanName, setBeanFactory, pre-init PostProcessor, afterPropertiesSet, custom init, post-init PostProcessor, in use, destroy, custom destroy

28
Q
Which is not a bean scope in Spring Framework?
Select one:
a. Session
b. Singleton
c. Factory 
d. Prototype
A

c. Factory

29
Q
Which is not a component of Spring MVC?
Select one:
a. ViewResolver
b. RequestProcessor 
c. DispatcherServlet
d. HandlerMapping
A

b. RequestProcessor

30
Q
Which is not one of the common implementations of the Application Context?
Select one:
a. ClassPathXmlApplicationContext
b. FileSystemXmlApplicationContext
c. WebXmlApplicationContext 
d. XmlWebApplicationContext
A

c. WebXmlApplicationContext

31
Q
Which transaction propagation strategy creates a new transaction, and suspends the current transaction if one exists?
Select one:
a. REQUIRED 
b. SUPPORTS
c. MANDATORY
d. NOT_SUPPORTED
e. NEVER
f. REQUIRES_NEW
A

f. REQUIRES_NEW

32
Q
Which transaction propagation strategy executes non-transactionally, and throws an exception if a transaction exists?
Select one:
a. NEVER
b. SUPPORTS
c. REQUIRED
d. NOT_SUPPORTED 
e. MANDATORY
f. REQUIRES_NEW
A

a. NEVER

33
Q
Which transaction propagation strategy executes non-transactionally, and suspends the current transaction if one exists?
Select one:
a. NOT_SUPPORTED
b. SUPPORTS
c. MANDATORY 
d. REQUIRES_NEW
e. NEVER
f. REQUIRED
A

a. NOT_SUPPORTED

34
Q
Which transaction propagation strategy supports a current transaction, and throws an exception if none exists?
Select one:
a. MANDATORY
b. NEVER
c. REQUIRED
d. SUPPORTS 
e. REQUIRES_NEW
f. NOT_SUPPORTED
A

a. MANDATORY

35
Q
Which transaction propagation strategy supports a current transaction, and creates a new one if none exists?
Select one:
a. MANDATORY
b. REQUIRED
c. NEVER
d. NOT_SUPPORTED
e. REQUIRES_NEW 
f. SUPPORTS
A

b. REQUIRED

36
Q
Which transaction propagation strategy supports a current transaction, and executes non-transactionally if none exists?
Select one:
a. SUPPORTS 
b. NEVER
c. NOT_SUPPORTED
d. REQUIRES_NEW
e. MANDATORY
f. REQUIRED
A

a. SUPPORTS

37
Q

Why should we use DI (Dependency Injection) over conventional development techniques? Select all that apply.

Select one or more:

a. Using the Spring DI provider, it tightly binds our application with the Spring framework.
b. It allows the container to manage our dependencies.
c. It provides for loose coupling.
d. It allows the developer to utilize Spring’s autowiring capabilities.

A

b. It allows the container to manage our dependencies.
c. It provides for loose coupling.
d. It allows the developer to utilize Spring’s autowiring capabilities.

38
Q

Spring Transaction Management eases development by delegating transaction management to Struts’ Transaction Manager.

Select one:
True
False

A

False

39
Q

HibernateTemplate is a native way to interact with Hibernate Session objects to access the database.

Select one:
True
False

A

False

40
Q

In Spring MVC, a controller is a class that provides direct access to methods based on URL patterns and HTTP Methods.

Select one:
True
False

A

True

41
Q

The BeanFactory provides eager instantiation, i18n, and listener capabilities.

Select one:
True
False

A

False