Spring certification

Description

Quiz on Spring certification, created by Juan Carlos Joya Carvajal on 20/05/2019.
Juan Carlos Joya Carvajal
Quiz by Juan Carlos Joya Carvajal, updated more than 1 year ago
Juan Carlos Joya Carvajal
Created by Juan Carlos Joya Carvajal almost 6 years ago
103
0
1 2 3 4 5 (0)

Resource summary

Question 1

Question
Select which statement(s) is/are true with respect to programming to interfaces with Spring
Answer
  • A. The use of interfaces allows for reduced coupling between collaborating objects
  • B. Spring requires all beans to implement interfaces
  • C. Spring requires that parameters in constructors and setters are defined using interface types
  • D. Spring requires all beans to have an empty constructor (either default or declared)

Question 2

Question
Consider the following class: public class LegacySingleton { private LegacySingleton(){} public static LegacySingleton getAServiceInstance() { return new LegacySingleton(); } } How can a bean of type LegacySingleton be created (using XML configuration)? (select one)
Answer
  • A. It is not possible, the constructor must be public
  • B. Use the factory-method attribute on the <bean> tag
  • C. Use the init-method attribute on the <bean> tag
  • D. Use autowiring

Question 3

Question
Which of the following scenarios requires you to instantiate an ApplicationContext using the `new' keyword? (Select one)
Answer
  • A. Running your Spring application inside a JUnit test (using SpringJUnit4ClassRunner)
  • B. Bootstrapping your Spring application within a Java main() method
  • C. Deploying your Spring application in an application server, packaged in a WAR file
  • D. Both a and b

Question 4

Question
Consider the following code sample which creates an ApplicationContext from a file called "applicationconfig.xml" in the "rewards.internal" package, and a file called test-infra-config.xml in the current folder: ApplicationContext context = new FileSystemXmlApplicationContext("classpath:rewards.internal.application-config.xml", "file:test- infraconfig.xml"); Which of those statements is true? (select one)
Answer
  • A. The use of the "file" prefix is not necessary
  • B. The use of the "classpath" prefix is not necessary
  • C. The use of the "." separator is correct
  • D. Both a and b

Question 5

Question
Which of the following statements is NOT true with respect to Spring's ApplicationContext? (select one)
Answer
  • A. The ApplicationContext eagerly instantiates all singleton beans by default
  • B. There are many different implementation classes which all implement the ApplicationContext interface
  • C. When available, the close() method will cause any registered bean destruction code to be invoked
  • D. In a JUnit test using Spring support (with @ContextConfiguration annotation), it is necessary to close the ApplicationContext manually

Question 6

Question
Select which of the following configuration tasks would be implemented using Spring's XML "context" namespace (select one or several answers)
Answer
  • A. Enabling component-scanning
  • B. Enabling the use of the @Transactional annotation
  • C. Enabling the use of the @Required, @PreDestroy and @PostConstruct annotations
  • D. Enabling the use of the @Around annotation

Question 7

Question
Which of the following statements about the BeanFactoryPostProcessor are true? (select one or several answers)
Answer
  • A. Allows for the transformation of Spring bean definitions before the beans are instantiated
  • B. Allows for the transformation of Spring beans after the beans have been instantiated
  • C. Detects annotations such as @PostConstruct and @PreDestroy and then invokes appropriate behavior
  • D. The <context:property-placeholder /> tag causes a BeanFactoryPostProcessor to be created

Question 8

Question
Identify which statement indicates potential advantages of using Spring's Dependency Injection (select one)
Answer
  • A. Dependencies between application components can be managed external to the components themselves
  • B. Configuration can be externalized and centralized in a small set of files
  • C. Integration testing is made easier because different components used for testing can easily be injected
  • D. All of the above

Question 9

Question
You want to externalize constants from your Spring XML configuration file into a .properties file to your Spring beans. Which mechanism could you use? (select one)
Answer
  • A. Use a PropertyEditor
  • B. Use a PropertyPlaceholderConfigurer
  • C. Use <util:constant ... />
  • D. Use a BeanPostProcessor

Question 10

Question
Which of the following statements about the @PostConstruct annotation is NOT true? (select one)
Answer
  • A. It is a JSR-250 standard Java annotation
  • B. There are no restrictions on method name or visibility of a method which can be annotated with @PostConstruct
  • C. It can be enabled using the <context:annotation-config /> tag
  • D. It is called before setter injection

Question 11

Question
Using Spring AOP, which of the following Spring annotations cause behavior to be added (select one)
Answer
  • A. @Secured
  • B. @Transactional
  • C. Both a and b
  • D. Neither a or b

Question 12

Question
Two beans of type MyBean are defined in the ApplicationContext with singleton scope, with ids "myBean1" and "myBean2". The getBean() method is called once for each bean. Which statement is true about the two references returned? (Select one)
Answer
  • A. The two references refer to different instances of the same type
  • B. Both references refer to the same bean instance
  • C. One of the references will be null
  • D. A RuntimeException will be thrown when the ApplicationContext is initialized

Question 13

Question
Which of the following statements is NOT true concerning Setter Injection or Constructor Injection? (Select one)
Answer
  • A. Constructor injection is useful when you must have an instance of a dependency class before your component is used
  • B. Setter injection is useful if a component can provide its own defaults
  • C. Using the @Autowired annotation, setter injection also works when the setter method is private
  • D. Using setters promotes immutability

Question 14

Question
If you annotate one of your classes with @Component, which of the following should you do to have Spring automatically detect your class and load it as a bean? (Select one or several answers)
Answer
  • A. Ensure that you specify a valid bean name in the @Component annotation
  • B. Ensure that you specify a valid @Scope for the bean
  • C. Ensure that you have added <context:component scan> in the XML configuration
  • D. Ensure that <context: annotation-config/> is specified in the XML configuration

Question 15

Question
Which of the following statements about use of the @Transactional annotation in a JUnit integration test is NOT true? (Select one)
Answer
  • A. Annotating a test with @Transactional will cause the test method to run in a transaction
  • B. Annotating a test class with @Transactional will cause all its test methods to run in transactions
  • C. Application code that runs in a transaction with REQUIRES_NEW propagation can have those changes rolled back by an @Transactional test

Question 16

Question
Which of the following statements best describes the benefits of using the Spring Framework with respect to unit testing? (Select one)
Answer
  • A. Your Java code typically has dependencies on Spring Framework classes which are designed to make the job of unit testing easier
  • B. The Spring Framework encourages you to program to interfaces which makes it easier to stub or mock out dependencies in your code
  • C. The extensive runtime checks performed by the ApplicationContext when it initializes make traditional unit testing less important
  • D. All of the above

Question 17

Question
Which of the following statements about Spring and unit testing is true? (Select one)
Answer
  • A. Spring provides an internal mock framework so there is no need for a third-party mock framework such as Mockito or EasyMock
  • B. Spring provides an abstraction to existing Mock frameworks
  • C. Both a and b
  • D. Neither a or b

Question 18

Question
Which of the following statements about Spring's JUnit integration testing support is true? (select one)
Answer
  • A. A new ApplicationContext is initialized and created for each test method
  • B. To obtain references to the Spring bean(s) you want to test, you need to call getBean() on the ApplicationContext provided
  • C. You can indicate which XML configuration files the test class will use to create the ApplicationContext
  • D. All of the above

Question 19

Question
import com.springsource.service.*; ... @Configuration public class AppConfig { @Bean public ClientService clientService() { return new ClientServiceImpl(); } } What is the id of the declared bean? (Select one)
Answer
  • A. clientService (starting with lower-case "c")
  • B. ClientService (starting with capital "C")
  • C. com.springsource.service.ClientService
  • D. com.springsource.service.ClientServiceImpl

Question 20

Question
public class AppConfig { public ClientService clientService() { return new ClientServiceImpl(); } } The Spring Java configuration above is NOT correct. Why? (select one)
Answer
  • A. The class should be annotated with @Configuration
  • B. The method should be annotated with @Bean
  • C. Both (a) and (b)
  • D. Neither (a) or (b)

Question 21

Question
@Configuration public class AppConfig { @Bean public ClientService clientService() { ClientServiceImpl clientService = new ClientServiceImpl(); clientService.addClientDao(new ClientDao()); return clientService; } In the example above, which statement is NOT true with regards to Spring Java configuration? (select one)
Answer
  • A. The declared bean is a singleton by default
  • B. This bean might be wrapped by a proxy
  • C. This bean cannot use a method starting with "add" to inject a dependency
  • D. The bean is of type ClientService

Question 22

Question
ClientService service = applicationContext.getBean(ClientService.class) Which statement is true with regards to the above example? (select one)
Answer
  • A. It returns the bean called "ClientService"
  • B. It returns a bean of the type ClientService (regardless of its id or name)
  • C. This syntax is not valid because the bean id must be specified as a method param
  • D. This syntax is not valid because the result of the getBean method should be explicitely cast into ClientService

Question 23

Question
Identify the correct statement about the following pointcut expression. Assume that these 2 classes do not inherit from one another: Execution (* rewards.service.MyClass.*(..)) && execution(* rewards.service2.MyOtherClass.*(..)) (Select one)
Answer
  • A. Executions of all public method calls in MyClass and MyOtherClass will be selected by this pointcut
  • B. Public methods in MyClass and MyOtherClass which take zero arguments will not be selected by this pointcut
  • C. Public methods in MyClass and MyOtherClass which take more than one argument will not be selected by this pointcut
  • D. This pointcut will never select any join points

Question 24

Question
Which of the following statements is NOT true concerning the BeanPostProcessor Extension point? (Select one)
Answer
  • A. BeanPostProcessors are called during the init phase
  • B. BeanPostProcessors are called after the dependencies have been injected
  • C. BeanPostProcessors are called before the BeanFactoryPostProcessors have been called
  • D. Custom BeanPostProcessors can be implemented

Question 25

Question
Identify the correct statement(s) about the following pointcut expression: execution(* rewards.restaurant.*Service.find(..))
Answer
  • A. The target's type should end with "Service"
  • B. The target method name could be "findRestaurantById"
  • C. The target method should have one argument only
  • D. The target method may have several arguments

Question 26

Question
Identify the correct statement(s) about the following pointcut expression: execution(* rewards..restaurant.*.*(*)) (select one or several answers)
Answer
  • A. There may be several directories between 'rewards' and 'restaurant'
  • B. There is no restriction on the class name
  • C. The target method may have several arguments
  • D. The return type must not be "void"

Question 27

Question
Identify the correct statement about the following pointcut expression: execution(@javax.annotation.security.RolesAllowed * rewards.restaurant.*.*(..)) (Select one)
Answer
  • A. The return type of the target method is RolesAllowed
  • B. All method parameters should be annotated with @RolesAllowed
  • C. The target method may have one argument
  • D. All of the above

Question 28

Question
Which of the following statements defines a "pointcut"? (select one)
Answer
  • A. A point in the execution of a program such as a method call or field assignment
  • B. A module that encapsulates advices
  • C. An expression that selects one or more join points
  • D. None of the above

Question 29

Question
Which of the following statements defines an "aspect"? (select one)
Answer
  • A. An encapsulation of advice combined with a pointcut.
  • B. A point in the execution of a program such as a method call or field assignment
  • C. An expression that selects one or more join points
  • D. Code to be executed at a join point that has been selected by a Pointcut

Question 30

Question
Identify the correct statement(s) regarding the following pointcut: execution(@com.springsource.MyCustomAnnotation void *(..))
Answer
  • A. Spring does not support annotations inside its pointcut expression language
  • B. This will select join points representing void methods that are annotated by @com.springsource.MyCustomAnnotation
  • C. This will select join points representing methods that may have a public, protected or default visibility
  • D. This pointcut will in no situation ever be able to select any join points

Question 31

Question
Identify the correct statement(s) regarding the <aop:aspectj-autoproxy /> tag (Select one or multiple answers)
Answer
  • A. Can only be used with AspectJ (as opposed to Spring AOP)
  • B. Enables the detection of @Aspect annotated classes
  • C. Allows to define a list of names to include so Spring is not going to scan all the beans at startup

Question 32

Question
Consider the following bean definition <bean id="clientService" class="com.springsource.service.ClientServiceImpl" /> Using Spring AOP, you have declared a Pointcut targeting all methods inside the clientService bean. ClientServiceImpl implements 3 different interfaces. Which interfaces will the proxy class implement? (Select one)
Answer
  • A. All interfaces
  • B. The proxy class does not implement any interface
  • C. A Spring bean should never implement any interface

Question 33

Question
Which statement concerning Aspect Oriented Programming (AOP) is true (Select one)
Answer
  • A. AOP modularizes cross-cutting concerns
  • B. Spring AOP implements aspects using the Proxy pattern
  • C. Three of the advice types are "before", "after" and "around"
  • D. All of the above

Question 34

Question
Which of the following statements is NOT true about Spring AOP? (Select one)
Answer
  • A. "private" methods cannot be advised, but all other method visibilities can be
  • B. Proxy classes are created at startup time by default
  • C. The "After Throwing" advice type executes after the join point, but executes only if the advised method threw an exception
  • D. The "After" advice type is invoked regardless of whether a method successfully returned or an exception is thrown

Question 35

Question
To register for a bean destruction callback, one can (Select one)
Answer
  • A. Decorate the destroy method with @PreDestroy
  • B. Decorate the destroy method with @PreDestroy and add a <context:annotation-config /> xml declaration
  • C. Set the bean instance in a "prototype" scope
  • D. Set the lazy-init attribute within the <bean> tag

Question 36

Question
Which of the following statements best describes the After Returning advice type? (select one)
Answer
  • A. After Returning advice allows behavior to be added after a method either returns successfully or throws an exception
  • B. Custom processing can be performed before a join point executes
  • C. The advice has complete control over the method invocation
  • D. The advice is invoked only if the method returns successfully

Question 37

Question
Which of the following statements best describes the After Throwing advice type? (select one)
Answer
  • A. The advice is executed after a method invocation throws an exception
  • B. Custom processing can be performed before a join point executes
  • C. The advice is invoked only if the method returns successfully
  • D. The advice is designed to allow exceptions thrown from a join point to be caught and prevented from propagating up the stack

Question 38

Question
Which statement best describes the advantage of using AfterReturning advice, rather than simply using after advice? (Select one)
Answer
  • A. If an exception is thrown in the join point, it is allowed to propagate, which is not the case with After advice
  • B. AfterReturning advice is invoked if an exception is thrown, which is not the case with After advice
  • C. After advice can only be applied to methods which are declared as void
  • D. AfterReturning advice is only invoked if the method returns successfully, allowing you to limit advice to only those scenarios

Question 39

Question
Which of the following statements about Pointcut expressions is true? (Select one)
Answer
  • A. A Pointcut can be defined either within annotations in Java code or within XML configuration
  • B. A pointcut expression can include operators such as the following: && (and),|| (or), ! (not)
  • C. A Pointcut expression can be used to select join points which have been annotated with a specific annotation
  • D. All of the above is true

Question 40

Question
Which of the following statements is NOT true about advice types and exception handling? (select one)
Answer
  • A. If a Before advice method throws an exception, the target method will not be called
  • B. An Around advice type can swallow, or halt the propagation of, an exception thrown by the target method.
  • C. An AfterReturning advice type can swallow, or halt the propagation of, an exception thrown by the target method.

Question 41

Question
Which of the following statements is NOT true about advice types (select one)
Answer
  • A. The Before advice method is able to obtain information about the target method's return type
  • B. The After advice method is able to obtain information about the target method's return type
  • C. The Before advice method is able to obtain the target method's return value
  • D. The After advice method is able to obtain the target method's return value

Question 42

Question
Which of these is NOT a characteristic of Spring JDBC? (Select one)
Answer
  • A. Can be configured exclusively using annotations
  • B. Provides a callback approach when greater developer control is needed
  • C. Connections are acquired and released from the DataSource automatically
  • D. Translation of root cause checked exceptions to Spring DataAccessExceptions

Question 43

Question
Which of the following statements is NOT a characteristic of Spring Transaction Management? (Select one)
Answer
  • A. It abstracts the differences between local and JTA transactions
  • B. It simplifies migration to distributed transactions
  • C. The use of JTA transactions is a requirement
  • D. Both declarative and programmatic transaction management is supported

Question 44

Question
Which statement is NOT a characteristic of Spring's PlatformTransactionManager base interface (select one)
Answer
  • A. When declaring a PlatformTransactionManager implementation inside Spring configuration: as a requirement, the bean id should be "transactionManager"
  • B. The PlatformTransactionManager interface abstracts the differences between local and JTA transactions
  • C. There are various implementations of JTA transaction managers for different Java EE containers
  • D. PlatformTransactionManager is used in both declarative and programmatic transaction management

Question 45

Question
Which of the following statement(s) is/are true concerning Spring Transactions? (Select one or several answers)
Answer
  • A. Spring only provides support for declarative transaction management, there is no programmatic support
  • B. Spring provides declarative transactions only using XML
  • C. An AOP pointcut can be used to define which methods to advise for transactions
  • D. Spring's tx namespace enables a concise definition of transactional advice

Question 46

Question
Which of the following is a valid optional attribute for a transaction definition? (select one)
Answer
  • A. Propagation behavior
  • B. An isolation level
  • C. A read-only flag
  • D. All of the above

Question 47

Question
If the propagation behavior is Propagation.REQUIRED, choose the statement which describes the propagation behavior (select one)
Answer
  • A. Executes in a transaction if one already exists. If there is no transaction, it executes without a transaction context.
  • B. Executes in a transaction if one already exists. Throws an exception if there is no active transaction.
  • C. Executes in a nested transaction if an active transaction exists. If there is no transaction, it starts a new one.
  • D. Executes in a transaction if one already exists. If there is no transaction, it starts a new one.

Question 48

Question
If the propagation behavior is Propagation.REQUIRES_NEW, choose the statement which describes the propagation behavior (select one)
Answer
  • A. Runs in a nested transaction if an active transaction exists. If an active transaction does not exist, the transaction behaves as if Propagation.REQUIRED is set
  • B. Supports a transaction if one already exists. Throws an exception if an active transaction does notexist.
  • C. Always starts a new transaction. If an active transaction already exists, it is suspended
  • D. Always executes without a transaction even if an active transaction exists. Throws an exeception if anactive transaction exists.

Question 49

Question
Which of the following is the correct mechanism for using programmatic transactions in Spring? (Select one)
Answer
  • A. Use of the @Transactional annotation on each method which should be transactional
  • B. Use of the @Transactional annotation on the Class of methods which should all be transactional
  • C. Configuration in an XML configuration file using the Spring "tx" namespace
  • D. Use of the Spring TransactionTemplate

Question 50

Question
public class ClientServiceImpl implements ClientService { @Transactional (propagation=Propagation.REQUIRED) public void update1() { update2(); } @Transactional(propagation=Propagation.REQUIRES_NEW) public void update2() { // ... } } You are using transactions with Spring AOP. What is happening when the update1 method is called? (Select one)
Answer
  • A. There is only one transaction because the call to update2() is internal (it does not go through the proxy)
  • B. There is only one transaction because REQUIRES_NEW runs into the active transaction if one already exists
  • C. There are 2 transactions because REQUIRES_NEW always runs in a new transaction

Question 51

Question
Consider that all Spring beans have been declared within a package called "com.springsource.service". To enable component scanning one must do the following:
Answer
  • A. Nothing (component scanning is enabled by default)
  • B. Add <context:annotation-config/> to your XML configuration
  • C. Add <context:component-scan base-package="com.springsource.service"/> to your XML configuration
  • D. Remove all other bean definitions from the XML configuration

Question 52

Question
Using declarative transaction management, by default a transaction rolls back if:
Answer
  • A. Any uncaught exception that inherits from Exception has been thrown
  • B. Any uncaught exception that inherits from RuntimeException has been thrown
  • C. Any uncaught Throwable that inherits from Throwable has been thrown
  • D. Null is being returned by a non-void method

Question 53

Question
@Transactional(timeout=60) public class ClientServiceImpl implements ClientService { @Transactional(timeout=30) public void update1() {} } What timeout setting is applied to the timeout inside the update1 method? (Select one)
Answer
  • A. 60
  • B. 30
  • C. This will not compile. Attributes such as timeout, propagation and isolation cannot be declared at the class leve
  • D. This will not compile. Attributes such as timeout, propagation and isolation cannot be declared at the method level

Question 54

Question
@Transactional public class ClientServiceImpl implements ClientService { //... } Using Spring AOP, you have declared @Transactional at the class level. It applies to:
Answer
  • A. All methods within the ClientServiceImpl class
  • B. All public methods within the ClientServiceImpl class
  • C. All methods within the class that have been declared by the ClientService interface
  • D. This will not compile. @Transactional cannot be declared at the class level

Question 55

Question
Which of the following statements about the Spring DispatcherServlet is NOT true? (select one)
Answer
  • A. It is an abstract Servlet class which much be subclassed to provide mapping and business logic
  • B. It delegates to Web intrastructure beans such as ViewResolvers and Controllers
  • C. It is a "front controller" which coordinates all HTTP request handling activities for Spring MVC
  • D. It is defined in web.xml just like any other servlet

Question 56

Question
Which of the following statements about Spring @MVC is NOT true (select one)
Answer
  • A. Classes annotated with @Controller annotation can be detected by component scanning and loaded as Spring beans
  • B. Data can be passed from the controller to the view by use of the special Model parameter
  • C. Controllers are typically able to delegate to business methods in an application because a reference to a service bean can be injected into the controller
  • D. The DispatcherServlet, controller beans and other collaborators are all defined and configured in web.xml

Question 57

Question
Which is the correct statement regarding the relationship between a DispatcherServlet ApplicationContext and a root ApplicationContext (select one)
Answer
  • A. The root ApplicationContext can reference beans in the DispatcherServlet Application context, but not vice-versa
  • B. The DispatcherServlet ApplicationContext can reference beans in the root Application context, but not vice-versa
  • C. The DispatcherServlet ApplicationContext and the root ApplicationContext can reference each other's beans
  • D. The DispatcherServlet ApplicationContext and root ApplicationContext are completely isolated and cannot reference each other's beans

Question 58

Question
Which of the following is NOT true about @Controller-annotated classes? (Select one)
Answer
  • A. They are eligible for handling requests in Spring MVC.
  • B. They must implement a special interface.
  • C. They can be discovered via component scanning.
  • D. They can be configured as Spring beans via XML configuration.

Question 59

Question
Which of the following is NOT a characteristic of Spring Remoting? (Select one)
Answer
  • A. It has its own proprietary naming directory service that remote services are published to
  • B. It supports multiple protocols and multiple forms of object serialization
  • C. It uses polymorphism on the client so that client code can be agnostic to whether it is using a remote service or local object
  • D. Spring beans can be published as remote services by simply adding configuration

Question 60

Question
Which of the following statements is true concerning Spring's HttpInvoker remoting protocol? (select one)
Answer
  • A. HttpInvoker requires a web server to be running on the server
  • B. HttpInvoker is a synchronous remoting mechanism
  • C. The client invokes remote methods on the server using an HTTP POST
  • D. All of the above

Question 61

Question
Which of the following statements comparing traditional RMI with Spring RMI is NOT true? (select one)
Answer
  • A. Traditional RMI requires the client to catch RemoteExceptions, but Spring's approach does not
  • B. Traditional RMI requires implementing java.rmi.Remote, but Spring's approach does not
  • C. Both approaches require you to extend the UnicastRemoteObject class on the server side
  • D. Both approaches require method parameters and return values to implement java.io.Serializable

Question 62

Question
Security filters are used in Spring Security in which ways? (select one)
Answer
  • A. To drive authentication
  • B. To enforce authorization of web requests
  • C. To provide a logout capability
  • D. All of the above

Question 63

Question
Which of the following strategies is correct for configuring Spring Security to intercept particular URLs? (Select one)
Answer
  • A. The URLs are specified in the XML configuration using the <intercpt-url> tag, with the most specific match first and the least specific last
  • B. The URLs are specified in the XML configuration, with the least specific match first and the most specific last
  • C. The URLs are specified in a special properties file, used by Spring Security
  • D. The URLs can only be specified in web.xml as part of the Servlet mapping

Question 64

Question
Which of the following statements is NOT a characteristic of Spring Security? (select one)
Answer
  • A. It provides a strict implementation of the Java EE Security specification
  • B. Authentication data can be accessed using a variety of different mechanisms, including databases and properties files
  • C. Security can be configured at the method level
  • D. Tag libraries are provided for displaying security context information in JSP pages

Question 65

Question
What is the principal purpose of Spring's Security tag library? (Select one)
Answer
  • A. To provide a mechanism for applying security to Spring Web Services
  • B. To allow certain URLs to be tagged as requiring secure access
  • C. To provide functionality in JSP pages, such as hiding certain sections based on roles
  • D. To allow Spring Security to be applied to XHTML

Question 66

Question
Which of the following statements is true concerning configuring JMS Resources with Spring? (Select one)
Answer
  • A. Spring cannot use a standalone JMS provider
  • B. Spring can use the JMS resources provided by an application server
  • C. The ConnectionFactory cannot be standalone
  • D. The ConnectionFactory cannot be retrieved from JNDI

Question 67

Question
Which of the following statement is true concerning Spring's JmsTemplate (select one)
Answer
  • A. The JmsTemplate manages resources transparently (e.g. Connections, default Queue...)
  • B. The JmsTemplate converts checked JMSExceptions to runtime equivalents
  • C. The JmsTemplate provides convenience methods and callbacks
  • D. All of the above

Question 68

Question
Which of the following methods is NOT provided by the JmsTemplate? (select one)
Answer
  • A. setDefaultDestination
  • B. onMessage (asynchronous call)
  • C. convertAndSend
  • D. receiveAndConvert (synchronous call)

Question 69

Question
Consider the following Spring JMS configuration <jms:listener-container connection-factory="connectionFactory"> <jms:listener destination="order.queue" ref="orderListener" method="order"/> </jms:listener-container> Which of the following statements is truE. (select one)
Answer
  • A. Spring will automatically receive messages from the order.queue.destination
  • B. The orderListener bean has to implement javax.jms.MessageListener or Spring's SessionAwareMessageListener interface
  • C. The application needs to run in an application server that provides a JMS implementation out of the box
  • D. Spring will automatically send a response message

Question 70

Question
Select which statement is true with respect to constructor injection with Spring (select one)
Answer
  • A. Multiple parameters can be dependency injected into a constructor
  • B. Using XML configuration, the constructor-arg element may be omitted if the constructor requires a single parameter
  • C. One single bean cannot mix constructor injection with setter injection
  • D. All of the above

Question 71

Question
Consider the following complete configuration sample: <bean class="rewards.internal.RewardNetworkImpl"> <property name="accountRepository" ref="accountRepository"/> </bean> <bean class="rewards.internal.account.JdbcAccountRepository"/> Which of the following statements is true? (Select one)
Answer
  • A. This configuration is correct
  • B. This configuration is not valid because the first bean should have an id. Its value should be "rewardNetwork".
  • C. This configuration is not valid because the second bean should have an id. Its value should be "accountRepository"
  • D. Both (b) and (c)

Question 72

Question
When injecting scalar/literal values into Spring beans, which of the following statements is true? (select one)
Answer
  • A. Scalar values cannot be injected into setters or constructors with primitive type parameters
  • B. Spring performs automatic type conversion for certain data types, such as String to int
  • C. In XML Spring configuration, you can inject scalar values using the ref attribute of the <property /> tag
  • D. All of the above

Question 73

Question
Which of the following statements about the FactoryBean interface is NOT true? (select one)
Answer
  • A. A FactoryBean can be used to generate Spring beans of any type
  • B. The Spring configuration <property name="someValue" ref="myFactoryBeanImpl"/> will ALWAYS inject the instance of the FactoryBean implementation
  • C. FactoryBean is a Spring interface
  • D. Factory objects used in Spring do not necessarily have to implement the FactoryBean interface

Question 74

Question
Method level security can be configured using which of the following mechanisms? (select one)
Answer
  • A. Using the @Secured annotation on methods to be secured
  • B. Using the @RolesAllowed annotation on methods to be secured
  • C. Configuring using a pointcut expression in Spring XML configuration file
  • D. All of the above

Question 75

Question
In what order will these events occur during the initialization of the application? (Select one) Select the best response 1 Setter Dependency Injection 2 Bean constructor 3 call BeanFactoryPostProcessors 4 call BeanPostProcessors
Answer
  • A. 3, 2, 1, 4
  • B. 4, 2, 1, 3
  • C. 2, 1, 4, 3
  • D. 3, 1, 2, 4

Question 76

Question
Consider the following Spring Security configuration <security:http> <security:intercept-url pattern="/accounts/*" access="ROLE_USER" /> <security:intercept-url pattern="/ accounts/editAccount.htm" access="ROLE_ADMIN" /> </<security:http> In order to access to "/accounts/editAccount.htm", what role is required? (select one)
Answer
  • A. ROLE_USER
  • B. ROLE_ADMIN
  • C. Both ROLE_USER and ROLE_ADMIN
  • D. No role is required

Question 77

Question
Select which of the following is a mechanism which can be used with Spring Security to store user details (select one)
Answer
  • A. Database
  • B. LDAP
  • C. Properties file
  • D. All of the above

Question 78

Question
What is the principal purpose of Spring's Security XML namespace? (Select one)
Answer
  • A. To provide a mechanism for applying security to Spring Web Services
  • B. To provide a schema for configuring Spring Security in a Spring XML configuration file
  • C. To provide a mechanism for encrypting Spring Security XML configuration files
  • D. To allow Spring Security to be applied to XHTML

Question 79

Question
Which of the following data access technologies does Spring support? (Select one)
Answer
  • A. JDBC
  • B. JPA
  • C. JBoss Hibernate
  • D. All of the above

Question 80

Question
Choose the statement that does NOT apply to Spring's JdbcTemplate (select one)
Answer
  • A. All JdbcTemplate methods throw SQLExceptions which you are required to handle
  • B. The JdbcTemplate provides methods for query execution
  • C. The JdbcTemplate provides the ability to work with result sets
  • D. The JdbcTemplate does not write or generate SQL statements for you

Question 81

Question
State which operation is not performed by the JdbcTemplate (select one)
Answer
  • A. Acquisition of the connection
  • B. Definition of the DataSource
  • C. Execution of the statement
  • D. Release of the connection

Question 82

Question
Spring puts each bean instance in a scope. The default scope is (select one)
Answer
  • A. singleton except when using Java Configuration
  • B. singleton (no matter which Dependency Injection style has been used)
  • C. prototype
  • D. request

Question 83

Question
State which type of object the JdbcTemplate can be used to query (select one)
Answer
  • A. Simple types (int, long, String, etc)
  • B. Generic Maps
  • C. Domain Objects
  • D. All of the above

Question 84

Question
Which of the following statements is true with respect to Spring's support for Object-Relational Mapping (ORM) libraries (select one)
Answer
  • A. Spring supports management of Hibernate Sessions or JPA PersistenceContexts in combination with local transactions
  • B. Spring provides support for translating exceptions thrown from ORM libraries into Spring's own exception hierarchy
  • C. Spring provides FactoryBeans to configure each of the supported ORM libraries
  • D. All of the above is true

Question 85

Question
Which of the following is NOT true about the @RequestMapping annotation? (select one)
Answer
  • A. It is an annotation for mapping web requests to controller methods.
  • B. It is commonly used for component scanning purpose.
  • C. You can use it only with @Controller annotated classes.

Question 86

Question
Assuming a web application context name of "rewardsonline", a servlet mapping of "/admin/*", and an incoming URL of "/rewarsdonline/admin/accounts/show", what is the URL used for Spring MVC requestmapping purposes? (select one)
Answer
  • A. /rewardsonline/admin/accounts/show
  • B. /admin/acounts/show
  • C. /accounts/show
  • D. /show

Question 87

Question
Which of the following statements is NOT true concerning Spring Remoting? (Select one)
Answer
  • A. Spring exporters handle the binding to a registry or exposing an endpoint
  • B. Spring provides FactoryBeans that generate proxies to handle client-side requirements
  • C. The client-side implementation must catch RemoteExceptions
  • D. Spring proxies convert RemoteExceptions to a runtime exception hierarchy

Question 88

Question
Which is the correct way to declare that a spring-enabled JUnit 4 integration test should rollback transactions upon completion? (Select one)
Answer
  • A. The test should create a TransactionManager instance
  • B. Test case must extend AbstractTransactionalSpringContextTests
  • C. Annotate the method or the class with @Transactional
  • D. Method name must begin with test

Question 89

Question
Which of the following protocols is NOT supported by Spring Remoting? (select one)
Answer
  • A. RMI
  • B. CORBA
  • C. HttpInvoker

Question 90

Question
Spring's RMI Service Exporter provides which of the following services? (select one)
Answer
  • A. Transparently exposes an existing POJO service to the RMI registry
  • B. Avoids the service interface having to extend Remote
  • C. Exposes services that can be accessed via plain RMI
  • D. All of the above

Question 91

Question
Which statement is NOT true concerning Spring's RMI Proxy Generator (select one)
Answer
  • A. Spring provides a FactoryBean implementation that generates the RMI client-side proxy
  • B. The client-side proxy converts checked RemoteExceptions into Spring's runtime hierarchy of RemoteAccessExceptions
  • C. The proxy does not have to dynamically implement the interface of the remote service implementation
  • D. The client-side proxy contains all necessary information to connect to the remote service, such as the RMI Registry URL

Question 92

Question
What is the primary purpose of bean definition inheritance? (Select one or several answers)
Answer
  • A. To configure Java class inheritance dynamically within the XML bean definition file
  • B. To reduce the amount of configuration required by inheriting properties from other bean definitions
  • C. To allow Spring beans to be created on the fly from classes declared as abstract
  • D. To simplify configuration by allowing multiple properties files to be loaded in a hierarchy to specify bean properties

Question 93

Question
What is true regarding bean definition inheritance?
Answer
  • A. Parent bean definitions should always be abstract
  • B. Parent bean definitions may be abstract
  • C. The class attribute can be declared in a parent bean definition
  • D. It is not useful to declare an id for a parent bean definition

Question 94

Question
<bean name="clientService" class="com.foo.ClientServiceImpl" p:name="myName"/> Which of the following statements is true regarding the above code sample? (Select one)
Answer
  • A. This syntax requires the declaration of the "p" namespace
  • B. myName is a scalar value (as opposed to a reference to an existing bean)
  • C. Both a and b
  • D. Neither a or b

Question 95

Question
Which of the following statements about the @Autowired annotation is NOT true? (select one)
Answer
  • A. The default behavior is that if a dependency cannot be satisfied with @Autowired, the ApplicationContext will throw a RuntimeException
  • B. @Autowired is a Spring-specific annotation
  • C. Multiple arguments can be injected into a single method using @Autowired
  • D. It cannot be used to annotate fields, only constructors and methods

Question 96

Question
Given an ApplicationContext containing multiple bean definitions of a Java type "Foo", which of the following @Autowired scenarios will cause the ApplicationContext to FAIL to initialize? Assume that the ApplicationContext is configured to process the @Autowired annotations. (Select one)
Answer
  • A. @Autowired public void setFoo(Foo aFoo) {}
  • B. @Autowired private Foo foo;
  • C. Both a and b
  • D. Neither a or b

Question 97

Question
Which of the following are valid mechanisms of autowiring a dependency when multiple beans match the dependency's type? (Select one or several answers)
Answer
  • A. Use of the @Qualifier and @Autowired annotations together on a field
  • B. Use of the @Qualifier and @Autowired annotations together with setter methods
  • C. Use of the @Qualifier annotation solely
Show full summary Hide full summary

0 comments

There are no comments, be the first and leave one below:

Similar

The Paschal Mystery In Your Life
sr.carmentherese
0654 Coordinated Sciences Effects of Forces Quiz
Jeffrey Piggott
AQA AS Physics Unit 2 - Spring Constant and Hookes Law Questions
MattB98
Study Guide Exam #2 (TB) - Terrestrial Biomes - Lab (Biomes)
Qu U
Chapter 1 question pool quiz - FOC
Snack Pack
integration structs spring
Saul Ricardo Med
BA 211 Week 1 Vocab
jshin13
spring
Linda Denker