104328185 Spring

download 104328185 Spring

of 8

Transcript of 104328185 Spring

  • 8/10/2019 104328185 Spring

    1/8

    1. Which DataSource matches the following description ? Configures a plain old JDBC 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 transamantain 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 following 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:- Eachsingleton 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 thexml file" A. B. C. D. A, B, C, C, B C D A

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

    6. Spring Framewor AOP implementation sugguests developers that "Always use themost 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."

  • 8/10/2019 104328185 Spring

    2/8

  • 8/10/2019 104328185 Spring

    3/8

    - - - d.xml - - Bean factory is created from d.xml The question is, what is the defaultbean factory behavior if beanA iis defined twice? (Once through b.xml->a.xml andtwice through c.xml->a.xml) " A. BeanDefinitionStoreException will be thrown B.RuntimeException will be thrown C. Bean factory will alter bean ids internallyto 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 transaction 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 constru

    ctors properties" A, B, C

  • 8/10/2019 104328185 Spring

    4/8

    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 theabove" 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. ContextRefreshedEven

    t 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

  • 8/10/2019 104328185 Spring

    5/8

    21. To access the methods defined in JdbcTemplate by using SimpleJdbcTemplate class 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 implementations (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 isthrown 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 anApplication Context rather than a simple Bean Factory). A. B. TRUE FALSE

    25. Which Transaction Manager implementation would you choose in following scenario:You have a single datasource to deal with in your Spring Based applicationa 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?

  • 8/10/2019 104328185 Spring

    6/8

  • 8/10/2019 104328185 Spring

    7/8

    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: - - - - - - - Which of the following declarations usingc-namespace are valid? A:- - B:- - C:- -" 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 Spring? A:- JdbcTemplate B:- HibernateTemplate C:- JpaTemplate D:- OracleTemplateE:- 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

  • 8/10/2019 104328185 Spring

    8/8