Spring MCQ
Spring MCQ
Chapter -2
1. If we use Maven for Spring’s applications, where we can add dependencies?
a) pom.xml
b) Web.xml
c) Context.xml
d) Config.xml
Ans. A
2. Which is a byte code manipulation framework?
a) Aop
b) asm
c) Jdbc
d) Jsm
Ans. B
3. Which module is needed for every Spring application?
a) Bean
b) Jdbc
c) core
d) Orm
Ans. C
4. If you are using EJB 2.1 or prior versions, then you must use –Style of IOC?
a) Lookup style
b) Injection Style
c) None
Ans. A
5. Which one has zero Impact on your component code?
a. Injection
b. Lookup
c. both
Ans. A
6. Each Bean can be assigned either an -----
a) ID or a name or both
b) ID or property
c) ID or method
Ans. A
7. Which Interface reads XML files?
a. XmlBeanDefinitionReader
b. Serializable
c. BeanDefinitionRegistry
Ans. A
8. Which version of jdk and Spring support java annotation?
a. Jdk 4 and spring 1.0
b. Jdk 5 and spring 2.5
c. Jdk 2 and spring 2.0
Ans. B
9. You use Maven for application development, you can simply add the dependencies for Spring into the
project’s pom.xml (project object model) file, and Maven will download _________ for you.
a) XML
b) JDBC
c) JAR files
d) Maven
Ans. c
10. The full distribution of Spring including a _______ set of dependencies.
a) integration
b) voluminous
c) transaction
d) manipulation
Ans. b
11. Which is ASM (asm.ow2.org) a Java ByteCode framework?
a) MVC framework
b) Struts web framework
c) Spring framework
d) Manipulation framework
Ans. d
12. This module extends Spring’s standard JDBC feature set with support for popular ORM tools including
_______.
a) iBATIS
b) JDO
c) JPA
d) All of them
Ans. d
13. Which does this module include all classes for integration between? (two choose)
a) Manipulation framework
b) Spring framework
c) MVC framework
d) Struts web framework
Ans. b, d
14. Which is Maven a powerful application management tool?
a) building
b) packaging
c) dependency
d) all of them
Ans. d
15. Which is each Maven artifact identified by? (two choose)
a) artifact ID
b) dependency management
c) packaging
d) packaging type
Ans. a, d
16. Which is the naming conversion of a Spring EBR different from?
a) Maven repository
b) Maven artifact
c) Maven Central
Ans. c
17. Most of the classes here support Spring’s __________ implementation.
a) manipulating
b) bean factory
c) MVC
d) AOP
Ans. b
18. These modules provide support for OXM (object to XML mapping). Classes for abstraction of XML marshaling
and unmarshaling and support for popular tools like________.
a) JAXB
b) XMLBeans
c) XStream
d) All of them
Ans. D
CHAPTER 3
1. Which provides security controls that prevent unauthorized users from creating and editing blog entries?
a) BasicBlog application
b) SpringBlog application
c) Spring-based application
d) None
Answer: B
2. Users with the user role(ROLE_USER) assigned can perform (choose all that apply)
a) Post a blog entry or comment on an existing entry
b) Edit a blog entry or comment they have created
c) None
Answer: A, B
3. Users with the admin role(ROLE_ADMIN) assigned can perform
a) view audit data
b) perform user maintenance
c) all of the above
Answer: C
4. Who allows users to express their opinions about particular entries by posting comments?
a) BasicBlog
b) SpringBlog
c) Spring_based
d) all of the above
Answer: B
5. What is the most appropriate tool for developing Spring-based application (choose all that apply)
a) Eclipse IDE
b) Spring IDE
c) Maven plugin
d) Mylyn
e) all of the above
Answer: E
6. How Spring supports the configuration management?
a) via XML files
b) via Java annotations
c) above all
d) None
Answer: C
7. Which layer is the core layer within the application and all business logic will be implemented in this layer?
a) persistence layer
b) service layer
c) presentation layer
d) security layer
Answer: B
8. Which are Spring supports?
a) JDBC
b) Hibernate
c) MyBatis(iBATIS)
d) JDO
e) JPA
f) above all
Answer: F
9. Spring AOP supports (choose all that apply)
a) Spring native AOP framework
b) integration with the aspect AOP framework
c) None
Answer: A, B
10. In the data access layer, developers will implement data access objects to separate the data access logic from
the business logic
a) true
b) false
Answer: A
Chapter 4
1. Bean Factory is
a) An Interface
b) an Object
c) a Class
d) None
ans. A
2. ApplicationContext is
a) Interface
b) Object
c) Class
d) None
ans. A
3. ApplicationContext is an extension of
a) ActionServlet
b) Action
c) BeanFactory
d)None
Ans. C
4. There are two ways we can configure the ApplicationContext in Spring. Which are
a) XML based
b) Annotation based
c) jdbc based
d) SpEL Based
Ans. A, B
5. Some service provided by BeanFactory are:
a) Inheritance
b) life-cycle
c) autowiring
d) None
Ans. a, b, c
6. A component that requires certain dependencies is often referred to as the
a) ActionServlet
b) Dependent object
c) Independent object
d) None
Ans. B
7. IOC can be decomposed into two subtypes are
a) Dependency Injection
b) Dependency Lookup
c) Bean factory
d) None
ans. A, B
8. Dependency Lookup is
a) Traditional approach
b) Newer approach
c) Both
ans. A
9. Dependency Injection is
a) Traditional approach
b) Newer approach
c) Both
Ans. B
10. Dependencies are injected into the component by the
a) Servlet container
b) java container
c) IOC container
Ans. C
11. Dependency Lookup are two types
a) Dependency Pull
b) Contextualized Dependency Lookup (CDL)
c) Bean factory
d) None
ans. A, B
12. Dependency Injection are two types
a) Constructor Dependency Injection
b) Setter Dependency Injection
c) Both twos
Ans. C
13. Dependencies are pulled from a registry as required in
a) Dependency Pull
b) Setter Dependency Injection
c) Constructor Dependency Injection
Ans. A
14. Lookup-based solutions are more complex than injection-based ones
a) True
b) False
Ans. A
15. Passive code is not much simpler to maintain than active code
a) True
b) False
Ans. B
16. Setter Injection is that it allows dependencies to be declared on an interface
a) True
b) False
Ans. A
17. Configuration parameters are
a) Passive
b) Information
c) Components
d) Simple values
Ans. A, B, D
18. Transaction and AOP service, message source for internationalization (i18n) and application event handling
are the services of
a) ApplicationContext
b) BeanFactory
c) FactoryBean
d) ActionServlet
Ans. A
19. XML file configuration will override the annotation ones
a) True
b) False
Ans. A
20. Which namespace provides support for configuring Spring’s ApplicationContext
a) context
b) p
c) c
d) ActionServlet
Ans. A
21. Which namespace provides a simpler DI configuration for Setter Injection
a) e
b) p
c) c
Ans. B
22. Which namespace provides a simpler DI configuration for Constructor Injection
a) context
b) p
c) c
Ans. C
23. Which namespace provides some useful utilities for DI configuration
a) context
b) p
c) c
d) util
Ans. D
24. Multiple base-package can be defined by using
a) comma
b) Semicolon
c) Space
d) Underscore
Ans. A, B, C
25. By default, all beans in Spring are singletons
a) True
b) False
Ans. A
26. Dependency injection services that Spring offers, including
a) Setter Injection
b) Constructor Injection
c) Method Injection
d) Getter Injection
Ans. A, B, C
27. Spring’s ApplicationContext interface extends
a) BeanFactory
b) GenericApplicatinContext
c) GenericApplication
d) None
Ans. A
28. How many ways to configure Spring application context?
a) Three
b) Four
c) Two
d) Five
Ans. C
29. How many types of Dependency Lookup?
a) Three
b) Two
c) Four
d) Five
Ans. B
30. Dependency Pull is the most familiar type of
a) IOC
b) DI
c) Contextualized Dependency Lookup
d) None
Ans. A
31. public class DepInjection{
private Dependency dependency ;
public void setDependency(Dependency dependency ){
this.dependency = dependency ;
}
}
What type of the above code is?
a) Constructor Dependency Injection
b) Setter Dependency Injection
c) Method Dependency Injection
d) Getter Dependency Injection
Ans. B
32. Active code is much simpler and less error prone.
a) True
b) False
Ans. B
33. IOC Stands for
a) Inversion of Control
b) Inversion of Class
Ans. A
34. DI is specialized from
a) CDL
b) IOC
Ans. B
35. BeanFactory is a class
a) True
b) False
Ans: b
36. What is the role IOC container in Spring?
a) Create the instance
b) Configure the instance
c) Assemble the dependencies
d) None
Ans: a, b, c
37. Which is the more traditional approach
a) Dependency Injection
b) Dependency Lookup
Ans: b
38. Dependency Lookup are
a) Dependency Pull
b) Contextualized Dependency Lookup
c) None of above
Ans: a, b
39. DI stands for ...
a) Declaration interface
b) Dependency interceptor
c) Dependency Injection
Ans: c
40. CDL stands for...
a) Controller Dependency Lookup
b) Contextualized Dependency lookup
c) None
Ans: b
41. BeanDefinitionRegistry is an interface
a) True
b) False
Ans: a
42. IOC can be decomposed in which subtype
a. Dependency Injection.
b. Dependency certain.
c. Dependency Lookup.
d. Dependency pull
Ans. A, C
43. Which statement are correct
a. Dependency Lookup is newer.
b. Dependency Injection is newer.
c. Dependency Lookup is more familiar to java programmers.
d. Dependency Lookup is much traditional.
Ans. B, C, D
44. Function of dependency pull are
a. Establish relation between two dependencies.
b. Make Connection to Database.
c. Dependencies are pulled from a registry as required.
Ans. C
45. Dependency requirement exposed by the
a. setDependency ();
b. getDependency();
c. putDependency ()
d. dependency constructor ();
Ans. A
46. Passive code is much simpler to maintain than active code
a. True.
b. False.
Ans. A
47. The core of Spring’s implementation is based on
a. Lookup injection
b. Dependency injection
c. Dependency lookup.
d. Constructor injection
Ans. B
48. Bean can also have instantiated without any ID and name known as
a. BeanFactory.
b. Anonymous class.
c. Anonymous bean.
d. XmlBeanDefination.
Ans. C
49. Which statement are true about namespace
a. c: The context namespace provides support for configuring spring’s application context
b. P: The p namespace provides a simpler DI configuration for setter injection.
c. util: The util namespace provides some useful utilities for DI configuration for constructor Injection.
Ans. B, C
50. Spring is described as ………………. For building java application.
a) A lightweight framework
b) A standard framework
c) An explain framework
d) None
Ans: a
51. Inversion of control (IOC) represent –
a) Dependency lookup
b) Dependency injection
c) Traditional approach
d) Both a & b
Ans: d
52. Dependency injection has two common flavors, there are
a) Method Dependency injection
b) Constructor Dependency injection
c) Getter Dependency injection
d) Setter Dependency injection
Ans: b, d
53. For xml configuration you need to declared the required-
a) Namespace
b) Logical method
c) Dependency pull
Ans: a
54. What are the true for configure parameter?
a) Configure parameters are passive
b) Configuration parameters are usually information not other component.
c) Configure parameters are usually simple value.
d) All of above.
Ans: d
55. Advantage of Dependency injection
a) Makes the code loosely coupled, so easy to maintain
b) Makes the code easy to test
c) Both a & b
d) None
Ans: c
56. Advantage of Spring framework
a) Powerful abstraction
b) Lightweight
c) Easy to test
d) All of above
Ans: d
57. There are two types of IOC containers. They are
a) BeanFactory
b) ApplicationContext
c) BeanContext
d) ApplicationFactory
Ans: a, b
58. Which is the Artifact ID for spring aspects Module JAR File.
a) spring-aspects
b) spring-core
c) spring-asm
d) spring-aop
Ans: a
59. SpEL Means
a) Spring Expression Language
b) Spring Exception Language
c) Spring Export Language
d) None
Ans: a
60. Which tags are used in Annotation based configuration?
a) <context: annotation-config>
b) <context: component-scan base-package=”com.exam”>
c) A & B
d) None
Ans: c
61. Write down the way of Dependency LookUp?
a) Dependency Pull
b) Contextualized Dependency LookUp (CDL)
c) both.
d) None.
Ans. c
62. Write down the way of Dependency Injection?
a) Constructor Dependency Injection.
b) Setter Dependency Injection.
c) both.
d) None.
Ans. c
63. Spring Expression Language(SpEL) is the Fiture OF ____?
a) Spring 1
b) Spring 2
c) Spring 3
Ans. c
64. To configure Spring to Inject one bean to another we use ___ tag under the <Property> or <constractor-app>.
a) <ref>
b) <prob>
c) <entry>
Ans. a
65. By using <prob> tag We can pass value as ____?
a) List
b) String
c) Map
Ans. b
66. If we want to use Lookup Method injection in our application, we need a jar file called ______?
a) CGLIB JAR file.
b) Dpl jar file.
Ans. a
67. When you need to avoid to use method LookUp Injection in the beans?
a) In the same life cycle
b) If they are singleton
c) If they are non-singleton.
d) A & B
Ans. d
68. Every Bean must have a unique ______ With the application-context?
a) ID.
b) Name.
c) Class
d) Scope
Ans. b
69. By default, all beans in spring are ____?
a) Nonsingletons.
b) Singletons.
c) Prototype
d) session
Ans. b
70. Which of those bean scopes are supported by the version 3.1?
a) Singleton
b) Prototype
c) Request
d) Session
e) All of the avobe
Ans. e
71. Spring support how many modes of AutoWiring?
a) 2
b) 3
c) 4
d) 5
Ans. c
Note: byName, byType, constructor, default
Chapter 6
1. Which type of AOP is correct?
a. Static and non-static
b. Static and dynamic
c. Non-static and dynamic
Answer: b
2. By creating ________, you gain fine-grained control over how you apply advice to the components in your
application.
a. Pointcuts
b. Joinpoints
c. Aspects
d. Weaving
Answer: a
3. An aspect is the combination of advice and pointcuts.
A. True
B. False
Answer: a
4. Spring has two proxy implementations: the JDK dynamic proxy and the CGLIB proxy.
A. False
B. True
Answer: b
5. Spring supports _______ different flavors of advice.
A. Three
B. Four
C. Five
D. Six
Answer: d
6. Which of the following interface is related to “Around” advice in spring?
A. org.springframework.aop.MethodAround
B. org.aopalliance.intercept.MethodInterceptor
C. org.springframework.aop.AfterAdvice
Answer: b
7. When you are working with third-party or legacy code which of the following proxies you must use?
A. JDK dynamic proxies
B. CGLIB proxies
C. Both of the above
Answer: b
8. Chose the correct answer from the following options.
A. When a CGLIB proxy is first created, CGLIB asks Spring how it wants to handle each method.
B. The CGLIB proxy handles fixed advice chains differently than the JDK proxy.
a) Only A is correct
b) Only B is correct
c) Both A and B are correct
Answer: c
9. The CGLIB proxy can proxy both classes and interfaces, whereas the JDK proxy can proxy only interfaces.
A. True
B. False
Answer: a
10. When proxying a class, which is the default choice?
A. JDK dynamic proxies
B. CGLIB proxies
C. There is no default choice
Answer: b
Chapter 8
1. What's the meaning of CRUD?
A. Create, Read, Update, Destroy
B. Create, Run, Update, Destroy
C. Create, Read, Update, Delete
D. Create, Run, Update, Delete
Ans: C
2. JDBC Infrastructure is a driver that allows code to access the database.
A. True
B. False
Ans: A
3. When JDBC Infrastructure is loaded it registers itself with a _______ class.
A. java.sql.DriverController
B. java.sql.DriverManager
C. java.sql.jdbcInfrastructure
D. java.sql.jdbcDatabase
Ans: B
4. Which class manages a list of drivers and provides static methods for establishing connections to the
database?
A. java.sql.DriverController
B. java.sql.DriverManager
C. java.sql.jdbcInfrastructure
D. java.sql.jdbcDatabase
Ans: B
5. Which interface allows to run SQL statement against database?
A. java.sql.DriverConnection
B. java.sql.DriverManager
C. java.sql.Connection
D. java.sql.JdbcConnection
Ans: C
6. Which package contain the foundation of JDBC class?
A. org.springframework.jdbc.core
B. org.springframework.jdbc.datasource
C. org.springframework.jdbc.object
D. org.springframework.jdbc.support
E. org.springframework.jdbc.config
Ans: A
7. Which package contain helper classes and Datasource?
A. org.springframework.jdbc.core
B. org.springframework.jdbc.datasource
C. org.springframework.jdbc.object
D. org.springframework.jdbc.support
E. org.springframework.jdbc.config
Ans: B
8. Which package contain class that help to convert the data?
A. org.springframework.jdbc.core
B. org.springframework.jdbc.datasource
C. org.springframework.jdbc.object
D. org.springframework.jdbc.support
E. org.springframework.jdbc.config
Ans: C
9. Which is the most important class in org.springframework.jdbc.support package?
A. SQLError
B. SQLSyntaxError
C. SQLException
D. None
Ans: C
10. Which package contains classes that supports JDBC configuration within Spring's ApplicationContext?
A. org.springframework.jdbc.core
B. org.springframework.jdbc.datasource
C. org.springframework.jdbc.object
D. org.springframework.jdbc.support
E. org.springframework.jdbc.config
Ans: E
11. Embedded database is useful for what?
A. Local Development
B. Global Development
C. Unit Testing
D. A & B
E. A & C
F. B & C
Ans: E
12. In the Spring JDBC module, there is a class called JdbcDaoSupport. It wraps up the ________ class.
A. JdbcSupport
B. JdbcDao
c. JdbcTemplate
D. NOne
Ans: C
13. Spring RowMapper<T> interface provides a simple way to perform mapping from a JDBC resultset to POJOs.
A. True
B. False
Ans: A
14. Which interface is suitable for only row base mapping to a single domain object?
A. RowMapping<T>
B. RowMapper<T>
C. ResutlSetExtractor
D. None of the above
Ans: B
15. Which class wrap the query string together with the mapRow() method into a single class?
A. MappingSqlQuery<T>
B. SqlUpdate
C. BatchSqlUpdate
D. SqlFunction<T>
Ans: A
16. Which class allows to wrap any SQL update statement?
A. MappingSqlQuery<T>
B. SqlUpdate
C. BatchSqlUpdate
D. SqlFunction<T>
Ans: B
17. Which class allows to perform batch update operations?
A. MappingSqlQuery<T>
B. SqlUpdate
C. BatchSqlUpdate
D. SqlFunction<T>
Ans: C
18. Which class allow to call stored functions in the database with argument and return types.
A. MappingSqlQuery<T>
B. SqlUpdate
C. BatchSqlUpdate
D. SqlFunction<T>
Ans: D
19. MyBatis (formerly known as iBATIS) is a popular DataMapper framework.
A. True
B. False
Ans: A
20. Which is generally more widely used database for web application development, especially on the
Linux platform?
A. PL/pgSQL
B. MySQL
C. PostgreSQL
D. JDBC
Ans. B
21. Which is procedural a language?
A. MySQL
B. JDBC
C. PL/psSQL
D. None
Ans. C
22. A database is a collection of data.
A. True
B. False
Ans. A
23. Which is the open source databases?
A. PostgreSQL
B. HSQL
C. Derby
D. All above
Ans:D
24. The difference between a DataSource and a Connection is that a DataSource provides and manages
Connections.
A. True
B. False
Ans: A
25. Which package provides DriverManagerDataSource?
A. org.springframework.jdbc.object
B. org.springframework.jdbc.support
C. org.springframework.jdbc.config
D. none
Ans. D
26. The DriverManagerDataSource does not support database connection pooling makes this class unsuitable for
anything other than testing.
A. True
B. False
Ans. A
27. Which is/are the JEE application server?
A. JBoss
B. WebSphere
C. GlassFish
D. Above all
E. None
Ans. D
28. Spring’s JndiObjectFactoryBean to obtain the data source by
A. JDBC lookup
B. JNDI lookup
C. MySQL lookup
D. None
Ans. B
29. As of version 3.1, Spring supports by default
A. HSQL
B. H2
C. DERBY
D. All Above
Ans. A
30. Which is/are ORM frameworks?
A. Hibernate
B. EclipseLink/ TopLink
C. OpenJPA
D. All are
Ans. D
31. Which one is appropriate process to create a Table?
a. Create table (Id int not null auto_increment, First_name varchar (25), Primary key(id));
b. Create table (Id int not null auto_increment, First_name varchar, Primary key(id));
c. Create table customer (Id int not null auto_increment, First_name varchar (25), Primary key(id));
Ans: c
32. Which is not Spring JDBC Packages?
a. Core
b. Datasource
c. Object
d. Config
e. servlet
Ans: e
33. What is the correct extension of properties file?
a. jdbc.properties
b. Jdbc.property
c. Jdbc.propertyfile
Ans: a
34. Which one is not JEE application server?
a. JBoss
b. webSpher
c. GlassFish
d. Primefaces
Ans: d
35. DML stand for?
a. Data manipulation language
b. Data maintain language
c. Data margin language
Ans: a
36. SQL Exception are runtime exceptions True or False?
a. True
b. False
Ans: a
37. Public class IdbExam{
Private DataSource datasource;
Public void setDataSource(DataSource dadasource){
This.datasource=datasource;
}
}
Above this application DataSource is a ---
a. Interface
b. Class
c. Method
Ans: b
38. JdbcTemplete is an Interface True or False?
a. True
b. False
Ans: b
39. Which is database management software?
a) MySQL
b) Primeface
c) Java
d) Html
Answer: a
40. RDBMS stands for
a) Relational Database Management Software.
b) Relational Database Management System.
c) Relative Database Management System.
Answer: b
41. DriverManagerDataSource is under the package of
a) Org.springframework.jdbc.JDBC
b) Org.springframework.jdbc.datasource
c) Org.springframework.jdbc.jdbcTamplete
d) Org.springframework.jdbc.DriverManagerDataSource
Answer: b
42. What is friendlier to Oracle developers?
a) MySQL
b) PostgreSQL
c) Oracle
d) Above all
Answer: b
43. MySQL is generally more widely used for….
a) Web application development
b) Desktop application development
c) Both a & b
d) None
Answer: a
44. ORM stands for
a) Object-Related Mapping
b) Object-Related Module
c) Object-Relational Mapping
d) Object-Relational Module
Answer: c
45. What is the alternative of Object-Relational Mapping?
a) JDBC
b) ODBC
c) JPA
d) Hibernate
Answer: a
46. The instance of RDBMS is called
a) Database management software
b) Database engine
c) Database server
d) Database management system
Answer: b
47. In the Spring Jdbc module, there is a class called
a) JdbcDaoSupport
b) JdbcTemplateSupport
c) JdbcTemplateDaoSupport
d) JdbcObjectDaoSuppor
Answer: a
48. Popular ORM framework is/are
a) Hibernate
b) EclipseLink
c) OpenJPA
d) Above all
Answer: d
49. What are the advantage of jdbcTamplate?
a) mentioned problems of JDBC API.
b) It provides you methods to write the queries directly,
c) it saves a lot of work and time.
d) All of the above
ans: d
50. What is a powerful mechanism to connect to the database and execute SQL queries?
a) Jdbc
b) jdbcTamplate
c) odbcTamplate
d) none of above
Ans: b
51. ResultSetExtractor interface can be used
a. to fetch records from the database
b. to delete records from the database
c. a+b
d. none
Ans: a
52. What are spring Jdbc package?
a. org.springframework.jdbc.core
b. org.springframework.jdbc.datasource
c. org.springframework.jdbc.config
d. all of the above
ans: d
53. Under which package the DriverManager is?
a. org.springframework.jdbc.core
b. org.springframework.jdbc.datasource
c. org.springframework.jdbc.config
d. none
ans: b
54. Where from spring property placeholder will load the connection information?
a. jdbc.properties
b. jdbc.config
c. jdbc.support
d. jdbc.object
Ans: a
55. DataSource implement by ---
a. JEE Application server
b. JMV Application server
c. ODBC Application server
d. Object Application server
ans: a
56. Which version spring offer embedded database supported
a. version 4.0
b. version 3.0
c. version 1.0
d. all
ans: b
57. Why jdbcTemplate used for?
a. allows to issue any type of sql statement
b. returns any type of result
c. both a & b
d. none
ans: c
58. jdbcTemplate will be initialized automatically____
a. when extend DAO supported.
b. then extend JDBC supported.
c. a+b
d. only b
ans: a
59. Which is not Hibernate configuration property?
a. hibernate.dialect
b. hibernate.batch
c. hibernate.batch-size
d. hibernate.fetch-size
ans: b
60. which are spring supported EntiyManagerFactory?
a. LocalEntiyManagerFactory Bean
b. JEE6 compliant container
c. localContaineLocalEntiyManagerFactory Bean
d. all of above
ans: d
61. Spring JdbcTemplate is based on which design pattern
A. Decorator
B. Proxy
C. Facade
D. Template
Ans: D
62. The interface is used by the JdbcTemplate to map a resultset row is
A. RowElementMapper
B. RowMapper
C. Mapper
D. ValueMapper
Ans: B
63. The main advantage of using Data Access Object (a.k.a. DAO) pattern is
A. It provides object modeling for data
B. It provides access credentials to the data objects
C. It hides database specific implementation from the other layers of the application
D. It always provides non jdbc specific implementation
Ans: C
64. A key benefit of using DataSource is that
A. it is possible to use a database connection pool to fetch database connection
B. it is possible to directly connect to a database without using connection parameters
C. it automatically enables distributed transactions
D. it facilitates logging of database queries and their results
Ans: A
65. If JdbcTemplate is used then
A. SQL queries automatically become database agnostic
B. object relational mapping is available out of the box
C. it is not necessary to write SQL queries
D. it is not necessary to manage connections in the application code
Ans: D
66. Named parameters are typically used for
A. Statements
B. Prepared Statements
C. Callable Statements
D. Transactions
Ans: B
67. Named parameters are typically specified using
A. semicolon (;)
B. dot (.)
C. colon (:)
D. hash (#)
Ans: C
68. Named parameters are typically passed using a
A. List
B. Set
C. Map
D. TreeSet
Ans: C
69. Using named parameters is preferred due to
A. proxy pattern usage
B. low cohesion
C. loose coupling
D. improved code maintainability
Ans: D
70. JdbcDaoSupport is based on
A. Visitor pattern
B. Decorator pattern
C. Proxy pattern
D. Data Access Object pattern
Ans: D
71. JdbcDaoSupport typically has a reference to
A. JdbcDataSource
B. JdbcReference
C. Template
D. JdbcTemplate
Ans: D
72. JdbcDaoSupport can be used as a
A. cloned class for all data access operations
B. base class for all data access operations
C. derived class for all data access operations
D. inner class for all data access operations
Ans: B
73. A class which extends JdbcDaoSupport is often injected into
A. Service class
B. Decorator class
C. Visitor class
D. Proxy class
Ans: A
Chapter 9
1) Which is manage Hibernate’s session factory to work in a Spring application?
a) SessionFactory
b) Application context
c) method
Ans: a
2) A Java class that is mapped to the underlying relational database structure is called
a) An entity class
b) A java class
c) An Object Mapping
Ans: a
3) which is the Maven’s project object model file?
a) Web.xml
b) context.xml
c) pom.xml
Ans: c
4) The core concept of Hibernate is based on-
a) Session factory
b) Session interface
c) Application context
Ans: b
5) embedded database using
a) H2
b) h2
c) h1
d) H1
Ans: a
6) Which is declaration of transaction demarcation requirements using annotations?
a) <tx:annotation-class>
b) <tx:annotated-driven>
c) <tx:annotation-driven>
Ans: c
7) "depth" commonly used value is?
a) 3
b) 4
c) 5
Ans: a
8) "@Entity" which means that this is a mapped-
a) java class
b) entity object
c) entity class
Ans: c
9) "@Temporal" means we would like to map The data type from the Java date type
a) date type
b) object type
c) string type
Ans: a
10) HQL means?
a) Hibernate Query Language
b) Hipertext Query Language
c) Hiperlink Query Language
Ans: a
11) which means we want the transaction to be set as read-only?
a) readOnly=true
b) readOnly=false
c) readOnly=yes
d) readOnly=no
Ans: a
12) which means that Hibernate will not join the association tables for records?
a) throw the IoException
b) throw the InitializationException
c) throw the LazyInitializationException
Ans: c
13) Hibernate covered common techniques for defining ------- mappings
a) ORM
b) MVC
c) JVM
Ans: a
14) Spring was developed to embrace POJO base development.
A. True
B. False
Ans: A
15) What is the main objective of an ORM library?
A. Close the gap between the relational data structure in the RDBMS and the OO model
B. Close the gap between the hibernate and sql
C. Close the gap between the OO model and hibernate
D. None of the above
Ans: A
16) From EJB 2.5, the EJB entity bean was replaced with the Java Persistence (JPA)
A. True
B. False
Ans: B
17) POJO stand for?
a. Plain Old Java Object
b. Pre old java object
c. Plain order java object
Ans: a
18) The relationship between hibernate and JPA is very close True or False?
a. True
b. False
Ans: a
19) When we use the AnnotationSessionFactoryBean ____
a. Then use Xml annotation support
b. Then use Hibernate annotation support
c. None of the above
Ans: b
20) How many approaches are there to the mapping Hibernate Annotations?
a. One
b. Two
c. Three
Ans: b
21) Which one is correct method for deleting data?
Chapter 10
1. JPA means __?
A. Java Processing Approach
B. Java Persistence Applied
C. Java Persistence API
D. None
Ans: C
2. STS means __?
A. Spring Tool Showcase
B. Spring Tool Suits
C. Spring Technical Support
D. Spring Tool Setting
Ans: B
3. Which are the class level architecture of JPA?
A. EntityManagerFactory
B. EntityTransaction
C. Component scan
D. A & B
Ans: D
4. Which is creates and manages multiple EntityManager instances.
A. EntityManagerFactory
B. EntityTransaction
C. Persistence
D. None
Ans: A
5. This class contain static methods to obtain EntityManagerFactory instance.
A. EntityManagerFactory class
B. EntityTransaction class
C. Persistence class
D. None
Ans: c
6. Which is the persistence objects, stores as records in the database.
A. EntityManagerFactory
B. EntityTransaction
C. Persistence
D. Entity
Ans: D
7. The relationship between EntityManagerFactory and EntityManager is __?
A. one-to-many
B. one-to-one
C. None
Ans: A
8. The relationship between EntityManager and EntityTransaction is __?
A. one-to-many
B. one-to-one
C. None
Ans: B
9. The relationship between EntityManager and Entity is __?
A. one-to-many
B. one-to-one
C. None
Ans: A
10. EntityManager instance is used to create a __?
A. query object
B. CriteriaBuilder object
C. Entity object
D. None
Ans: B
11. CriteriaQuery instance is used to create a __?
A. query object
B. CriteriaBuilder object
C. Embedded objects
D. None
Ans: A
12. CRM means__?
A. Customer Relational Management
B. Customer Relational Manager
C. Customer Relative Management
D. Customer Relative Manager
Ans: A
13. To inject the EntityManager, we use the __?
A. @PersistenceContext annotation
B. @Repository annotation
C. @Service annotation
D. None
Ans: A
14. Which file is required to configure the database and the registration of entity classes?
A. Persistence.xml
B. Web.xml
C. App-context.xml
D. None
Ans: A
15. We need to configure an EntityManagerFactory in Spring, just like the SessionFactory in Hibernate.
a) true
b) false
Answer: A
16. EMF means __?
A. Even Management Future
B. EntityManagerFactory
c. Entry Management Factory
D. None of the above
Ans: B
17. The entity manager factory requires a __ __ for transactional data access.
A. component Scan
B. transaction Manager
c. dataSource
D. None of the above
Ans: B
18. EntityManager is
A. A class
B. An object
C. An interface
Ans. C
19. The main job of EntityManager is to maintain a persistence context, in which all the entity instances under
management will be stored.
A. True
B. False
Ans. A
20. JPQL is very similar to
A. MySQL
B. HQL
C. iBatis
D. None
Ans. B
21. A SQL resultset mapping is defined at the entity class level using the annotation
A. @SqlResultSetMapping
B. @SqlResultSetExactor
C. @SqlResultSetQuery
Ans. A
22. EntityManager.getCriteriaBuilder() was called to retrieve an instance of CriteriaBuilder.
A. True
B. False
Ans. A
23. Which is not JPA persistence?
a. Hibernate
b. eclipseLink
c. OracleToplink
d. Maven
Ans: d
24. In JPA2 Which one is same as SessionFactory?
a. EntityManagerFactory
b. SessionManagerFactory
c. Session
Ans: a
25. How many types of configuration spring supports?
a. One
b. Two
c. Three
d. Four
Ans: c
26. How many types of EntityManagerFactory configuration Spring supports?
a) Two
b) Five
c) Three
d) Four
Answer: c
27. Which method is used to delete data in JPA?
a) EntityManager.remove()
b) EntityManager.destroy()
c) EntityManager.delete()
d) None
Answer: a
28. A hierarchical in an oracle database. This kind of query is database-specific and referred to as a……
a) Custom query
b) Simple query
c) Native query
d) JPA query
Answer: c
29. JPQL stands for
a) Java Persistence Query Language
b) Java Persistency Query Language
c) Java Persistent Query Language
d) Java Persist Query Language
Answer: a
30. Spring also provides intensive support for JPA.
a) True
b) False
Answer: a
31. Why is it a best practice to mark transaction as read-only when code does not write anything to the database?
Select one or more answers.
a) It is mandatory for using Spring exception translation mechanism
b) May be improve performance when using Hibernate
c) Spring optimizes its transaction interceptor
d) Provides safeguards with Oracle and some other databases
Correct answers: b, d
32. What data access technology is supported by the Spring framework? Select one or more answers.
a) JDBC
b) NoSQL
c) Hibernate
d) JPA
Correct answers: a, c, d
33. What is not provided by the JdbcTemplate? Select a unique answer.
a) Data source access
b) Open/close data source connection
c) JDBC exception wrapping into DataAccess Exception
d) JDBC statement execution
Correct answer: a
34. Using JdbcTemplate, what is the Spring provided class you will use for resultset parsing and merging rows into
a single object? Select a unique answer.
a) RowMapper
b) RowCallbackHandler
c) ResultSetExtractor
d) ResultSetMapper
Correct answer: c
35. What configuration is supported by the LocalSessionFactoryBean? Select a unique answer.
a) Listing entity classes annotated with @Entity
b) Scanning a package to detect annotated entity classes (with @Entity)
c) Listing hibernate XML mapping configuration file (hbm.xml)
d) All above
Correct answer: c
Chapter 12
1. Why we use the Design to interfaces
A) Remove coupling
B) Lose coupling
C) Reduce coupling
D) All of the above
Ans: C
2. In java, a class has only one shot at concrete inheritance but van implement as how much interfaces as
necessary?
A) Two interfaces
B) Three interfaces
C) One interfaces
D) Many interfaces
Ans: D
3. DOM model concept come from?
A) Interface problem
B) Domain problem
C) Database problem
D) Pattern problem
Ans: B
4. The Data pattern it is not the same as the value object pattern.
A) True
B) False
Ans: A
5. DOM refers to
A. Document Object Model
B. Domain Object Model
C. Delivery Object Model
Ans. B
6. DOM is a collection of ______ that provides an abstract model of the data.
A. Object
B. Interface
C. Method
Ans. A
7. An application’s service layer is a layer where all of the business logic that makes up the application is
encapsulated.
A. True
B. False
Ans. A
8. In Java, a class has only _____ shot at concrete inheritance.
A. One
B. Two
C. Three
D. Five
Ans. A
9. Consider a system that has a business interface called.
A. FreeService
B. OrderService
C. ExecuteService
Ans. B
10. Which is/are the drawbacks of the Basic Factory Pattern
A. There is no way to change an implementing class without a recompile.
B. There is no way simply to switch instantiation models.
C. Only A
D. Both A and B
Ans. D
11. The Value Object Pattern is same as the Data Transfer Object Pattern.
A. True
B. False
Ans. B
12. Which one is traditional OOP best practice?
a. Interface-driven design
b. Building domain object model
c. None of the above
Ans: a
13. What is the responsibility of Factory Pattern?
a) To provide application component
b) To provide application context
c) To provide application initiated object
d) Above all
Answer: a
14. How many drawbacks are there in Factory Pattern?
a) Five
b) Six
c) Two
d) Three
Answer: d
15. What is the biggest drawback of the traditional Factory Pattern?
a) Multiple implementation
b) Single implementation
c) Both a & b
d) None
Answer: a
16. A Domain Object Model (DOM) is asset classes that model concepts from the problem domain.
a) True
b) False
Answer: a
17. A good DOM makes it easier for developers to transform application requirements into application features.
a) True
b) False
Answer: a
18. The goal of DOM is to create a set of
a) Methods
b) Classes
c) Objects
d) Instances
Answer: b
19. DTO stands for
a) Data Objects
b) Database Objects
c) Data Transfer Objects
d) None
Answer: c
Chapter 14
1. What is/are the purpose of validation?
a) Fulfills all predefined business requirements.
b) Ensure the data integrity of the application.
c) Usefulness in other layers of the application.
Answer: a, b, c
2. In application development, data validation is always mentioned along with ___________.
a) Conversion
b) Formatting
c) Both conversion and formatting
Answer: c
3. Why in application development, data validation is always mentioned along with conversion and formatting?
a) The format of the source of data is different from the format being used in the application server
b) The format of the source of data is similar with the format being used in the application server
Answer: a
4. Type Conversion system can-
a) provide an alternative to PropertyEditorsupport
b) be configured to convert between any Java types and POJOs
Answer: a, b
5. To use the conversion service instead of PropertyEditor, where we need to configure an instance of the
org.springframework.core.convert.ConversionService interface?
a) web.xml
b) dispatcher-servlet.xml
c) applicationContext.xml
d) context.xml
Answer: c
6. By default, the type conversion service supports conversion between common types including strings,
numbers, enums, collections, maps, and so on.
a) True
b) False
Answer: a
7. What does shows the bellow picture:
Chapter 17
1. For Which attribute we use bite array as a JAVA data type?
a. Photo attribute
b. Text attribute
c. Name attribute
Ans: a
2. To set up the service layer within the spring MVC project what we create first
a. Class
b. Configuration file
c. Method
Ans: b
3. What is commonly used pattern in implementing the presentation layer of an application.
a. Model
b. View
c. Controller
d. MVC
Ans: d
4. What is for spring bootstrap and shut down the root web application context
a. CharacterEncodingFilter
b. ContextLoderListerner
c. httpMethodFiltter
d. HiddenHttpMethodFilter
Ans: b
5. Which filter is used to specify the character encoding for request?
a. CharacterEncodingFilter
b. ContextLoderListerner
c. httpMethodFiltter
d. HiddenHttpMethodFilter
Ans: a
6. Which filter provides supports for Http methods other then GET and POST?
a. CharacterEncodingFilter
b. ContextLoderListerner
c. httpMethodFiltter
d. HiddenHttpMethodFilter
Ans: D
7. Which library provides a rich text editor in input form?
a. Images
b. Jqgrid
c. Ckeditor
d. Style
Ans: c
8. When we use <spring: eval> tag?
a. If the require filled is null
b. If the require filled is not null
Ans: a
9. Which attribute specifies the link for sending XmlHttpRequest, which gets the data for the current page?
a. Datatype
b. url
c. mtype
d. pager
Ans: b
10. Which attribute specifies the data format
a. Datatype
b. url
c. mtype
d. pager
Ans: a
11. Which attribute enables pagination support?
a. Datatype
b. url
c. mtype
d. pager
Ans: d
12. how many ways to file upload support?
a. 2
b. 3
c. 4
d. 5
Ans: A
13. Which one is not web application frameworks?
a. Spring MVC
b. Struts
c. Java Server Faces(JSF)
d. MySQl
Ans: d
14. Spring MVC which is the central servlet that receives requests and dispatchers then to the appropriate
controllers?
a. DispatcherServlet
b. Servlet
c. ActionServlet
d. None of the above
Ans: a
15. Which one is not Interface?
a. HandlerExceptionResolver
b. ViewResolver
c. ModelAndView
Ans: c
16. Major consideration for developing web application choose all that apply?
a. Performance
b. User-friendly
c. Accessibility
d. All
Ans: d
17. What is the Artifact ID of Joda-time?
a. joda-time-jsptags
b. joda-time-htmltags
c. joda-time-jsftags
d. None
Ans: a
18. The usage of Spring MVC?
a. Internationalization
b. Theming
c. Page templating
d. All
Ans: d
19. Richness to the SpringBlogeApplication highlights are?
a. User Interface
b. Rich-text-editing
c. Data grid with pagination
d. None
Ans: a, b, c
20. GWT stands for
a) Google Web Toolkit
b) Google Website Toolkit
c) Google Web-based Toolkit
d) Nome
Answer: a
21. The main principle of MVC is to define an architecture with clear responsibilities for different component.
a) True
b) False
Answer: a
22. Spring provides comprehensive support the theming of web application.
a) True
b) False
Answer: a
23. How many steps contain to implement the show view?
a) Five
b) Four
c) Three
d) Two
Answer: c
24. jQuery is one of the most popular JavaScript libraries being used for ……. development
a) Desktop application
b) Web fronted
c) Both a & b
d) None
Answer: b
25. What is needed to be able to use jQuery and jQuery UI components in our view?
a) Style sheets JavaScript files
b) Style sheets Java files
c) Style sheets jsp files
d) Style sheets jsf files
Answer: a
26. What could not return a Spring MVC controller? Select a single answer.
a) An absolute path to the view
b) A logical view name
c) A new JstlView
d) void
e) null value
Correct answer: a
27. Where do you cannot declare Spring MVC controller? Select one or more answers.
a) In a Spring application context XML configuration file
b) Into the web.xml file of the web application
c) Into the java code by using annotations
d) Into the JSP pages
Correct answer: b, d
28. When a bean has scope limited to HTTP session that is called?
a) Request scope
b) Session scope
c) Prototype scope
d) Singleton scope
Ans: b
Chapter 18
1. Spring used which repository abstraction?
A. JPA
B. JDB
C. JBoss Seam
D. Velocity
Ans: A
2. How many type of Spring web flow module?
A. Two
B. Three
C. Four
D. Five
Ans: C
3. How many concept of Spring web-flow architecture?
A. Two
B. Three
C. Four
D. Five
Ans: B
5.DSL means----
A. Domain Static Language
B. Domain Simple Language
C. Domain Specific Language
D. Domain Situation Language
Ans: C
6.How many types of bean scopes?
A. One
B. Two
c. Three
D. Four
Ans: C
7.JSF means---
A. Java SecuredFaces
B. Java ServerFaces
C. Java SecuredForm
D. None of the above
Ans: B
8.JSF consist of how many component?
A. One
B. Two
c. Three
D. Four
Ans: D
9.Which component hierarchy is represented by nesting tags?
A. DI
B. UI
C. IOC
D. None of the above
Ans: B
10.How many phases in application life cycle?
A. Four
B. Five
c. Six
D. Seven
Ans: C
11.How many dependencies for spring web-flow, JSP2 and Prime Faces?
A. Four
B. Five
c. Six
D. Seven
Ans: A
12. Which are Spring web flow modules?
a. spring-faces
b. spring-binding
c. spring-js
d. spring-webflow
e. All
Ans: e
13. Which is not the Spring web flow feature?
a. Flow
b. View
c. Controller
d. Conversation
Ans: c
14. Which is not Life Cycle phases?
a. Restore view
b. Apply request
c. Process validation
d. Apply conversation
Ans: d
15. Which are the required dependencies for developing application using spring web flow with primefaces?
a. org.springframework.webflow
b. com.sun.faces
c. org.primefaces
d. All
Ans: d
16. DriverManagerDatasource is the implementation of a -----
a. mysqlDatasource
b. Database
c. Datasource
Ans: c
17. EntityManager Interface is the core concept of ------
a. JPA
b. SQL
c. JEE
d. JDA
Ans: a
18. Spring Web Flow is an extension to the MVC pattern, it provides support for developing flow based
applications and supports more fine-grained bean scopes.
a) True
b) False
Answer: a
19. The architecture of Spring Web Flow is built around by how many concepts?
a) Three
b) Four
c) Five
d) Six
Answer: a
20. A flow is a business process representing a use case. In Spring Web Flow, a flow consists of a series of steps
called……
a) Object
b) Model
c) Instance
d) States
Answer: d
21. How many types of conversion?
a) Two
b) Three
c) Four
d) Five
Answer: b
22. In a web application, in terms of bean scopes, there are which scopes are available?
a) Request
b) Session
c) Application
d) Above all
Answer: d
23. Available bean scopes in Spring Web Flow….
a) Flow
b) View
c) Request
d) Flush
e) Conversation
f) Above all
Answer: f
24. How many life cycles in JSF application?
a) Five
b) Four
c) Six
d) Three
Answer: c
25. What are the components of JSF application life cycle?
a) Restore view
b) Apply request
c) Process validations
d) Update model values
e) Invoke application
f) Render response
g) Above all
Answer: g