Do you know that? For web developers it is $30 - $59/hr next

Contact Email: teammmrem@yahoo.com

<< All Upwork (oDesk) and Elance Tests << Elance test answers << IT & Programming category

Test answers for Spring Framework 2020

(189) Last updated: February 28
Elance • IT & Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:



Collapse | Expand

189 Answered Test Questions:

1. Which of these resource prefixes could be used?

Answers:

• classpath:

• All of these

• file:

• http:

2. spring-test uses what common convention to allow testing using HTTP session and HTTP request objects?

Answers:

• MVC

• Open-closed principle

• DAOs

• Mock objects

3. Is the following valid ? - <map><entry key="a" value="b" /></map>

Answers:

• Yes

• No

4. What is the SpringJUnit4ClassRunner class used for?

Answers:

• Configuring the Maven Surefire plugin

• Along with @RunWith, starting and stopping a Spring context properly while running JUnit tests

• configuring TestNG

5. What if I need a method to be called after bean construction?

Answers:

• write a custom Handler

• use init-method or @PostConstructor

• delegate to a proxy

6. True or False? Using Spring's JDBC support forces you to use Oracle.

Answers:

• TRUE

• False

7. How is slf4j commonly used in Spring applications?

Answers:

• as a bean

• as the logging framework

• as the JDBC provider

8. What types of transaction management does Spring support?

Answers:

• Both of these

• Programmatic transaction management

• Declarative transaction management

9. Which of the following is not a valid method to provide configuration metadata to a Spring Container?

Answers:

• By marshalling & unmarshalling the objects

• XML based configuration file

• Java-based configuration

• Annotation-based configuration

10. In AOP, what are the different points where weaving can be applied?

Answers:

• All of these

• Compile time

• Load time

• Run time

11. How many bean configuration files can you have?

Answers:

• as many as you want

• only one

• two

12. What is MultipartFile used for?

Answers:

• Reading files from disk

• Saving files to disk

• Supporting multi-part HTTP requests

• That doesn't exist

13. Can you inject null and empty string values in Spring?

Answers:

• Yes

• No

14. What type of dependency injection does Spring NOT support?

Answers:

• Interface injection

• Constructor injection

• Setter injection

15. Is it possible to set up Spring AOP using XML configuration only (as opposed to annotations)?

Answers:

• Yes

• No

16. What is the role of the @PostConstruct and @PreDestroy annotations?

Answers:

• You force in GC when something happens

• None of these

• Similar to init and destroy method

• They are enterprise level constructors

17. True or False? Spring supports custom bean scopes.

Answers:

• FALSE

• True

18. How are mocks used in Spring?

Answers:

• Spring ignored mocks.

• Spring and mocks do not go together well.

• They are an important part of using Spring in tests.

19. Does Spring support injection of Enum types?

Answers:

• YES

• NO

20. Configuration to declare a JTA transaction manager ???<bean id="mgr" class="org.springframework.transaction.jta.JtaTransactionManager" />???   Is this correct?

Answers:

• Yes

• No

21. @RequestMapping is part of which part of Spring?

Answers:

• Web MVC

• Web

• DAO

• Security

22. True or False? Spring Web MVC supports different locales out of the box.

Answers:

• FALSE

• True

23. How can you provide configuration metadata to the Spring container?

Answers:

• All of these

• Annotation-based configuration

• Java-based configuration

• XML based configuration file

24. What is AOP?

Answers:

• Aspect oriented programming

• None of these

• Advanced oriented programming

• Abstract oriented programming

25. What is NOT a way for beans to be defined?

Answers:

• JSON

• Java

• XML configuration file

26. Spring Security currently supports authentication integration with which of the following technology

Answers:

• LDAP

• HTTP BASIC authentication headers

• HTTP Digest authentication headers

• Form-based authentication

• All

27. What does a bean definition contain?

Answers:

• Bean's dependencies

• How to create a bean

• Bean's lifecycle details

• All of these

28. True or False? Spring supports lookup via JNDI.

Answers:

• FALSE

• True

29. Which of the following ORM are supported in Spring

Answers:

• iBatis

• All

• Java Data Objects(JDO)

• OJB

• TopLink

30. Which of the following is true when creating a custom login form for applications using Spring Security?

Answers:

• The method of the login form must be POST

• The form action url must match the "login-processing-url" attribute of <form-login> element in security.xml file

• The name of the username input must corresponds to the values of username-parameter attribute of <form-login> element in security.xml file

• All of these

31. Which of these are types of IOC (dependency injection) ?

Answers:

• None of these

• Constructor Injection (e.g. Pico container, Spring etc): Dependencies are provided as constructor parameters.

• Interface Injection (e.g. Avalon): Injection is done through an interface.

• Setter Injection (e.g. Spring): Dependencies are assigned through JavaBeans properties (ex: setter methods).

• All of these

32. True or False? Spring provides an abstraction over JMS.

Answers:

• FALSE

• True

33. What is bean wiring?

Answers:

• avoiding a cross-cutting concern

• consuming a web service

• connecting the different beans (components) of an application

• publishing objects in a web service

34. Transaction MUST follow which of the following properties?

Answers:

• Isolation

• Consistency

• All of these

• Atomicity

35. What are the supported scopes in Hibernate?

Answers:

• Singleton (default)

• All of these

• Prototype

• Web (session, request)

36. Which of the following statements are true about Spring Testing Support?

Answers:

• The @ContextConfiguration annotation defines the locations of your configuration files

• The @Runwith annotation allows you to specify the testing frameworking you would like to use

• The TestContext framework of Spring 3 helps simplifying switching between different test framework

• All of these

37. Which of the following is NOT a HTTP operation?

Answers:

• GET

• PUT

• POST

• MODIFY

38. What are the different modules in Spring framework?

Answers:

• Hibernate Module

• Webex module

• JDBC abstraction and DAO module

39. What are the different points where weaving can be applied?

Answers:

• Runtime

• Classload Time

• All of these

• Compile Time

40. The transaction attribute supported by Spring includes:

Answers:

• rollback rules

• propagation behavior

• isolation levels

• All of these

41. What is the difference between Bean Factory and Application Context?

Answers:

• There is no difference

• Application contexts provide a generic way to load file resources, such as images.

• Application contexts provide a means for resolving text messages, including support for i18n of those messages.

• All of these

• Application contexts can publish events to beans that are registered as listeners.

42. Which of the following are Autowire types?

Answers:

• All of these

• byname, byType

• constructor

• autodetect

43. True or False? @RequestMapping can be used on an entire class as well as on individual methods.

Answers:

• True

• FALSE

44. Which of the following is a synonym for dependency injection?

Answers:

• inversion of control

• pointcut

• aspect-oriented programming

• templates

45. What are the most used classes in Spring DAO?

Answers:

• JdbcTemplate and SimpleJdbcTemplate.

• SimpleJdbcInsert and SimpleJdbcProcedure.

• SimpleJdbcInsert and SimpleJdbcStoredProc.

• SimpleJdbcQuery and SimpleJdbcExec.

46. In the following code:  <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">     <bean id="helloWorld" class="com.tutorialspoint.HelloWorld">        <property name="message" value="Hello World!"/>    </bean>  </beans>  The HelloWorld class should have a method called what?

Answers:

• setValue(String message)

• setProperty(String message)

• setMessage(String message)

• setName(String message)

47. Which of the following statements is correct about Spring MVC:

Answers:

• All of these

• The DispatcherServlet is the central servlet that receives requests and dispatches them to the appropriate controllers

• There can be more than one of DispatcherServlets in a Spring MVC application

• To enable Spring MVC, the DispatcherServlet needs to be configured in the web.xml

48. Which of the following is NOT a JDBC statement?

Answers:

• Interim Statement

• Regular Statement

• Prepared Statement

• Callable Statement

49. How could you inject using a factory method ?

Answers:

• Static factory method: specify "class" and "factory-method" attributes

• All of these

• Instance (non-static) factory method: specify "factory-bean" and "factory-method" attributes

• Use <constructor-arg> to pass parameters

50. Which is the most popular way of interfacing with Spring's JDBC support?

Answers:

• transactions

• SQLStatementPreparerer

• JDBCTemplate

• pointcuts

51. which one of the following is the correct sequence of how a normal view request is handled in a web application using Spring MVC: 1. Request: A request is submitted to the server. 2. Invokes: The dispatcher dispatches the request to the appropriate controller based on the HTTP request information and the web application configuration. 3. Service Call: The controller interacts with the service layer. 4. Response: The controller updates the model and, based on the execution result, returns the corresponding view to the user.

Answers:

• 1432

• 1234

• 1423

• 1324

52. What is the name of the central servlet which is part of Spring?

Answers:

• SpringServlet

• WebServlet

• IoCServlet

• DispatcherServlet

53. Which annotation lets you grab the value of an HTTP request header?

Answers:

• @RequestHeader

• @HttpHeader

• @Header

54. What's the relationship between Spring and Maven?

Answers:

• they are tightly integrated for easy of use

• not much; they can be used independently and one does not require the other

55. Which of the following concrete implementation, by default, handles the request 'first' when it is sent to a Spring MVC Framework?

Answers:

• FrameworkServlet

• HttpServlet

• GenericServlet

• DispatcherServlet

56. What is one of the major improvements in Spring 3?

Answers:

• more bean scopes are supported

• additional lifecycle methods were added

• more annotations are supported

57. Which one of the following annotation can be used to inject dependencies a) @Inject b) @Entity c) @Valid d) @Autowire

Answers:

• @Inject and @Autowire

• @Inject, and @Valid

• @Inject, @Valid, and @Autowire

• @Inject, @Valid, and @Entity

58. How do you load values from property files?

Answers:

• <%=parameter_name%>

• ${parameter_name}

• $(parameter_name)

• <%parameter_name%>

59. What does the @Valid as part of JSR-303 mean?

Answers:

• input will be validated using registered validators for that type

• uses Spring Security to validate security constraints

• sent to the database for constraint validation

60. Which one of the following statements is NOT true about MVC pattern?

Answers:

• View represents the data to the user in the desired format, supports interactions with users.

• The controller's main responsibility is to interact with the database like performing CRUD operations.

• Model represents the business data as well as the "state" of the application

• MVC stands for Model, View, and Controller

61. What is the default scope of a Spring bean?

Answers:

• Singleton

• None of these

• Abstract

• Session

• Prototype

62. Which of the following is BAD practice, in general?

Answers:

• continuous integration

• all beans are prototype scope

• minimizing inter-dependencies between beans

63. Which is an embedded database supported by Spring?

Answers:

• PostgreSQL

• Oracle

• HSQL

• MySQL

64. In Spring, singleton means only one instance per _____.

Answers:

• Context

• Entire jvm

65. What are the different types of bean injection?

Answers:

• By setter, By constructor

• By constructor, By builder

• By setter, By getter

• By setter, By constructor ,By builder

66. Which of the following best describes @Order annotation?

Answers:

• Guides autowiring to be performed by means other than by type

• Typically used to inject the properties of domain objects

• Defines ordering as an alternative to implementing the org. springframework.core.Ordered interface

• Specifies the scope of a bean

67. Which of the following is NOT a scope available in Spring web applications?

Answers:

• request

• session

• singleton

• instance

68. If a Spring bean implements BeanFactoryAware, which method is called with the bean instance?

Answers:

• setFactory()

• setBeanInstance()

• setBeanFactory()

• setInstance()

69. How does Spring handle XML marshalling/unmarshalling?

Answers:

• does not support marshalling/unmarshalling

• provides its own fast, easy XML marshaller/unmarshaller

• wraps a variety of libraries, including Jackson and JAXB

70. In Spring MVC, what is responsible for handling HTTP requests and responses?

Answers:

• DispatcherServlet

• SpringController

• HttpServlet

• RequestHandler

71. True or False? Spring supports joda-time.

Answers:

• True

• FALSE

72. True or False? Spring Integration is a part of the Spring framework you must use if you want to use beans.

Answers:

• Time's Up!

• False

• TRUE

73. Which of the following is an advantage of using Spring's transaction management?

Answers:

• it's faster

• you can customize the lifecycle

• can easily switch between JTA and regular transactions

• forces you to use Hibernate

74. Exceptions thrown by the Spring DAO classes are subclasses of which?

Answers:

• DataAccessException

• AccessException

• DataException

• DAOException

75. Which of the following correctly describes JobLauncher?

Answers:

• It provides parameters that are used by the JobInstance

• It helps in launching a job and uses JobRepository to obtain a valid JobExecution

• It stores JobInstances and JobExecutions

• It represents a running instance of a Job

76. Which of these is NOT a Spring annotation?

Answers:

• @Service

• @View

• @Aspect

• @Controller

• @Component

77. In "<property name="initialShapeSeed" value="#{ numberGuess.randomNumber }"/>", what is the name of the notation used to define the value of the property?

Answers:

• DAO

• JSF

• SpEL

• JSP

78. What is the @Valid annotation used for?

Answers:

• In tests to verify objects

• In mock objects

• Validating @Controller inputs

79. Imagine I have multiple classes that have similar properties; what's a good way of handling this situation without copy/pasting the bean definitions?

Answers:

• write a custom BeanResolver

• use AOP

• use bean inheritance

• write some code

80. How do you refer to a collection in a Spring bean definition?

Answers:

• None of these

• <list> <ref bean="one" /> </list>

• <list> <reference bean="one" /> </list>

• <lists> <ref bean="one" /> </lists>

81. Spring's JdbcTemplate is central class to interact with a database through JDBC. How can it be created?

Answers:

• JdbcTemplate template = new JdbcTemplate();

• JdbcTemplate template = new JdbcTemplate(myDataSource);

• JdbcTemplate template = new JdbcTemplate(myDatabase);

• JdbcTemplate template = new JdbcTemplate(myConnection);

82. Which of the following is NOT a method of using transactions in Spring?

Answers:

• declaratively

• proxies

• programmaticly

83. Spring's caching support does what?

Answers:

• abstracts a variety of different caching implementations

• provides its own caching implementation

• is not thread-safe

84. Which of these is NOT a Spring Bean Scope?

Answers:

• response

• request

• prototype

• singleton

• session

85. Which of the following annotations can be used to declare a bean in Spring?

Answers:

• @Component and @Controller

• @Component

• @Component, @Controller, and @Service

• @Componet, @Controller, @Service, and @Repository

86. DispatcherServlet class follows which design pattern?

Answers:

• Template

• Factory

• Abstract factory

• Singleton

• FrontController

87. What does the ${...} placeholder usually signify?

Answers:

• value is a HTTP parameter

• Java system property

• property is read from a configuration file

88. Which of the following is NOT an Autowire type?

Answers:

• byName

• byselector

• autodetect

• Constructor

• byType

89. Which if the most common scope for DAO beans?

Answers:

• prototype

• session

• request

• singleton

90. Which of the of the following is not a wiring mode supported by Spring?

Answers:

• by type

• by property

• by name

• by constructor

91. What does 'wiring' the beans do?

Answers:

• Uses beans from an XML file.

• Sends parameters to constructor of bean.

• Sends list parameters.

• Creates a referral to other beans.

92. Which of the following is NOT a valid spring bean scope?

Answers:

• prototype

• singleton

• localSession

• globalSession

93. Which of the following statements BEST describes Spring Bean Factory?

Answers:

• Spring Bean Factory creates association between collaborating objects as they are instantiated but does NOT publish events to beans that are registered as listeners

• Spring Bean Factory creates association between collaborating objects as they are instantiated and publish events to beans that are registered as listeners

• Spring Bean Factory provides a means for resolving text messages, including support for i18n of those messages, provide generic way to load file resources

• Spring Bean Factory does NOT create association between collaborating objects as they are instantiated and does NOT publish events to beans that are registered as listeners

94. To enable MVC Java config, @EnableWebMvc should be used with which of following annotation?

Answers:

• @Resource

• @Configuration

• @Componet

• @Controller

95. What is JdbcTemplate used for?

Answers:

• configuring JDBC

• configuring the connection pool using defaults

• executing SQL statements against the database

96. Which of the following is an INVALID @RequestMapping declaration?

Answers:

• @RequestMapping(method = RequestMethod.POST)

• @RequestMapping(method = RequestMethod.GET)

• @RequestMapping(request = RequestMethod.GET)

• @RequestMapping(value = { "/" }, headers = "Accept=text/html")

97. How can you instantiate BeanFactory?

Answers:

• Using FileSystemXmlApplicationContext.

• Using XmlFileApplicationContext.

• Using FileSystemXmlApplicationContext or ClassPathXmlApplicationContext.

• Using ClassPathXmlApplicationContext.

98. True or false? Spring's DAO classes translate SQL exceptions into general Spring exceptions

Answers:

• True

• FALSE

• sometimes True

99. Which one of the following is not TRUE about Spring MVC and Ajax

Answers:

• In a Ajax call, a XMLHttpRequest is prepared and submitted to the server.

• In order for view to be updated properly.The format of the data has to be in JSON

• @ResponseBody annotation instruct spring to serialize the returned object to a specific format.

• The controller handles the request and the response data will be formatted and sent to browser.

100. What is the @PersistenceContext annotation used for?

Answers:

• injecting a JPA entity manager

• Hibernate configuration

• injecting a Spring application context used by the ORM framework

101. Which one of the following is NOT true about Global Transactions?

Answers:

• In Java JTA is the only way to implement global transaction.

• Global transactions are transactions that span multiple backend resources.

• In Java, JTA is the standard for implementing global transactions

• One of global transaction characteristics is to maintain atomicity, which means either all or none of the involved resources are updated.

102. Which one of the following statements is NOT true about Validation API?

Answers:

• In Spring MVC web application context configuration <tx:annotation-driven/> will configure Spring to automatically enable the JSR-303 Bean Validation in Spring.

• In Spring MVC web controller, you can annotate the argument in a method with the @Valid annotation.

• JSR-303 is a JEE standard and is broadly supported by many frontend/backend frameworks

• JSR-303 provides a standard validation API that hides the underlying provider

103. If a Spring bean implements BeanNameAware, which method is called with the bean id?

Answers:

• setBean()

• setBeanName()

• setName()

• setId()

104. Which of the following is NOT a way that weaving can be used?

Answers:

• runtime

• class-load time

• compile-time

• web service

105. Which one of the following statements is NOT true?

Answers:

• @ModelAttribute can be used on method parameters in a controller

• @Value annotation can be used on a class

• @ModelAttribute can be used on methods in a controller

• @Value annotation can be used on a field

106. Which one of the following statements is NOT true about transactions?

Answers:

• Transaction management, as a kind of crosscutting concern, can be modularized with the AOP approach.

• Programmatic transaction management is achieved by embedding transaction management code in your business methods to control the commit and rollback of transactions.

• Declarative transaction management is achieved by separating transaction management code from your business methods via declarations.

• When managing transactions declaratively, you have to include transaction management code in each transactional operation

107. Which Spring MVC annotation is NOT valid for use in a method?

Answers:

• @RequestParameter

• @RequestMapping

• @RequestParam

• @ResponseBody

108. Which of the following is NOT true about Spring Web Services?

Answers:

• Provides flexible XML Marshalling

• Supports integration with Acegi Security

• Spring-WS require Spring 2.x or higher

• Supports WS-Security

109. Which of the following is NOT a valid spring Application Context implementation?

Answers:

• ClassPathXmlApplicationContext

• FileSystemXmlApplicationContext

• XmlWebApplicationContext

• ConfigurableApplicationContext

110. Which is NOT a valid form of Advice in AOP?

Answers:

• After throwing advice

• Before advice

• Before throwing advice

• After returning advice

• After (finally) advice

111. What will happen if you annotate a setter method with @Required without wiring a bean?

Answers:

• An exception is launched

• The required bean is set to null

• Spring will create the bean for you

• Nothing happens

112. Which one of the following statements is true:

Answers:

• The default value for the method attribute of @RequestMapping is POST

• @RequestParam annotation helps assigning the request parameter value to the method parameter.

• @RequestMapping can only be used on method

• @Conroller annotation can be used on both class and method

113. Which of these is NOT a valid implementation of ApplicationContext?

Answers:

• FileSystemXmlApplicationContext

• ClassPathXmlApplicationContext

• BeanFactoryApplicationContext

• WebXmlApplicationContext

114. What is the primary use of Inversion of control?

Answers:

• All of above

• For better memory management

• For additional security

• For loose coupling

115. Which of the following is NOT a valid advice?

Answers:

• After returning advice

• Before advice

• Before throwing advice

• After throwing advice

116. Which is NOT a valid way of injecting a Collection in Spring?

Answers:

• <map>

• <set>

• <list>

• <collection>

• <props>

117. Which of the following Design Patterns is the common solution for the duplicated form submission problem in Spring MVC?

Answers:

• Proxy Pattern

• Factory Pattern

• Post/Redirect/Get

• Singleton Pattern

118. Which of the following is the right way to pass part of URL(user) as input to the request handler method?

Answers:

• @RequestMapping("display/{user}") public String removeMember(@PathVariable("user") String user) {}

• @RequestMapping("display/{user}") public String removeMember(@RequestParam("user") String user) {}

• @RequestMapping(value ="display/user") public String removeMember(@PathVariable("user") String user) {}

119. Which of the following correctly describes TestContextManager of Spring TestContext Framework?

Answers:

• TestContextManager is the main entry point into the Spring TestContext Framework and is responsible for managing a single TestContext but NOT for signaling events to all registered TestExecutionListeners

• TestContextManager is NOT the main entry point into the Spring TestContext Framework, but is responsible for managing a single TestContext and signaling events to all registered TestExecutionListeners

• TestContextManager is the main entry point into the Spring TestContext Framework, which is responsible for managing a single TestContext and signaling events to all registered TestExecutionListeners

• TestContextManager is the main entry point into the Spring TestContext Framework, but is NOT responsible EITHER for managing a single TestContext OR for signaling events to all registered TestExecutionListeners

120. Which of the following is a disadvantage of using interfaces for proxies?

Answers:

• it's slower

• generates classes at runtime

• proxy won't be called if one method calls another inside the proxy

• cannot use Hibernate

121. Which one of the following statements is NOT true about the following configuration in security.xml <http ...> ??? <form-login login-page="/login/form" login-processing-url="/login" username-parameter="username" password-parameter="password" authentication-failure-url="/login/form?error"/> </http>

Answers:

• The password-parameter specifies the HTTP parameters of password that Spring Security will use to authenticate the user.

• The username-parameter specifies the HTTP parameters of username that Spring Security will use to authenticate the user.

• The login-page attribute specifies where Spring Security will redirect the browser if a protected page is accessed and the user is not authenticated.

• The authentication-failure-url attribute specifies the page that Spring Security will redirect if Spring cannot find the login page.

122. Which of the following object hold the information of principal currently using the application?

Answers:

• SecurityContextLoader

• UserDetailsService

• InMemoryDaoImpl

• SecurityContextHolder

123. Which of the following statements is NOT true about the @Autowired annotation?

Answers:

• @Autowired annotation can be applied on more than one constructor method in the same class

• @Autowired annotation can be applied on more than one properties in the same class

• @Autowired annotation was enabled with the <context:annotation-config> element

• @Autowired annotation can be applied on more than one setter method in the same class

124. What are benefits of  transactions for Hibernate?

Answers:

• None of these

• There are no transactions in Hibernate

• Transactions uses less memory and improves performance

• Read only transactions prevent Hibernate from flushing session

125. What class is used to determine data binding errors, such as those during POST operations?

Answers:

• ParsingResult

• BindingErrors

• ParsingErrors

• BindingResult

126. Which one of the following statements is NOT true about the Application Context.

Answers:

• ApplicationContext is an interface and is an extension to BeanFactory interface.

• ApplicationContext provides dependency Injection services and AOP service, but NOT transaction services.

• When configuring Application Context, Spring supports defining beans either through XML file or annotations starting from Spring 2.5

• In a web container environment, Spring bootstraps ApplicatonContext via the ConextLoaderListner.

127. Which of the following is NOT a valid spring framework module?

Answers:

• Spring ORM

• Spring AOP

• Spring Bean Factory

• Spring context

128. How do you declare a destroy method in a Spring bean?

Answers:

• None of these

• Referencing as null

• We cannot destroy, JVM takes take of it

• Using the destroy method

129. A RowCallbackHandler has one method called?

Answers:

• processRowCallback(ResultSet)

• processRow(ResultSet)

• processCallback(ResultSet)

• handleRowCallback(ResultSet)

130. BeanFactory is a popular way to wire beans in Spring, which is a correct way of creating a BeanFactory?

Answers:

• BeanFactory factory = new BeanFactory(new FileInputStream(???beans.xml???));

• BeanFactory factory = new BeanFactory(???beans.xml???);

• BeanFactory factory = new XmlBeanFactory(new FileInputStream(???beans.xml???));

• BeanFactory factory = new XmlBeanFactory(???classpath:beans.xml???);

131. Which of the following is NOT true about Spring transaction management?

Answers:

• The Spring Framework support propagation of transaction contexts across remote calls

• The Spring Framework offers declarative rollback rules

• The Spring Framework gives you an opportunity to customize transactional behavior, using AOP

• The Spring Framework provide a simpler API for programmatic transaction management than a number of complex transaction APIs such as JTA

132. Which one of the following statements is NOT true about @Transactional attributes

Answers:

• the default value of readOnly attribute is true

• If not specified the default value of propagation attribute is Propagation.REQUIRED

• The timeout attribute defines the number in seconds for transaction time out.

• The rollbackFor attribute defines which exception class will cause the transaction to roll back

133. Which one of the following statements is NOT true about the following code: @Service("jpaStudentService") @Repository @Transactional public class StudentServiceImpl implements StudentService {         private Log log = LogFactory.getLog(StudentServiceImpl.class);         @PersistenceContext         private EntityManager em;         // Other code omitted }

Answers:

• @PersistenceContext is a Spring annotation which instructs Spring to inject a SessionFactory

• @Service is to identify that this class is a spring component providing business services.

• @Repository instructs Spring to translate the vendor-specific exceptions to Springs's DataAccessException hierachy.

• @Transactional annotations describes transaction attributes of the class.

134. What is the purpose of the SessionStatus.setComplete()?

Answers:

• Gets the the value of the "complete" attribute of the session.

• Sets the attribute the session as "complete".

• Submits the form input from the user.

• Expires the session Data of a controller.

135. Which of the following is NOT a way to use Spring Web MVC's asynchronous request processing?

Answers:

• Return a Callable from the @RequestMapping method

• Inject a TaskExecutor and pass it to the Session

• Return a DeferredResult from the @RequestMapping method

136. Which of the following utility classes provides functionality to set a non-public field or invoke a non-public setter method when testing application code?

Answers:

• TestExecutionListeners

• SpringJUnit4ClassRunner

• ReflectionTestUtils

• TestContextManager

137. How can we create a PreparedStatementCreator?

Answers:

• createPreparedStatement(Datasource)

• createPreparedStatement(Database)

• createPreparedStatement(Connection)

• createPreparedStatement()

138. Which of the following is not a VALID mode of autowiring

Answers:

• byType

• byClass

• autodetect

• byName

139. Which one of the following statements is NOT true about Spring testing annotation?

Answers:

• @Repeat(5): This indicates that a test method has to run 5 times.

• @ExpectedException: This indicates that test method suppose to throw certain exception

• @IfProfileValue:specifies testing environment of the testing method. Only one environment can be specified

• @Timed: This indicates that a test method must complete in a specified time period

140. How do you specify outgoing HTTP content-type?

Answers:

• Use the 'produces' attribute of @RequestMapping

• Use the 'contentType' attribute of @RequestMapping

• Use the @ContentType annotation

141. How do you specify the incoming HTTP content-type?

Answers:

• Use the @ContentType annotation

• Use the 'contentType' attribute of @RequestMapping

• Use the 'consumes' attribute of @RequestMapping

142. Which of the following are valid approaches for integration Struts with Spring?

Answers:

• Extending Spring???s ActionSupport classes and getting applications spring-managed beans using getWebApplicationContext() method

• Any of the given approach can be used to integrate the two

• Using ContextLoaderPlugin, configuring spring app to manage actions as beans and then setting their dependencies in a spring context file

• Struts - Spring integration is not supported as of Spring 3.x

143. If you don't want a method to be enlisted in a transaction at all, what type of attribute can be used?

Answers:

• Both of them

• None of them

• @Transactional(propagation = Propagation.NEVER)

• @Transactional(readOnly = true)

144. What is the @BeforeTransaction annotation used for?

Answers:

• as part of testing, making sure some code is executed before the transaction is started

• as part of Spring OXM, what to serialize before the transaction is started

• as part of Spring AOP, defining what to execute before the transaction is started

145. In transactions and exception management, what is the default rollback policy?

Answers:

• Rollback for a CompiletimeException

• No Rollbacks possible

• Rollback can happen on any Exception

• Rollback for a RuntimeException

146. Which of the following methods are needed for loading a database driver in JDBC?

Answers:

• None of these

• Both registerDriver() method and Class.forName()

• registerDriver()

• Class.forName()

147. Which one of the following statements is NOT true?

Answers:

• <tx:annotation-driven> element is necessary to enable the usage of @Transactional annotations.

• The @Transactional annotation can be used on both class level and method level.

• When applying transactions semantics, either annotation or pure XML can be used.

• Defining Propagation.MANDATORY in @Transactional annotation means there must be a transaction otherwise create one.

148. Which of the following is incorrect?

Answers:

• BeanFactory supports just one config file whereas ApplicationContext can have multiple config files

• ApplicationContext does NOT publish events to beans that are registered as listeners whereas BeanFactory published events to registered beans

• BeanFactory does not support internationalization (I18N) messages whereas ApplicationContext includes support for I18N messages

• BeanFactory does not support enterprise services such JNDI access and EJB integration whereas ApplicationContext facilitates integration with enterprise services

149. Which of the following is FIRST step in user authentication process?

Answers:

• The UsernamePasswordAuthenticationToken is passed to an instance of AuthenticationManager for validation

• The AuthenticationManager returns a fully populated Authentication instance on successful authentication

• The security context is established by calling SecurityContextHolder.getContext().setAuthentication(...), passing in the returned authentication object

• The username and password are obtained and combined into an instance of UsernamePasswordAuthenticationToken

150. Which view technologies does Spring Web MVC NOT support out of the box?

Answers:

• Hibernate

• XSLT

• FreeMarker

• Velocity

151. Which one of the following statements is NOT true?

Answers:

• SingleConnectionDataSource maintains a single connection that is reused all the time and never closed.

• It's easy to switch data source implementations in Spring because they implement the common DataSource interface.

• The DriverManagerDataSource provided by Spring is a pooled datasource.

• DataSource that looked up by JNDI can be configured in Spring application by using <jee: jndi-lookup> element

152. Which one of the following statements is NOT true about Spring Web Flow states?

Answers:

• A subflow state starts a new flow within the context of a flow that is already underway.

• Action states are where the logic of a flow takes place.

• Decision states branch the flow in two directions, routing the flow based on the outcome of evaluation flow data.

• The End state is the last stop. Each flow can only have one end state.

153. Which of the following is a VALID Spring form taglib declaration?

Answers:

• <%@ taglib prefix="form" uri="http://www.springframework.com/tags/form" %>

• <%@ taglib prefix="form" uri="http://www.springframework.org/tags" %>

• <%@ taglib prefix="form" uri="http://www.springframework.org/form/tags" %>

• <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

154. Spring - WS Core is NOT dependent on which of the following modules?

Answers:

• Spring WS Security

• Spring ORM

• Spring XML

• Spring OXM

155. Which of the following identify the application-wide permissions available to a principal?

Answers:

• GrantedAuthority

• Authentication

• UserDetails

• UserDetailsService

156. Which of the following statements is NOT true when defining the <intercept-url> elements in security.xml?

Answers:

• The <intercept-ur> element won't work in the <http> elements that are marked as security = "none".

• When using expression based authorization the <http> elements need to be marked as use-expressions="true"

• The path attribute of the <intercept-url> element is independent and is not aware of the path attribute of the <http> element.

• When defining the <intercept-url> elements the sequence doesn't matter

157. Which of the following best describes Spring Batch?

Answers:

• Spring Batch does NOT provides classes and APIs for job processing statistics, job restart and partitioning techniques but does provide functionality for complex processes like skipping or retrying failed items

• Spring Batch provides classes and APIs for job processing statistics, job restart and partitioning techniques to process high-volume of data and read/write to resources but NOT for transaction management

• Spring Batch provides classes and APIs to read/write resources, transaction management, job processing statistics, job restart and partitioning techniques to process high-volume of data

• Spring Batch provides classes and APIs for job processing statistics, job restart and partitioning techniques to process high-volume of data but NOT for read/write resources and transaction management

158. Which one of the following is NOT true about HibernateDaoSupport Class

Answers:

• The common use is to extend this class and inject the SessionFactory dependency

• By extending HibernateDaoSupport class, you can simply call getHibernateTemplate() method to retrieve the template instance.

• HibernateDaoSupport class, has a commit() method which can commit the transaction

• HibernateDaoSupport class allows you to obtain Session and HibernateTemplate

159. Which of the following is a common cross-cutting concern?

Answers:

• configuration

• beans

• logging

• aspects

160. Which of the following best describes the utility of @RunWith(SpringJUnit4ClassRunner.class)?

Answers:

• This annotation is indicating the test where to get the context files containing the bean definitions

• This annotation will inject the SpringJUnit4ClassRunner bean in the test class

• This annotation will facilitate the test to get hold of the ApplicationContext

• This annotation means that tests are going to be able to get hold of instantiated beans as defined in the Spring context files

161. <concurrency-control> element can be used for which of the following purposes?

Answers:

• To enable LDAP authentication

• To limit number of user sessions

• To support authentication in clustered environment

• To support stateless authentication

• To support concurrent authentication

162. Which one of the following statements is NOT true?

Answers:

• DispatcherServlet could be responsible for all the request by mapping it to "/".

• <mvc:resources> element helps handling requests for static content for you.

• The DispatcherServlet???s job is to send the request on to a Spring MVC controller.

• DispatcherServlet can be configured either in web.xml file or through annotation

163. Which one of the following statements is true about the propagation attributes that can be defined in @Transactional annotations?

Answers:

• REQUIRED: If there???s a transaction, support it; otherwise throw exception

• REQUIRES_NEW: Create a new transaction. If there an active transaction exists, throw exception

• SUPPORTS: If there???s a transaction, it will be supported, if not create a new one

• MANDATORY: There must be a transaction; otherwise, throw an exception.

164. Which of the following is NOT an advantage of SimpleJdbcTemplate?

Answers:

• Uses JDBC API but eliminates lot of problems associated with it

• Supports operation on stored procedures and batch operations

• Supports Java 5 features (autoboxing, generics)

• Converts standard JDBC SQLExceptions into checked exceptions

165. Which one of the following is NOT true about the followng code: @Controller @RequestMapping("/reservationForm") @SessionAttributes("reservation") public class ReservationFormController {    ...    @RequestMapping(method = RequestMethod.POST)    public String submitForm(@ModelAttribute("reservation") Reservation reservation, BindingResult result) {       ...       return "redirect:reservationSuccess";    }    ... }

Answers:

• The redirect: prefix in the view name is used to avoid a problem known as duplicate form submission.

• The BindingResult object is used to map the user request to the controller method.

• The @ModelAttribute("reservation") is used to reference the Reservation object.

• The @SessionAttributes is used to save a Reservation object to a user???s session.

166. Which of the following scopes is valid ONLY in the context of a web-aware Spring ApplicationContext?

Answers:

• All of these

• global-session

• response

• singleton

• prototype

167. Which of the following is a valid usage of Method Injection in spring?

Answers:

• To inject a singleton bean inside a non-singleton bean

• To inject a singleton bean inside an prototype bean

• To inject a non-singleton bean inside a singleton bean

• To inject a larger scope bean in a smaller scope bean

• Injecting Spring Scoped Proxy Beans

168. Which of the following annotation enables default data conversion in Spring Web??MVC?

Answers:

• @InitBinder

• @RequestMapping

• @Controller

• @Valid

169. Which one of the following is NOT true about Spring MVC View resolver

Answers:

• TilesViewResolver: Looks up a view that is defined as a Tiles template. The name of the template is the same as the logical view name.

• BeanNameViewResolver: Finds an implementation of View that???s registered as a <bean> whose class is the same as the logical view name.

• InternalResourceViewResolver: Finds a view template. The path to the view template is derived by prefixing and suffixing the logical view name.

• ContentNegotiatingViewResolver: Delegates to one or more other view resolvers, the choice of which is based on the content type being requested.

170. Which of the following is the most commonly used view resolver for integrating JSPs with Spring?

Answers:

• InternalResourceViewResolver

• JstlView

• JSPResourceViewResolver

• Both InternalResourceViewResolver and ResourceBundleViewResolver

• ResourceBundleViewResolver

171. Which of the following implementation provides the mechanism for JSF and Spring integration?

Answers:

• ActionSupport

• DelegatingVariableResolver

• WebApplicationContext

• ApplicationContext

• FacesContext

172. Which of the following is a VALID way of implementing Programmatic Transactions in Spring

Answers:

• @Controller

• using TransactionInterceptor

• Using @Transactional annotation

• Using PlatformTransactionManager

173. Spring MVC annotation can be used to perform:

Answers:

• Validation

• Request mapping

• Request parameter binding

• Redirect URL

174. Which of the following is NOT a filter type in <context:component-scan> element?

Answers:

• bean

• annotation

• assignable

• aspectj

175. Are Spring singleton beans thread-safe?

Answers:

• Yes

• No

• Depends on how they are setup

176. True or False? @PathVariable is used on classes to indicate they will be used as handlers if a variable is found.

Answers:

• False

• TRUE

177. Which one of the following statements is NOT true about <mvc: annotation-driven>:

Answers:

• It enables Spring's support for JSR-303 Bean Validation.

• It enables the support of annotation configuration for Spring MVC controllers.

• It enables Spring 3 type conversion and formatting support.

• It enables the support of annotation configuration for transactions.

178. Which of the following development styles are supported by Spring WS?

Answers:

• Contract First but NOT Contract Last

• Supports Contract First, Contract Last and Web service contract (WSDL)

• Both Contract First and Contract Last

• Contract Last but NOT Contract First

179. Which one of the following statements is NOT true?

Answers:

• The @PersistenceContext annotation is used to tell Spring to inject a Hibernate Session factory instance

• The getCurrentSession() method of SessionFactory returns the session of current transaction

• If you choose to define your object-to-database mapping by annotation, you???ll need to configure LocalSessionFactoryBean in Spring

• One of the responsibilities of HibernateTemplate is to manage Hibernate One of the responsibilities of HibernateTemplate is to manage Hibernate Sessions.

180. A SQLProvider has one method called?

Answers:

• getSql()

• getProvider()

• getSqlProvider()

181. What is the @WebAppConfiguration annotation used for?

Answers:

• In combination with @ContextConfiguration, used to declare a test as a "web test"

• Used to configure a Spring web project instead of web.xml

• Enable view resolution in Spring Web MVC

182. Which the following statements is true about Spring validation?

Answers:

• Custom validation can be implemented through Spring's support of JSR-303, the Bean Validation API

• All of these

• When using annotation to valid domain object, only one validation annotation is allowed for each property

• @NotNull annotations indicates that the value should not be empty

183. In Spring and Hibernate integration, which is the correct implementation of the Session Factory?

Answers:

• SessionFactory

• LocalFactoryBean

• LocalSessionFactoryBean

• SessionFactoryBean

184. Which of the following is NOT a feature of Spring Security 3.x

Answers:

• Support for stateless authentication

• Support for CAS proxy tickets

• Support for limiting number of user sessions

• Support for multiple http elements

185. How can you find out about the current content when an aspect is invoked?

Answers:

• Through BeanFactory

• Through ApplicationContext

• Through PointCut

• Through Joinpoint

186. When are proxies generated in the Spring lifecycle?

Answers:

• None of These

• Does not happen in springs

• Bean Post Processing

• Bean Pre Processing

187. When detecting a Device device in a @Controller in Spring MVC, which of these is NOT supported?

Answers:

• device.isNormal()

• device.isDesktop()

• device.isTablet()

• device.isMobile()

188. Which one of the following statements is true about the following configuration in web.xml: <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class> org.springframework.web.filter.DelegatingFilterProxy </filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/myapplication/*</url-pattern> </filter-mapping>

Answers:

• It configures springSecurityFilterChain to intercepts all the requests.

• It doesn't matter if Spring Security to be declared as first <filter-mapping> element.

• The <filter-name> value for the DelegatingFilterProxy must be "springSecurityFilterChain".

• Spring Security will intercept forwards, includes, or errors.

189. Which of these is correct when creating an ApplicationContext?

Answers:

• ApplicationsContext ctx = new ClasspathXmlApplicationsContext("one.ctx","two.ctx");

• ApplicationContext ctx = new ClasspathXmlApplicationContext("one.ctx","two.ctx");

• ApplicationContext ctx = new ClasspathXmlApplicationContext("one.ctx???);

• None of these