Sunteți pe pagina 1din 6

1. Which DataSource matches the following description ?

Configures a plain old J DBC Driver via bean properties, and returns a new Connection every time. A. B. C. D. E. SingleConnectionDataSource AbstractDataSource SmartDataSource TransactionAwareDataSourceProxy DriverManagerDataSource basic support is provided by Spring's Data Access modules? handle boilerplate code. allow you to focus more on business. handle resources appropriately, such as database connections and transa mantain the datasource protected by bloc ing concurrent access. translate specific exceptions to a generic unchec ed exception hierarch B, C, A, D, E, C, D D B, C E, A A

A. B. C. D. E.

A, B, E, C, D,

3. Which Transaction Manager implementation would be most appropriate to use fol lowing scenario: Your Spring based application is to be deployed on JEE Applicat ion Server. A. B. C. D. JpaTransactionManager HibernateTransactionManager JtaTransactionManager DataSourceTransactionManager

4. "Select the correct statements regarding initializing bean instances A:- Each singleton bean is eagerly instanciated by default B:- Each bean is being instanciated lazy by default. C:- Beans are created in the right order with its dependencies injected D:- Beans are created in the same order they are defined in the xml file" A. B. C. D. A, B, C, C, B C D A

5. With local transactions, the application server is involved in transaction ma nagement and it can help ensure correctness across multiple resources. A. B. TRUE FALSE

6. Spring Framewor AOP implementation sugguests developers that "Always use the most powerful form of advice that meets your requirements" A. B. TRUE FALSE

7. PlatformTransactionManager is an interface but can be used programmatically.

2. "What A:- They B:- They C:- They ctions. D:- They E:- They y."

A. B.

TRUE FALSE

8. "Consider the following code snippet: Employee scotty = (Employee)bf.getBean(""scotty""); System.out.println(""scotty earns : "" + scotty.getSalary()); and bean configura tion: -<-alias name=""employee"" alias=""scotty"" />> -<-alias name=""employeeOfTheMonth"" alias=""scotty"" /> -<-bean id=""employee"" class=""Employee""> -<-property name=""salary"" value=""2""/> -<-/bean> -<-bean id=""employeeOfTheMonth"" class=""Employee""> - <-property name=""salary"" value=""20000""/> -<-/bean> Assuming that no compile errors exist and that bf refers to an instance of BeanF actory that loaded the provided configuration. The output of the program will be : 2 " A. B. TRUE FALSE

9. "The follwoing is true about Inversion of Control: A:- Inversion of Control occurs when a main program has all the conrol and indiv idual components are as ed to participate and execute when the main program deci des. B:- Inversion of Control occurs when a main program receives the components that will execute at runtime. C:- Inversion of Control occurs when a main program receives the components that will execute by configuration. D:- Dependency Injection is an Inversion of Control technique that occurs when a main program receives the components that will execute as parameters." A. B. C. D. A, B, C, D, B, C, D, A, C D, A A B

10. "Which of the following mechanisms can be used to register the new PropertyE ditor (own CustomEditor) in Spring container? A:- property customEditors of bean factory post-processor called CustomEditorCon figurer B:- implement a PropertyEditorRegistrar interface and set this implementation to CustomEditorConfigurer.propertyEditorRegistrars property C:- registerCustomEditor() method from the ApplicationContext D:- registerCustomEditor() method of the ConfigurableBeanFactory interface, assu ming you have a BeanFactory reference" A. B. C. D. A, B, C, D, B, C, D, A, C D A B

11. "a.xml -<-bean id=""beanA"" class=""beans.Inner"" /> b.xml -<-import resource=""a.xml"" /> -<-bean id=""beanB"" class=""beans.Outer""> -<-property name=""beanA"" ref=""bea nA"" /> -<-/bean> c.xml -<-import resource=""a.xml"" />

-<-bean id=""beanC"" class=""beans.Outer""> -<-property name=""beanA"" ref=""beanA"" /> -<-/bean> d.xml -<-import resource=""b.xml"" /> -<-import resource=""c.xml"" /> Bean factory is created from d.xml The question is, what is the default bean factory behavior if beanA iis defined twice? (Once through b.xml->a.xml and twice through c.xml->a.xml) " A. BeanDefinitionStoreException will be thrown B. RuntimeException will be thrown C. Bean factory will alter bean ids internally to eep them distinct and th en create two instances of class Inner D. Bean factory will use the latest found bean definition and will start no rmally E. Bean factory will not detect duplicated definition of beanA 12. "Chec the correct default values for the @Transactional annotation A:- PROPAGATION_REQUIRED B:- The isolation level defaults to the default level of the underlying transact ion system. C:- readOnly=""true"" D:- Only the Runtime Exceptions will trigger rollbac . E:- The transaction timeout defaults to the default timeout of the underlying tr ansaction system, or none if timeouts are not supported." A. B. C. D. E. A, B, E, C, D, B, C, A, D, E, C, D D B E, A A, B

13. . The Spring's JDBC exception hierarchy is composed of unchec ed exceptions. A. B. TRUE FALSE

14. "If we declare the following annotation (in its own file): @Service @Retention(RetentionPolicy.RUNTIME) public @interface MyAnnotation { } Then the following class: @MyAnnotation public class Foo { } will be a Spring bean if the appropriate context:component-scan element is added in the application context. " A. B. 15. A:B:C:A. TRUE FALSE "We can use @Autowired annotation with: methods constructors properties" A, B, C

B. C.

B, C A, C

16. What is default bean scope in spring? A. B. C. D. E. prototype session singleton request global

17. "Which statements are true aboutApplicationContextandBeanFactory A:- ApplicationContext includes all functionality of the BeanFactory B:- Both ApplicationContext, BeanFactory have convenient access to MessageSource C:- ApplicationContext loads beans eagerly, but BeanFactory lazily D:- Both ApplicationContext, BeanFactory have automatic registration to BeanPost Processor E:- Both ApplicationContext, BeanFactory are used for bean instantiation/wiring" A. B. C. D. E. 18. A:B:C:D:A. B. C. D. A, B, A, C, D, B, C, C, D, E, C D E E A

"Select which of the following implement the TransactionStatus interface AbstractTransactionStatus DefaultTransactionStatus SimpleTransactionStatus None of the above" A, B, C, D, B, C C D, A A

19. Which method is defined in interface RowCallbac Handler? A. B. C. D. 20. A:B:C:D:E:F:A. B. C. D. E. F. void void void void process(ResultSet rs) processResultSet(ResultSet rs) processRow(ResultSet rs) processResult(ResultSet rs)

"Which of the following classes are built-in Spring Events. ContextRefreshedEvent ContextClosedEvent ActionEvent ContextStoppedEvent ServletContextEvent ContextStartedEvent" A, B, E, A, D, A, B, C, A, B, E, B, C, D, E D, F F D, F A C

21. To access the methods defined in JdbcTemplate by using SimpleJdbcTemplate cl ass instance, which of the following method can be used. A. B. C. D. getJdbcTemplate() getJdbcOperations() getJdbcOperations(boolean useJdbcTemplate) None of the above

22. When Spring instantiates a map, it prefers JDK 1.4+ collection implementatio ns (Lin edHashMap) to Commons Collections 3.x versions (org.apache.commons.colle ctions.map.Lin edMap), falling bac to JDK 1.3 collections (standard HashMap) as worst case. A. B. TRUE FALSE two exception classes: MyBaseBusinessException and My extends from MyBaseBusinessException. If rollbac -for and no-rollbac -for="MySubBusinessException" are conf MySubBusinessException is thrown from transactional c

B. 'rollbac -for' is applied and transaction will be rollbac ed. C. Exception is thrown during application context initialization since conf iguration is ambiguous. D. None of the above 24. To register custom application event listener it is enough to write a class implementingApplicationListenerinterface and simply include that class in applicat ion context by usingelement (provided you're using an Application Context rather than a simple Bean Factory). A. B. TRUE FALSE

25. Which Transaction Manager implementation would you choose in following scena rio:You have a single datasource to deal with in your Spring Based application a nd you need transaction management. A. B. C. D. JpaTransactionManager HibernateTransactionManager JtaTransactionManager DataSourceTransactionManager

26. xxxAwaremethods of the bean are invo ed after the setter injection. A. B. 27. A:B:C:s a D:E:F:TRUE FALSE "The following is true about PlatformTransactionManager: It is an interface. It is a class. It has a method getTransaction(TransactionDefinition definition) that return TransactionStatus. It has a method commit(TransactionStatus status) that returns void. It has a method rollbac (TransactionStatus status) that returns void. All its methods throw TransactionException."

A.

'no-rollbac -for rule' is applied and transaction will not rollbac .

23. Imagine that there are SubBusinessException which ="MyBaseBusinessException" igured what happens when a ontext?

A. B. C. D. E. F.

A, B, E, C, D, D,

B, C, A, D, E, E,

C, D, F E A, B,

D E F, C F, C

28. "Consider the following valid declarations: -<-bean id=""bar"" class=""x.y.Bar""/> -<-bean id=""baz"" class=""x.y.Baz""/> -<-bean id=""foo"" class=""x.y.Foo""> -<-constructor-arg ref=""bar""/> -<-constructor-arg ref=""baz""/> -<-constructor-arg value=""example""/> -<-/bean> Which of the following declarations using c-namespace are valid? A:- -<-bean id=""foo"" class=""x.y.Foo"" c:bar=""bar"" c:baz=""baz"" c:email=""e xample@example.com"" /> B:- -<-bean id=""foo"" class=""x.y.Foo"" c:bar-ref=""bar"" c:baz-ref=""baz"" c:e mail=""example@example.com"" /> C:- -<-bean id=""foo"" class=""x.y.Foo"" c:_0-ref=""bar"" c:_1-ref=""baz"" c:_2= ""example@example.com"" />" A. B. C. A, B B, C A, C

29. Does JdbcTemplate has a delete operation in API to delete rows from a table? A. B. YES NO

30. "Spring eases the data access process by ma ing use of two distinct classes: templates and callbac s. Which of the following classes are not shipped with Sp ring? A:- JdbcTemplate B:- HibernateTemplate C:- JpaTemplate D:- OracleTemplate E:- NamedParameterJdbcTemplate F:- PLSqlTemplate" A. B. C. D. E. F. A, B, E, C, D, D, B, C, A, D E, F C, D D F A

S-ar putea să vă placă și