90 likes | 93 Views
Passing CoreSpringV3.2 exam will enhance your skills in Core-Spring (based on Spring 3.2) area and can help you get the professional career you want. Candidates who successfully get through SpringSource CoreSpringV3.2 exam prepared wisely and chose a right preparation material.Killtest CoreSpringV3.2 practice exam assures 100% success with the most reliable PDF file and testing engine.Before getting your valid CoreSpringV3.2 exam questions, we suggest you read Free Demo CoreSpringV3.2 SpringSource Practice Exam V8.02 first.You will find that Killtest CoreSpringV3.2 practice exam questions are vaulable.
E N D
The safer , easier way to help you pass any IT exams. 1.Select which statement(s) is/are true with respect to programming to interfaces with Spring 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) Answer: A 2.How can a bean of type LegacySingleton be created (using XML configuration)? (select one) Consider the following class: public class LegacySingleton { private LegacySingleton(){} public static LegacySingleton getAServiceInstance() { return new LegacySingleton(); } } 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 Answer: B 3.Which of the following scenarios requires you to instantiate an ApplicationContext using the ‘new’ keyword? (Select one) 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 Answer: B 4.Select which statement is true with respect to constructor injection with Spring (select one) 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 Answer: A 5.Which of the following statements is true? (Select one) Consider the following complete configuration sample: <bean class="rewards.internal.RewardNetworkImpl"> <property name="accountRepository" ref="accountRepository"/> </bean> <bean class="rewards.internal.account.JdbcAccountRepository"/> A. This configuration is correct 2 / 8
The safer , easier way to help you pass any IT exams. 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) Answer: C 6.When injecting scalar/literal values into Spring beans, which of the following statements is true? (select one) 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 Answer: B 7.Which of the following statements about the FactoryBean interface is NOT true? (select one) 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 Answer: B 8.Consider the following code sample which creates an ApplicationContext from a file called "application-config.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:testinfra-config.xml"); Which of those statements is true? (select one) 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 Answer: A 9.Which of the following statements is NOT true with respect to Spring's ApplicationContext? (select one) 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 Answer: D 10.Select which of the following configuration tasks would be implemented using Spring's XML "context" 3 / 8
The safer , easier way to help you pass any IT exams. namespace (select one or several answers) 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 Answer: A,C 11.Which of the following statements about the BeanFactoryPostProcessor are true? (select one or several answers) 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 Answer: A,D 12.Identify which statement indicates potential advantages of using Spring's Dependency Injection (select one) 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 Answer: D 13.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) A. Use a PropertyEditor B. Use a PropertyPlaceholderConfigurer C. Use <util:constant ... /> D. Use a BeanPostProcessor Answer: B 14.Which of the following statements about the @PostConstruct annotation is NOT true? (select one) 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 Answer: D 15.Using Spring AOP, which of the following Spring annotations cause behavior to be added (select one) A. @Secured 4 / 8
The safer , easier way to help you pass any IT exams. B. @Transactional C. Both a and b D. Neither a or b Answer: C 16.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) 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 Answer: A 17.What is the primary purpose of bean definition inheritance? (Select one or several answers) 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 Answer: B 18.What is true regarding bean definition inheritance? 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 Answer: B,C 19.Which of the following statements is true regarding the above code sample? (Select one) <bean name="clientService" class="com.foo.ClientServiceImpl" p:name="myName"/> 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 Answer: C 20.Which of the following statements about the @Autowired annotation is NOT true? (select one) 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 Answer: D 5 / 8
The safer , easier way to help you pass any IT exams. 21.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) A. @Autowired public void setFoo(Foo aFoo) {} B. @Autowired private Foo foo; C. Both a and b D. Neither a or b Answer: C 22.Which of the following are valid mechanisms of autowiring a dependency when multiple beans match the dependency’s type? (Select one or several answers) 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 Answer: A,B 23.Which of the following statements is NOT true concerning Setter Injection or Constructor Injection? (Select one) 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 Answer: D 24.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) 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 Answer: C 25.Which of the following statements about use of the @Transactional annotation in a JUnit integration test is NOT true? (Select one) 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 Answer: C 26.Which of the following statements best describes the benefits of using the Spring Framework with respect to unit testing? (Select one) 6 / 8
The safer , easier way to help you pass any IT exams. 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 Answer: B 27.Which of the following statements about Spring and unit testing is true? (Select one) 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 Answer: D 28.Which of the following statements about Spring's JUnit integration testing support is true? (select one) 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 Answer: C 29.What is the id of the declared bean? (Select one) import com.springsource.service.*; ... @Configuration public class AppConfig { @Bean public ClientService clientService() { return new ClientServiceImpl(); } } A. clientService (starting with lower-case "c") B. ClientService (starting with capital "C") C. com.springsource.service.ClientService D. com.springsource.service.ClientServiceImpl Answer: A 30.The Spring Java configuration above is NOT correct. Why? (select one) public class AppConfig { public ClientService clientService() { 7 / 8
The safer , easier way to help you pass any IT exams. return new ClientServiceImpl(); } } 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) Answer: C 31.In the example above, which statement is NOT true with regards to Spring Java configuration? (select one) @Configuration public class AppConfig { @Bean public ClientService clientService() { ClientServiceImpl clientService = new ClientServiceImpl(); clientService.addClientDao(new ClientDao()); return clientService; } 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 Answer: C 32.Which statement is true with regards to the above example? (select one) ClientService service = applicationContext.getBean(ClientService.class) 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 Answer: B 8 / 8