Spring MVC Final
Spring MVC Final
This section presents you various set of Mock Tests related to Hibernate Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
A - Java DB Connectivity
B - JDBC provides a set of Java API for accessing the relational databases from Java program.
C - JDBC APIs enables Java programs to execute SQL statements and interact with any SQL
compliant database.
A - Castor
B - Spring DAO
C - Hibernate
D - NoSQL
A - Hibernate takes care of mapping Java classes to database tables using XML files and without
writing any line of code.
B - Hibernate provides simple APIs for storing and retrieving Java objects directly to and from the
database.
C - Hibernate abstracts away the unfamiliar SQL types and provide us to work around familiar
Java Objects.
A - DB2/NT
B - MySQL
C - FoundationDB
D - PostgreSQL
A - XDoclet Spring
B - J2EE
C - Maven
A - JDBC
B - SessionFactory
C - Session
D - Configuration
A - Transaction
B - Provider
C - Criteria
D - Query
A - The Configuration object is the first Hibernate object you create in any Hibernate application.
B - The Configuration object is usually created only once during application initialization.
A - Configuration
B - Session
C - SessionFactory
D - Transaction
A - SessionFactory object configures Hibernate for the application using the supplied
configuration file.
C - You would need one SessionFactory object per database using a separate configuration file.
A - true
B - false
A - true
B - false
C - This is an optional object and Hibernate applications may choose not to use this interface,
instead managing transactions in their own application code.
A - Query objects Hibernate Query Language HQL string to retrieve data from the database and
create objects.
B - Query objects SQL string to retrieve data from the database and create objects.
C - A Query instance is used to bind query parameters, limit the number of results returned by
the query, and finally to execute the query.
A - This property makes Hibernate generate the appropriate SQL for the chosen database.
B - This property makes Hibernate generate the appropriate java code for the chosen database.
C - Both of the above.
A - Once we close the Hibernate Session, the persistent instance will become a detached
instance.
A - true
B - false
ANSWER SHEET
1 B
2 D
3 B
4 C
5 D
6 A
7 D
8 C
9 D
10 A
11 B
12 D
13 A
14 D
15 D
16 D
17 A
18 B
19 D
20 D
21 A
22 D
23 D
24 A
25 A
Loading [MathJax]/jax/output/HTML-CSS/jax.js
HIBERNATE MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com
This section presents you various set of Mock Tests related to Hibernate Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Q 1 - Session.createCriteria creates a new Criteria instance, for the given entity class,
or a superclass of an entity class.
A - true
B - false
Q 2 - Session.createQuery creates a new instance of Query for the given HQL query
string.
A - true
B - false
Q 3 - Session.createSQLQuery creates a new instance of Query for the given HQL query
string.
A - true
B - false
Q 4 - Session.createSQLQuery creates a new instance of Query for the given SQL query
string.
A - true
B - false
A - Session.delete
B - Session.remove
C - Session.del
D - Session.rm
A - Session.read
B - Session.get
C - Session.retrieve
D - Session.fetch
Q 7 - Which method is used to re-read the state of the given instance from the
underlying database?
A - Session.refresh
B - Session.get
C - Session.reload
D - Session.retrieve
Q 8 - Which method is used to save the state of the given instance from the
underlying database?
A - Session.store
B - Session.keep
C - Session.save
D - Session.load
Q 9 - Which method is used to update the state of the given instance from the
underlying database?
A - Session.store
B - Session.keep
C - Session.update
D - Session.load
Q 10 - Which method is used to save or update the state of the given instance from
the underlying database?
A - Session.saveOrUpdate
B - Session.keep
C - Session.update
D - Session.load
Q 11 - Which of the following is the root node of hbm.xml file?
A - hibernate-mapping
B - hibernate-config
C - class-mapping
D - class-config
Q 12 - Which of the following elements is used to define specific mappings from a Java
classes to the database tables?
A - property
B - hibernate-config
C - class
D - class-config
A - The <class> elements are used to define specific mappings from a Java classes to the
database tables.
B - The Java class name is specified using the name attribute of the class element.
C - The database table name is specified using the table attribute of the class element.
Q 14 - Which element of hbm.xml defines maps the unique ID attribute in class to the
primary key of the database table?
A - id
B - generator
C - primaryKey
A - The <id> element maps the unique ID attribute in class to the primary key of the database
table.
B - The name attribute of the id element refers to the property in the class.
C - The column attribute of the id element refers to the column in the database table.
A - id
B - generator
C - primaryKey
A - The <generator> element within the id element is used to automatically generate the
primary key values
B - Set the class attribute of the generator element is set to native to let hibernate pick up either
identity, sequence or hilo algorithm to create primary key depending upon the capabilities of the
underlying database.
A - id
B - generator
C - property
D - class
A - The <property> element is used to map a Java class property to a column in the database
table.
B - The name attribute of the element refers to the property in the class.
C - The column attribute of the element refers to the column in the database table.
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <many-to-one>
B - <many-one>
C - <ManyToOne>
ANSWER SHEET
1 A
2 A
3 B
4 A
5 A
6 B
7 A
8 C
9 C
10 A
11 A
12 C
13 D
14 A
15 D
16 B
17 C
18 C
19 D
20 A
21 B
22 C
23 D
24 D
25 A
Loading [MathJax]/jax/output/HTML-CSS/jax.js
HIBERNATE MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com
This section presents you various set of Mock Tests related to Hibernate Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
A - <many-to-one>
B - <many-one>
C - <ManyToOne>
A - <one-to-many>
B - <one-many>
C - <OneToMany>
A - <many-to-many>
B - <many-many>
C - <ManyToMany>
B - <one-many>
C - <OneToMany>
A - An employee can have multiple certificates and same certificate can be conferred to many
employees.
Q 6 - What is the difference between save and persist methods of session object?
A - There is no difference.
B - save saves the object and returns status whereas persist stores status in different variable.
C - save saves the object and returns the id of the instance whereas persist do not return
anything after saving the instance.
Q 7 - What is the difference between get and load methods of session object?
B - get always hits the database whereas load method doesn't hit the database.
A - true
B - false
Q 10 - Child objects are not loaded when parent is loaded/populated from database.
What this technique is called?
A - Eager Loading
B - Lazy Loading
A - HQL takes java objects in the same way as SQL takes tables.
B - The first-level cache is a mandatory cache through which all requests must pass.
C - The Session object keeps an object under its own power before committing it to the database.
A - The second-level cache is the SessionFactory based cache and is mainly responsible for
caching objects across sessions.
C - The second-level cache is mainly responsible for caching objects across sessions.
A - true
B - false
A - true
B - false
A - true
B - false
A - The query-level cache is cache for query resultsets that integrates closely with the second-
level cache.
B - Query level cache requires two additional physical cache regions that hold the cached query
results and the timestamps when a table was last updated.
C - Query level cache is only useful for queries that are run frequently with the same parameters.
B - Read-write
C - Nonstrict-read-write.
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.
ANSWER SHEET
1 A
2 A
3 A
4 A
5 A
6 C
7 D
8 A
9 A
10 B
11 A
12 D
13 A
14 D
15 A
16 D
17 A
18 B
19 B
20 A
21 D
22 D
23 B
24 B
25 C
Loading [MathJax]/jax/output/HTML-CSS/jax.js
HIBERNATE MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com
This section presents you various set of Mock Tests related to Hibernate Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.
A - ORM system lets business code access objects rather than DB tables.
A - Oracle
B - Microsoft SQL Server Database
C - FoundationDB
A - DB2/NT
B - PostgreSQL
A - Transaction
B - SessionFactory
C - Session
A - true
B - false
A - false
B - true
Q 9 - You would need one SessionFactory object per database using a separate
configuration file.
A - false
B - true
A - true
B - false
A - false
B - true
A - false
B - true
A - Hibernate Annotations is the powerful way to provide the metadata for the Object and
Relational Table mapping.
B - All the metadata is clubbed into the POJO java file along with the code this helps the user to
understand the table structure and POJO simultaneously during the development.
B - Hibernate assumes that it should access properties on an object directly through fields at
runtime.
B - Class marked with @Entity annotation must have a no-argument constructor that is visible
with at least protected scope.
A - The @Table annotation allows to specify the details of the table that will be used to persist the
entity in the database.
B - The @Table annotation allows to override the name of the table, its catalogue, and its
schema, and enforce unique constraints on columns in the table.
A - The @Column annotation is used to specify the details of the column to which a field or
property will be mapped.
A - true
B - false
Q 20 - length attribute of @Column annotation permits the size of the column used to
map a value particularly for a String value.
A - false
B - true
A - true
B - false
B - Instead of operating on tables and columns, HQL works with persistent objects and their
properties.
A - HQL queries are translated by Hibernate into conventional SQL queries which in turns
perform action on database.
B - The AS clause can be used to assign aliases to the classes in HQL queries.
A - HQL supports INSERT INTO clause only where records can be inserted from one object to
another object.
ANSWER SHEET
1 C
2 D
3 D
4 C
5 D
6 D
7 A
8 B
9 B
10 A
11 B
12 B
13 C
14 C
15 C
16 C
17 C
18 A
19 A
20 B
21 A
22 C
23 C
24 C
25 A
Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js
https://www.tutorialspoint.com/hibernate/hibernate_mock_test.htm?min=51&max=75
--------------------------------------------------------------------------------------------
1 - Which are the modules of Web layer?
A - WebSocket, Servlet, Web, Portlet (Modules in Web Layer of Spring framework)
B - WebSocket, Servlet, Web-MVC, Web
C - HTML, JSP, WEB, Portlet
D - HTML, Servlet, WEB, Portlet.
@Component
@Qualifier("staff")
public Staff implements Person {}
@Component
@Qualifier("employee")
public Manager implements Person {}
@Component
public Payroll {
@Autowired
public Payroll(@Qualifier("employee") Person person){
this.person = person;
}
7.Which of the following, parses in XML based on expression and its used extensively in conjugation with
xstl ?
a)JDOM parser
b)SAX parser
c) STAX parser
d) Xpath parser
8.In Spring MVC which of the following is the front controller class that initializes the context based on
the spring beans configuration?
a.org.springframework.web.servlet.DispatcherServlet
b.org.springframework.web.context.DispatcherServlet c.org.springframework.web.servlet
d.org.springframework.web.context.ApplicationContext
9.Given the following configuration class, what are correct affirmations?
public class ApplicationConfig {
private DataSource dataSource;
@Autowired
public ApplicationConfig(DataSource dataSource) {
this.dataSource = dataSource;
}
@Bean(name="clientRepository")
ClientRepository jpaClientRepository() {
return new JpaClientRepository();
}
}
1. @Configuration annotation is missing
2. Default or no-arg constructor is missing
3. @Bean name is ambiguous
4. @Bean scope is prototype
Annotating a class with the @Configuration indicates that the class can be used by the Spring IoC
container as a source of bean definitions.
The @Bean annotation tells Spring that a method annotated with @Bean will return an object that
should be registered as a bean in the Spring application context.
10.Which of the following is NOT the type of mapping?
a. Instance mapping
b. Component mapping
c. Association mapping
d. Class mapping
11.In spring bean configuration bean attribute called 'scope' defines what kind of object has to be
created and returned. What returns a new bean instance each time when required?
a.Prototype
b.Session
c.Singleton
d.Global session
12. Which of the following explains about addClass () in the listed options
jQuery addClass() Method:jQuery HTML/CSS methods
EXAMPLE:
→Using jQuery addClass() method to create zebra stripes effect in HTML table:
=>$(selector).addClass(classname,function(index,oldclass)) → SYNTAX
Index and oldclass are the 2 different classes added using ‘,’.
14. The Model-View-Controller(MVC) is an architectural pattern that does not separate an application
into three main logical components: the model, the view and the controller.
a. true
b. False.
15. The application is designed around an object model. The SQL code is generated at build time and the
associations between objects are supported by the persistent mechanism, and queries are specified
using an object oriented expression language. This best suited for medium-sized applications with some
complex transactions. Used when the mapping exceeds 25 different database products at a time.
Which of the following is this called as?
a. Application Object Mapping
b. Expression object mapping
c. Medium Object Mapping
d. Object Mapping
16. XsltViewResolver-supports XsltView by resolving the view name of which of the following options
a) all of the listed options
b) VelocityView and its subclasses
c) URL of xslt
d)view name of the URL of the report file.
use the XsltView and XsltViewResolver in order to apply a XML stylesheet (XSL) for a specific XML
document, resulting in a view (typically an HTML page) transformed by the XSL document.
17. What types of views supported by spring MVC for different presentation technologies
a) JSP
b) HTML
c) velocity templates
d) select all
19. A very powerful and high performance querying language used to Query, retrieve, store data in DB is
a) PLSQL
b) HQL
c) SQL
d) RDBMS
20.which is correct?
a. Hibernate is an object oriented query language
b. It is database independent
c.it supports pagination
d. HQL statements will be converted to SQL or other language the database supports
e. all the above
21. Which of the following is true about hibernate. Dialect property in hibernate configuration?
A - This property makes Hibernate generate the appropriate SQL for the chosen database.
B - This property makes Hibernate generate the appropriate java code for the chosen database.
C - Both of the above.
D - None of the above.
Dialect means "the variant of a language". Hibernate, as we know, is database agnostic. It can work with
different databases. Therefore, at some point hibernate has to use database specific SQL. Hibernate
uses "dialect" configuration to know which database you are using so that it can switch to the database
specific SQL generator code wherever/whenever necessary.
24. How could you externalize constants from a Spring configuration file or a Spring annotation into
a.properties file? Select one or more answers
1. By using the <util:constant /> tag
2. By declaring the ConstantPlaceholderConfigurer bean post processor
3. By using the <context:property-placeholder /> tag
4. By using the c: namespace
<bean id="mailProperties"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
</bean>
------------------------------ mail.properties ----------------------------------------
smtp.host=smtp.gmail.com
smtp.port=587
[email protected]
smtp.pass=secret
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${smtp.host}" />
<property name="port" value="${smtp.port}" />
<property name="username" value="${smtp.user}" />
<property name="password" value="${smtp.pass}" />
</bean>
25. Does sessionLocaleResolver interceptor detects if a special parameter is present in current Http req?
TRUE
FALSE
27. The test module supports the testing of spring components with junit for testing
a. true
b. false
Create an event class, CustomEvent by extending ApplicationEvent. This class must define a default
constructor which should inherit constructor from ApplicationEvent class.
Spring configuration metadata is to tell Spring container how to initiate, configure, wire and assemble
the application specific objects.
After returning advice is invoked only on normal method return, not if an exception is thrown. Such
advice can see the return value, but cannot change it.
org.springframework.aop
Interface AfterReturningAdvice
37. Java based configuration option disables you to write most of your Spring configuration without XML
but with the help of few Java-based annotations
True
False
41. ORM stands for Object-Relational Mapping (ORM) is a programming technique for converting data
between relational databases. select one
True----------Ans
False
42. which type of annotation applies to bean property setter methods. select one
a) @Requires
b) @Resource
c) @Required----------------ANS
d)@Requiring
43. Element which can be used to inject a collection of name-value pairs where the name and the value
can be of any type. select one
a) <list>
b) <set>
c)<map>---------------ANS
d)<props>
44. Element which can be used to inject a collection of name-value pairs where the name and the value
are both Strings type. select one
a) <list>
b) <set>
c)<map>
d)<props>---------------ANS
45. ApplicationContext implements which of the following interface that is used to obtain localized
messages, with the actual implementation being pluggable
I. MessageSource
II. RequestMapping. Select One:
a. only I--------------ANS
b. only II
c. Neither I or II
d. Both I and II
46. How many layers are there in Hibernate architecture. select one
a)3
b)4------------Ans
c)5
d)2
47. What of the following is not correct in live environment? select one
a. Constructor and properties autowiring in the same bean are not compatible
b. A bean should have a default or a no-args constructor
c. The <constructor-arg> tag could take type, name and index to reduce ambiguity
d. All of the above-----------ANS
48. named queries are created via which level of annotations on entities?
a. all-level
b. high-level
c. low
d. class level------- ANS
50. in controller which is responsible for rendering the page in spring mvc
a. browser
b. http----------ans
c. database
d. application
52. In Spring AOP, the process of linking aspect with other application types or objects to create an
advice object is called Weaving.
53. Can you inject null and empty string values in Spring? ans: yes
54. SpEL is NOT part of core container. ANS: false (it is part of core container)
55. how many instances can be created fora global session: one
56. what display the data with help of model? Ans: View
60. What is the difference between save() and persist() methods of session object?
A - There is no difference.
B - save saves the object and returns status whereas persist stores status in different variable.
C - save saves the object and returns the id of the instance whereas persist do not return anything after
saving the instance. ------ANS
D - None of the above.
61. what is required to write a basic spring program? ANS---- jdk, ide, maven, all the above
62. JDBC, ORM, OXM, JMS, Transactions are the modules of Data Access/ Integration layer. ------TRUE
63. ContextStartedEvent event is published when the ApplicationContext is started using the start ()
method on the ConfigurableApplicationContext interface. -----TRUE
65. ContextClosedEvent--------is published when the ApplicationContext is closed using the close()
method on the ConfigurableApplicationContext interface.
66. When we work with an object oriented system, there is mismatch between the object model and the
relational database. State True or False
a). TRUE-------------ANS
b). FALSE
67. Form tags are available in springs is more compatible with html tags for better development. State
True or False
a). TRUE-----------ANS
b). FALSE
68. index and type can be used in the constructor-arg at the same time? State True or False
a). TRUE-----ANS
b). FALSE
69. the same XSD of BeanFactory can be used for View resolver interface?State True or False
a). TRUE---------------ANS
b). FALSE
70. XML Mapping file offers which of the following? Select One:
a. Readable Metadata
b. Surrogate key generation strategy
c. Collection metadata
d. all the listed options---------ANS
e. Column/Table Mapping
71. Which of the following aspects of a project can be managed using Maven?
A - Distribution
B - mailing list
C - Both of the above. ------Ans
D - None of the above.
73. where multiple components are involved in processing the request in a single transaction, which
method is used to get the session object.
a) opensession()
b) getsession()
c) getcurrentsession()
d) all of the above---ans
74. which state does the persistent object move to when the transaction is committed and the session is
closed?
a) permanent
b) detached---ans
c) initial
d) persistent
75. which hibernate property do you use to configure your chosen database.
a) hibernate.configdatabase
b) hibernate.changedatabase
c) hibernate.setdatabase
d) hibernate.dialect----ans
76. Which of the following tags generated by the form tag library compliant with XHTML-1.0-Strict
specification and attendant DTD.
“The button tag”
“The checkbox tag”
“The checkboxes tag”
“The errors tag”
“The form tag”
“The hidden tag”
“The input tag”
“The label tag”
“The option tag”
“The options tag”
“The password tag”
“The radiobutton tag”
“The radiobuttons tag”
“The select tag”
“The textarea tag”
77. Template engine is primarily aimed at generating which of the following XML?
a. Java
b. XML---ANS
c. XHTML---ANS
d. HTML5----ANS
78. The Spring form tag library comes bundled in spring-webmvc.jar. State True or false
a. true----ans
b. false
79. Which of the following tags are not available in XML schema based configuration
ANS: JDX-marsheller
80. Which of the following is not a major considerations of spring web application
a. Interactive and Richness
b. User-Friendly
c. Performance
d. Tough accessibility---ans
84.
ResourceLoader support: Spring's Resource interface use a flexible generic abstraction for handling low-
level resources. An application context itself is a ResourceLoader, hence provides an application with
access to deployment-specific Resource instances.
85. Which of the following are the best practices for writing spring XML Configurations?
87.
Spring BeanFactory Container-org.springframework.beans.factory.BeanFactoryinterface.
Spring ApplicationContext Container-org.springframework.context.ApplicationContext
Scope: Description
Singleton: This scopes the bean definition to a single instance per Spring IoC container (default).
Prototype: This scopes a single bean definition to have any number of object instances.
Request: This scopes a bean definition to an HTTP request. Only valid in the context of a web-aware
Spring ApplicationContext.
Session: This scopes a bean definition to an HTTP session. Only valid in the context of a web-aware
Spring ApplicationContext.
global-session: This scopes a bean definition to a global HTTP session. Only valid in the context of a web-
aware Spring ApplicationContext.
Element Description
<list> ->This helps in wiring i.e., injecting a list of values, allowing duplicates.
<set> ->This helps in wiring a set of values but without any duplicates.
<map> ->This can be used to inject a collection of name-value pairs where the name and the value can
be of any type.
<props> ->This can be used to inject a collection of name-value pairs where the name and the value are
both Strings.
90. Autowiring Modes:
-----------------------------------------------------------------------------------------
Mode Description
No => This is a default setting which means no autowiring and you should use explicit bean reference for
wiring. You have to do nothing special for this wiring. This is what you already have seen in Dependency
Injection chapter.
byName => Autowiring by property name. Spring container looks at the properties of the beans on
which autowire attribute is set to byName in the XML configuration file. It then tries to match and wire
its properties with the beans defined by the same names in the configuration file.
byType=>Autowiring by property datatype. Spring container looks at the properties of the beans on
which attribute is set to byType in the XML configuration file. It then tries to match and wire a property
if its type matches with exactly one of the beans name in the configuration file. If more than one such
beans exists, a fatal exception is thrown.
Constructor=>Similar to byType, but this type applies to constructor arguments. If there is not exactly
one bean of the constructor argument type in the container, a fatal error is raised.
autodetect =>Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
Autowiring Limitations:
-------------------------------------------------------------------------------------
Limitations Description
Overriding possibility-----You can still specify dependencies using <constructor-arg> and <property>
settings which will always override autowiring.
Primitive data types------You cannot autowire so-called simple properties such as primitives, Strings, and
Classes.
Confusing nature------Autowiring is less exact than explicit wiring, so if possible prefer using explicit
wiring.
91.
@Required-----The @Required annotation applies to bean property setter methods
@Autowired----The @Autowired annotation can apply to bean property setter methods, nonsetter
methods, constructor and properties.
@Qualifier----The @Qualifier annotation along with @Autowired can be used to remove the confusion
by specifying which exact bean will be wired.
92.
@Configuration-----indicates that the class can be used by the Spring IoC container as a source of bean
definitions.
@Bean-----annotation tells Spring that a method annotated with @Bean will return an object that
should be registered as a bean in the Spring application context
@Import-----annotation allows for loading @Bean definitions from another configuration class
ContextClosedEvent--------This event is published when the ApplicationContext is closed using the close()
method on the ConfigurableApplicationContext interface. A closed context reaches its
end of life; it cannot be refreshed or restarted.
RequestHandledEvent-------This is a web-specific event telling all beans that an HTTP request has been
serviced.
Terms Description
Aspect->This is a module which has a set of APIs providing cross-cutting requirements. For example, a
logging module would be called AOP aspect for logging. An application can have any number of aspects
depending on the requirement.
Join Point->This represents a point in your application where you can plug-in the AOP aspect. You can
also say, it is the actual place in the application where an action will be taken using Spring AOP
framework.
Advice->This is the actual action to be taken either before or after the method execution. This is an
actual piece of code that is invoked during the program execution by Spring AOP framework.
Pointcut->This is a set of one or more join points where an advice should be executed. You can specify
pointcuts using expressions or patterns as we will see in our AOP examples.
Introduction->An introduction allows you to add new methods or attributes to the existing classes.
Target Object->The object being advised by one or more aspects. This object will always be a proxied
object, also referred to as the advised object.
Weaving->Weaving is the process of linking aspects with other application types or objects to create an
advised object. This can be done at compile time, load time, or at runtime.
Approach Description
XML Schema based→Aspects are implemented using the regular classes along with XML based
configuration.
@AspectJ based→@AspectJ refers to a style of declaring aspects as regular Java classes annotated with
Java 5 annotations.
ACID:
Isolation: There may be many transaction processing with the same data set at
the same time. Each transaction should be isolated from others to prevent data
corruption.
Durability: Once a transaction has completed, the results of this transaction have
to be made permanent and cannot be erased from the database due to system
failure.
void commit(TransactionStatus status) →This method commits the given transaction, with regard to its
status.
void rollback(TransactionStatus status) →This method performs a rollback of the given transaction.
int getPropagationBehavior()→This method returns the propagation behavior. Spring offers all of the
transaction propagation options familiar from EJB CMT.
int getIsolationLevel()→This method returns the degree to which this transaction is isolated from the
work of other transactions.
int getTimeout()→This method returns the time in seconds in which the transaction must complete.
1. fetch- “join” = Disable the lazy loading, always load all the collections and entities.
2. fetch- “select” (default) = Lazy load all the collections and entities.
3. batch- size =” N” = Fetching up to ‘N’ collections or entities, *Not record*.
4. fetch- “subselect” = Group its collection into a sub select statement.
------------------------------------------------------------------------------------------------------------
Topics to read:
* HQL
*Tools in hibernate
*Interceptors in hibernate
*Annotations in both spring and hibernate
*specifications for Java API (e.g.: JSR-250, JSR-303)
*Interfaces and classes in both spring and hibernate (e.g.: ViewResolver is an interface)
*Mapping in hibernate (e.g.: Middlegen is a tool)
B - Spring beans are instantiated, assembled, and otherwise managed by a Spring IoC container.
C - This can be used to inject a collection of name-value pairs where name and value can be of
any type.
D - This can be used to inject a collection of name-value pairs where the name and value are
both Strings.
Q 5 - What is Advice?
C - This is the actual action to be taken either before or after the method execution.
Q 6 - What is Introduction?
A - An introduction represents a point in your application where you can plug-in AOP aspect.
A - False
B - True
Q 10 - What is a DispatcherServlet?
A - Core and beans modules provide the fundamental parts of the framework, including
Dependency Injection feature.
B - The SpEL module provides a powerful Expression Language for querying and manipulating
an object graph at runtime.
B - This scopes the bean definition to a single instance per HTTP Request.
C - This scopes the bean definition to a single instance per HTTP Session.
D - This scopes the bean definition to a single instance per HTTP Application/ Global session.
A - This event is published when the Servlet Context is either initialized or refreshed.
D - This event is published when the ApplicationContext is closed using the close() method on
the ConfigurableApplicationContext interface.
Q 14 - What is Weaving?
B - Weaving is the process of linking aspects with other application types or objects to create an
advised object.
A - Hibernate
B - iBatis
C - JPA
D - All of above.
Q 16 - What stands true for spring framework?
A - Using shutdownHook()
B - Using shutdownHandler()
C - Using registerHook()
D - Using registerShutdownHook()
Q 18 - Which of the following class can be used to execute Sql queries in spring?
B - JDBCHelper
A - JdbcTemplate
C - DBHelper
D - DBTemplate
A - XmlBeanFactory
B - ClassPathBeanFactory
C - FileSystemBeanFactory
D - AdvancedBeanFactory
A - session
B - global-session
C - prototype
D - request
A - True
B - False
A - A represents a object in your application where you can plug-in AOP aspect.
B - The object being advised by one or more aspects, this object will always be a proxy object,
also referred to as the advised object.
A - True
B - False
A - ResultSet
B - RowMapper
C - RowSetMapper
D - ResultSetMapper
A - The JDBC module provides a JDBC-abstraction layer that removes the need to do tedious
JDBC related coding.
B - The ORM module provides integration layers for popular object-relational mapping APIs,
including JPA, JDO, Hibernate, and iBatis.
C - The Java Messaging Service JMS module contains features for producing and consuming
messages.
C - This can be used to inject a collection of name-value pairs where name and value can be of
any type.
A - The @Autowired annotation can be used to autowire bean on the setter method.
B - This annotation provides more fine-grained control over where and how autowiring should
be accomplished.
C - The @Autowired annotation can be used to autowire bean on the methods with arbitrary
names and/or multiple arguments.
D - All of above.
A - Run advice after a method execution only if method exits by throwing an exception.
B - Run advice after a class loads only if class throws exception during load time.
A - 1.0
B - 2.0
C - 3.0
D - 4.0
A - True
B - False
Q 37 - What is true about <set> collection configuration elements?
C - This can be used to inject a collection of name-value pairs where name and value can be of
any type.
D - This can be used to inject a collection of name-value pairs where the name and value are
both Strings.
C - Run time
A - Beans
B - Aspects
C - JMS
D - Context
B - It defines callback methods that you can implement to provide your own instantiation logic,
dependency-resolution logic etc.
C - It processes beans once a bean is loaded.
A - BeanFactory, ApplicationContext
A - Default setting which means no autowiring and you should use explicit bean reference for
wiring.
C - Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
A - This event is published when the Servlet Context is either initialized or refreshed.
C - Run advice after http response is returned only if http response is success.
C - Both of above.
D - None of above.
A - The functions that span multiple points of an application are called cross cutting concerns.
B - Cross-cutting concerns are conceptually separate from the application's business logic.
C - This can be used to inject a collection of name-value pairs where name and value can be of
any type.
D - This can be used to inject a collection of name-value pairs where the name and value are
both Strings.
A - Default setting which meas no autowiring and you should use explicit bean reference for
wiring.
B - Autowiring by property name. Spring tries to match and wire its properties with the beans
defined by the same names in the configuration file.
C - Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
D - Autowiring by property type. Spring tries to match and wire a property if its type matches
with exactly one of the beans name in configuration file.
C - This represents a point in your object where you join injected values.
D - This represents a point in your application where you can plug-in AOP aspect.
C - Both of above.
D - None of above.
Q 52 - SpEL is part of core container.
A - False
B - True
A - session
B - global-session
C - prototype
D - request
Q 54 - What is spring?
A - This scopes a single bean definition to have any number of object instances.
B - This scopes the bean definition to a single instance per HTTP Request.
C - This scopes the bean definition to a single instance per HTTP Session.
D - This scopes the bean definition to a single instance per HTTP Application/ Global session.
B - This annotation indicates that bean property is required while saving the bean data to
database.
C - This annotation simply indicates that the affected bean property must be populated at
configuration time, through an explicit property value in a bean definition or through
autowiring.
D - This annotation indicates that bean property is required while serializing the bean.
A - MySql
B - PostgresSql
C - NoSql
D - Oracle
A - global-session
B - singleton
C - prototype
D - request
Q 60 - Which are the modules of core container?
Q 62 - What is aspect?
A - Yes
B - No
A - False
B - True
B - Web.xml file
C - Meta-inf/dispatcher.xml
D - Web-inf/ dispatcher.xml
A - It is a concrete class.
B - It is an interface.
C - It is an abstract class.
A - This event is published when the Servlet Context is either initialized or refreshed.
C - This event is published when the ApplicationContext is started using the start() method on
the ConfigurableApplicationContext interface.
A - Spring MVC framework is Model-Value-Class architecture and used to bind model data with
values.
B - The Spring web MVC framework provides model-view-controller architecture and ready
components that can be used to develop flexible and loosely coupled web applications.
C - Spring MVC framework is used for Transaction management for Web Applications.
A - The @Controller annotation indicates that a particular class serves the role of a controller.
Q 74 - What is RequestHandledEvent:event?
A - This event is published when the Servlet Context is either initialized or refreshed.
B - Spring beans are instantiated, assembled, and otherwise managed by a Spring IoC container.
A - singleton
B - prototype
C - request
D - session
A - session
B - global-session
C - prototype
D - request
A - SpringEvent
B - Event
C - ApplicationEvent
D - None of above
A - Similar to byType, but type applies to constructor arguments. If there is not exactly one
bean of the constructor argument type in the container, a fatal error is raised.
B - Autowiring by property name. Spring tries to match and wire its properties with the beans
defined by the same names in the configuration file.
C - Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
D - Autowiring by property type. Spring tries to match and wire a property if its type matches
with exactly one of the beans name in configuration file.
Q 80 - What is Pointcut?
A - This represents a point in your application where you can plug-in AOP aspect.
A - ServletContext
B - DispatcherServlet
C - ApplicationContext
A - Autowiring by property name. Spring tries to match and wire its properties with the beans
defined by the same names in the configuration file.
B - Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
C - Autowiring by property type. Spring tries to match and wire a property if its type matches
with exactly one of the beans name in configuration file.
D - Similar to byType, but type applies to constructor arguments. If there is not exactly one
bean of the constructor argument type in the container, a fatal error is raised.
A - SPHelper
B - JdbcTemplateCall
C - JdbcTemplate
D - SimpleJdbcCall
A - FileSystemXmlApplicationContext, ClassPathXmlApplicationContext,
WebXmlApplicationContext
C - AdvancedApplicationContext, FileApplicationContext
D - FileSystemApplicationContext, ClassPathApplicationContext
1)Given the following configuration class, what are correct affirmations? Select one or more answers.
public class ApplicationConfig {
private DataSource dataSource;
@Autowired
public ApplicationConfig(DataSource dataSource) {
this.dataSource = dataSource;
}
@Bean(name="clientRepository")
ClientRepository jpaClientRepository() {
return new JpaClientRepository();
}
}
1. @Configuration annotation is missing----------ANS
2. Default or no-arg constructor is missing-------ANS
3. @Bean name is ambiguous
4. @Bean scope is prototype
---------------------------------------------------------------------------------------------------------------
2)<id name="deptId" type="string">
<column name="columnid" length="30"/>
<generatoers/>
<id/>
[/xml]
Select One:
a.DB key
b.Unique key
c.Secondary key
d.Primary key--------ANS
--------------------------------------------------------------------------------------------------------------------
3)ApplicationContext implements which of the following interface that is used to obtain localized
messages, with the actual implementation being pluggable
I. MessageSource
II. RequestMapping
Select One:
a. only I--------------ANS
b.only II
c. Neither I or II
d. Both I and II
--------------------------------------------------------------------------------------------------------------------
4).Which of the following is a many to one relationship
a) many-to-one
b) <many-to-one>---------ANS
c) None of the list
d) <Manyone>
-------------------------------------------------------------------------------------------------------------
5)What of the following is not correct in live environment?
select one
a. Constuctor and properties autowiring in the same bean are not compatible
b. A bean should have a default or a no-args constructor
c. The <constructor-arg> tag could take type, name and index to reduce ambiguity
d. All of the above-----------ANS(not sure)
--------------------------------------------------------------------------------------------------------------------------
6)Which of the following is not available in HQL
select one
a) Select
b)Where
c)Sub---------------Ans(not sure)
d)Having
--------------------------------------------------------------------------------------------------
7)maven is a project management and comprehension too
select one
True----------Ans
False
-----------------------------------------------------------------------------------------
8)How many layers are there in Hibernate architechture
select one
a)3------------Ans(not sure)
b)4
c)5
d)2
------------------------------------------------------------------------
9)Beans,Core, Context,spEL are the components in Core container
select one
True----------Ans
False
-------------------------------------------------------------------------------------------------------
10) PROPAGATION_REQUIRES_NEW
Ans: Creates a new transaction, suspending the current transaction if one exists.
----------------------------------------------------------------------------------------------------------
11)Element which can be used to inject a collection of name-value pairs where the name and the value
can be of any type.
select one
a)<list>
b)<set>
c)<map>---------------ANS
d)<props>
-----------------------------------------------------------------------------------------------------------------
12)Element which can be used to inject a collection of name-value pairs where the name and the value
are both Strings type.
select one
a)<list>
b)<set>
c)<map>
d)<props>---------------ANS
-----------------------------------------------------------------------------------------
13)which type of annotation applies to bean property setter methods
select one
a)@Requires
b)@Resource
c)@Required----------------ANS
d)@Requiring
----------------------------------------------------------------------------------------------------------------------
14)ORM stands for Object-Relational Mapping (ORM) is a programming technique for converting data
between relational databases.
select one
True----------Ans
False
-------------------------------------------------------------------------------------------------------------
15)Which tool helps to generate the mapping document Though many Hibernate users choose to write
the XML by hand
select one
a)oldgen
b)younggen
c)Middlegen----------------ANS
d) Mediumgen
-------------------------------------------------------------------------------------------------------------
16)Java based configuration option disables you to write most of your Spring configuration without XML
but with the help of few Java-based annotations
select one
True
False----------Ans
------------------------------------------------------------------------------------------------------------------------------------------
-
17) What types of views supported by spring MVC for different presentation technologies
select one or more
a)JSP
b)HTML
c)velocity templates
d)
I. The Auto wiring in spring framework can be performed by configuring in xml and spring Auto-Wiring
with Annotation @Autowired
II. Auto-wiring beans with xml configuration: In Spring framework, you can wire beans automatically
with auto wiring feature
III. To enable auto-wiring just define the "autowire" attribute in <bean> tag.
Select One:
a.I, II, and III--------ANS
b.I and III
c.I and II
d.II and III
----------------------------------------------------------------------------------------------------------------------------------
Topics to read:
* HQL
*Tools in hibernate
*Interceptors in hibernate
*Annotations in both spring and hibernate
*specifications for Java API (eg:JSR-250,JSR-303)
*Interfaces and classes in both spring and hibernate(eg: ViewResolver is a interface)
*Mapping in hibernate(eg: Middlegen is a tool)
Q 1 - What ORM stands for?
A - The Configuration object is the first Hibernate object you create in any Hibernate application.
B - The Configuration object is usually created only once during application initialization.
C - The Configuration object represents a configuration or properties file required by the Hibernate.
Q 3 - Session.createQuery creates a new instance of Query for the given HQL query string.
A - true
B - false
Q 4 - Which element of hbm.xml defines maps the unique ID attribute in class to the primary key of the
database table?
A - id
B - generator
C - primaryKey
A - <set>
B - <list>
C - <bag>
D - <map>
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical
concern.
A - Transaction
B - SessionFactory
C - Session
A - Castor
B - Spring DAO
C - Hibernate
D - NoSQL
B - SessionFactory object is created during application start up and kept for later use.
C - You would need one SessionFactory object per database using a separate configuration file.
Q 14 - Which method is used to re-read the state of the given instance from the underlying database?
A - Session.refresh()
B - Session.get()
C - Session.reload()
D - Session.retrieve()
A - <set>
B - <list>
C - <bag>
D - <map>
Q 16 - Child objects are not loaded when parent is loaded/populated from database. What this
technique is called?
A - Eager Loading
B - Lazy Loading
A - Oracle
A - true
B - false
A - This property makes Hibernate generate the appropriate SQL for the chosen database.
B - This property makes Hibernate generate the appropriate java code for the chosen database.
Q 23 - Which method is used to save the state of the given instance from the underlying database?
A - Session.store()
B - Session.keep()
C - Session.save()
D - Session.load()
A - <set>
B - <list>
C - <bag>
D - <map>
A - The query-level cache is cache for query resultsets that integrates closely with the second-level
cache.
A - Transactional
B - Read-write
C - Nonstrict-read-write.
B - Hibernate assumes that it should access properties on an object directly through fields at runtime.
C - Both of the above.
A - HQL queries are translated by Hibernate into conventional SQL queries which in turns perform action
on database.
B - The AS clause can be used to assign aliases to the classes in HQL queries.
A - Query objects Hibernate Query Language (HQL) string to retrieve data from the database and create
objects.
B - Query objects SQL string to retrieve data from the database and create objects.
C - A Query instance is used to bind query parameters, limit the number of results returned by the
query, and finally to execute the query.
Q 31 - Session.createSQLQuery creates a new instance of Query for the given SQL query string.
A - true
B - false
Q 32 - Which method is used to get a persistent instance from the datastore?
A - Session.read()
B - Session.get()
C - Session.retrieve()
D - Session.fetch()
A - The <generator> element within the id element is used to automatically generate the primary key
values
B - Set the class attribute of the generator element is set to native to let hibernate pick up either
identity, sequence or hilo algorithm to create primary key depending upon the capabilities of the
underlying database.
Q 34- Which of the following element is used to represent one-to-many relationship in hibernate?
A - <one-to-many>
B - <one-many>
C - <OneToMany>
A - true
B - false
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical
concern.
A - Hibernate Annotations is the powerful way to provide the metadata for the Object and Relational
Table mapping.
B - All the metadata is clubbed into the POJO java file along with the code this helps the user to
understand the table structure and POJO simultaneously during the development.
A - JDBC
B - SessionFactory
C - Session
D - Configuration
A - true
B - false
A - Session.delete()
B - Session.remove()
C - Session.del()
D - Session.rm()
Q 41- Which method is used to save or update the state of the given instance from the underlying
database?
A - Session.saveOrUpdate()
B - Session.keep()
C - Session.update()
D - Session.load()
A - true
B - false
A - DB2/NT
B - PostgreSQL
A - true
B - false
Q 45 - name attribute of @Column annotation permits the name of the column to be explicitly specified.
A - true
B - false
C - This is an optional object and Hibernate applications may choose not to use this interface, instead
managing transactions in their own application code.
Q 47 - Session.beginTransaction method begins a unit of work and returns the associated Transaction
object.
A - true
B - false
A - id
B - generator
C - primaryKey
Q 49- What is the difference between get() and load() methods of session object?
A - get() returns null if no data is present where as load throws ObjectNotFoundException exception in
such case.
B - get() always hits the database whereas load() method doesn't hit the database.
A - false
B - true
B - Instead of operating on tables and columns, HQL works with persistent objects and their properties.
B - SessionFactory object is created during application start up and kept for later use.
C - You would need one SessionFactory object per database using a separate configuration file.
A - An employee can have multiple certificates and same certificate can be conferred to many
employees.
A - The second-level cache is the SessionFactory based cache and is mainly responsible for caching
objects across sessions.
A - The @Column annotation is used to specify the details of the column to which a field or property will
be mapped.
A - Configuration
B - Session
C - SessionFactory
D - Transaction
Q 57 - Session.createQuery creates a new instance of Query for the given HQL query string.
A - true
B - false
A - The <id> element maps the unique ID attribute in class to the primary key of the database table.
B - The name attribute of the id element refers to the property in the class.
C - The column attribute of the id element refers to the column in the database table.
A - true
B - false
A - Transaction
B - SessionFactory
C - Session
Q 61 - name attribute of @Column annotation permits the name of the column to be explicitly specified.
A - true
B - false
A - The <property> element is used to map a Java class property to a column in the database table.
B - The name attribute of the element refers to the property in the class.
C - The column attribute of the element refers to the column in the database table.
B - Class marked with @Entity annotation must have a no-argument constructor that is visible with at
least protected scope.
A - Hibernate takes care of mapping Java classes to database tables using XML files and without writing
any line of code.
B - Hibernate provides simple APIs for storing and retrieving Java objects directly to and from the
database.
C - Hibernate abstracts away the unfamiliar SQL types and provide us to work around familiar Java
Objects.
D - All of the above.
Q 65 - Session.beginTransaction method begins a unit of work and returns the associated Transaction
object.
A - true
B - false
Q 66 - Which element of hbm.xml is used to map a Java class property to a column in the database
table?
A - id
B - generator
C - property
D - class
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical
concern.
A - The <class> elements are used to define specific mappings from a Java classes to the database tables.
B - The Java class name is specified using the name attribute of the class element.
C - The database table name is specified using the table attribute of the class element.
A - XDoclet Spring
B - J2EE
C - Maven
A - <set>
B - <list>
C - <bag>
D - <map>
A - HQL supports INSERT INTO clause only where records can be inserted from one object to another
object.
A - hibernate-mapping
B - hibernate-config
C - class-mapping
D - class-config
1.The central artifact in spring javaConfig is the @Configuration-annotated class. ans: true
a. Spring-faces
b. Spring-bundling
c. Spring-container
d.Spring-webflow
4.In spring MVC each tag provides support to the set of attributes of its corresponding HTML
tag counterpart making the tags familiar & intuitive to use. State true or False. true
5.Which of the following are mandatory rules to create validation for a normal employee table?
6.Which of the following allows as to add a new method or attributes to existing classes?
a. Introduction
b. Proxy
c. Weaving
d.Auto call
7.Given the following Spring configuration file, what is the correct answer:
<bean class="com.spring.service.MyServiceImpl">
</bean>
<bean class="com.spring.repository.JpaDao"/>
8.Which of the following are the best practices for writing spring XML configuration?
-----------------------------------------------------------------------------------------------------------------
best practices:
b. Tools
c. Data Access
d. Business Logic
10.We can use index and type attribute together. State true or False. -true
a. Lightweight
b. Open Source
c. ORM
12.Which of the following options about Auto Wiring in spring are correct?
1.Auto-wiring in spring framework can be performed by configuring xml and auto-wiring with
annotation @Autowired.
2.Auto-wiring beans with xml configuration: In spring framework, you can wire automatically
with auto-wiring feature.
3.To enable auto-wiring just define the "autowire" attribute in <bean> tag.
13.Which of the following parses in xml based on expression and its used extensively in
conjunction with XLST?
b. SAX parser
c. STAX Parser
d. JDOM Parser
14.Length attribute of @column annotation permits the size of the column used to map a value
particularly for a string value. State true or False. -----true
15.When we work with an object oriented system there's a mismatch between the object modal
and the relational database. State true or False. -----true
a. JDBC APIs enables java programs to execute SQL statements and interact with any SQL
Complaint database
c.it provides set of java API for accessing the relational databases from java program
18.Which of the listed statement are correct for spring Bean scope: Prototype?
1.Spring container creates new instance of bean for each and every request for that bean
2.Prototype scoped bean is served by creating new instance of bean for each and every bean
dependency
3.After instantiating bean and submitting it to client spring container will maintain the record
(not maintain)
4.Prototype scope is spring standard scope and can be used in standalone as well as web
application of spring.
20.Hibernate session is the main runtime interface between a java application and Hibernate.
State true or False. -----true
23.Which of the following are correct in sql queries in hibernate.
1.sql queries may contain named and positional parameters, just like hibernate queries
4.You may call session.connection() and use JDBC Connection at any time
24.Which is the query language that embodies a very powerful and flexible mechanism to
query, store, update and retrieve objects from a database?
a. PLSQL
b. RDBMS
c. SQL
d. HQL
a. spring MVC framework is used for Transaction management for web application
b. spring MVC framework is Model-value-class architecture and used to bind model data
26.Which of the listed options are True for bean configuration inheritance?
1.In spring the inheritance is supported in bean to share common values properties or
configurations 2.A child bean or inherited bean can inherit its parent bean configurations,
properties & some attributes 3. the parent bean allows to override the inherited values.
28.[xml]
<generator/>
</id>
[xml]
b. Secondary key
c. Unique key
29.When you need to upload a large number of records into your database using Hibernate, you
can use batch processing. State true or False. ---true
30.Different types of run advice "before" and "after" the advised method is invoked. Which of
the following is the correct option with respect to advice?
a. After returning
b. None
c. After throwing
d. around -----ANs
31.Implementation of viewResolver accepts a configuration file written in XML with the same
DTD as spring XML bean factories. State true or False. ---------true
32.Choose the odd one out respect to annotations from the following
a.@requestmapping
b. @controller
c.@responsevalid
d.@Pathvalid
33.For a fast Development, the dependency injection feature of spring Framework & support to
various Frameworks makes the easy development of javaEE application. state true or False. -----
true
code is moved into this framework. state true or False. --false (simple)
35.The application is designed around an object model. Sql code is generated at build time
& the associations between obj are supported by the persistence mechanism, and queries are
specified using an obj-oriented expression language. This is best suited for medium-sized
applications
with some complex transactions. Used when mapping exceeds 25 different database products at
a time.
a. Object mapping
36.Which of the following is not the steps for creating web MVC?
a. <many-to-one>
b. <ManyToOne>
c. <many-one>
d. none
The <many-to-one> element will be used to define the rule to establish a one-to-one relationship
between EMPLOYEE and ADDRESS entities, but column attribute will be set to unique
constraint and rest of the mapping file will remain as it was in case of many-to-one association.
OR
a) <many-to-many>
b) <many-to-one>
d) <one-to-many>
39.In hibernate implement cache for a query, if the result sets can integrate closely, which level
40.Spring MVC provides predefined templates for JDBC, Hibernate and JPA. state true or False.
----true
41.In Spring MVC which of the following is the front controller class that initializes the context
a. org.springframework.web.servlet.DispatcherServlet
b. org.springframework.web.context.DispatcherServlet
c. org.springframework.web.servlet
d. org.springframework.web.context.ApplicationContext
a. Instance mapping-------------Ans
b. Component mapping
c. Association mapping
d. Class mapping
45.In spring bean configuration bean attribute called 'scope' defines what kind of object
has to be created and returned. What returns a new bean instance each time when required?
a. Prototype----Ans
b. Session
c. Singleton
d. Global session
46.To validate the form fields you need to have a separate UserValidator class
that implements the validator interface, override the validate () method perform all the
validations. state true or False. ------true
47.The application context implements which of the following interface that is used to obtain
localized
1.messageSource -------------------Ans
2.RequestMapping
3.both
4.neither
1. Constructor and properties autowiring in the same bean are not compatible
3. The <constructor-arg> tag could take type, name and index to reduce ambiguity
A - This event is published when the Servlet Context is either initialized or refreshed.
D - This event is published when the ApplicationContext is closed using the close method on
the
51.Which of the following explains about addclass() function in the listed options?
b. this translated file name is then loaded as an input stream from the java class loader--ANs
c. this addclass() function is important if you want efficient usage of classes in your code---------
-Ans
52.Spring MVC provides a JSP tag library (Spring form) for making it easier to bind form
elements to model data. state true or False. Ans:True
d.All of above.
c. Spring MVC view resolvers help the Dispatcher Servlet in identifying the views which has to
be rendered in response for a request.
d. none
a. It Provides a consistent programming model across different transaction APIs such as JTA,
JDBC, Hibernate, JPA, and JDO.
B. It Supports declarative transaction management.
56.Given the following configuration class, what are correct affirmations? Select one or more
answers.
@Autowired
this.dataSource = dataSource;
@Bean(name="clientRepository")
ClientRepository jpaClientRepository() {
B.Ths. helps in wiring a list of values but without any duplicates. -----<set>
C. This can be used to inject a collection of name-value pairs where name and value can be of
This can be used to inject a collection of name-value pairs where the name and value are
both Strings. ----------<props>
A. FileSystemXmlApplicationContext,ClassPathXmlApplicationContext,
WebXmlApplicationContext-------------
C.AdvancedApplicationContext, FileApplicationContext
D.FileSystemApplicationContext, ClassPathApplicationContext
59.It is difficult to inject the dependency by constructor. state true or False. ---true
A-Obj
ectRel
ati
onMap
B-Obj
ectRel
ati
onal
Mappi
ng
C-Obj
ectRecor
dMappi
ng
D-Noneoft
heabov
e.
Q2-Whi
choft
hef
oll
owi
ngi
str
ueaboutconf
igur
ati
oncomponentofHi
ber
nat
e?
A-TheConfi
gur
ati
onobj
ecti
sthef
ir
stHi
ber
nat
eobj
ecty
oucr
eat
einanyHi
ber
nat
e
appl
i
cat
ion.
B-TheConfi
gur
ati
onobj
ecti
susual
l
ycr
eat
edonl
yoncedur
ingappl
i
cat
ion
i
nit
ial
i
zat
ion.
C-TheConf
igur
ati
onobj
ectr
epr
esent
saconf
igur
ati
onorpr
oper
ti
esf
il
erequi
redby
t
heHiber
nat
e.
D-Al
loft
heabov
e.
Q3-Sessi
on.
creat
eQuer
ycr
eat
esanewi
nst
anceofQuer
yfort
hegi
venHQLquer
y
st
ri
ng.
A-t
rue
B-f
alse
Q4-Whichel
ementofhbm.x
mldefi
nesmapst
heuni
queI
Dat
tri
but
eincl
asst
othe
pr
imar
ykeyofthedat
abaset
abl
e?
A-i
d
B-gener
ator
C-pr
imar
yKey
D-Noneoft
heabov
e.
Q5-Whi
choft
hef
oll
owi
ngel
ementmapsj
ava.
uti
l
.Sor
tedMappr
oper
tyi
nhi
ber
nat
e?
A-<set
>
B-<l
i
st>
C-<bag>
D-<map>
Q6-Whati
slaz
yloadi
ng?
A-Lazyl
oadi
ngi
sat
echni
quei
nwhi
chobj
ect
sar
eloadedondemandbasi
s.
B-Lazyl
oadi
ngi
sat
echni
quei
nwhi
chobj
ect
sar
eper
sist
edondemandbasi
s.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q7-Whati
sfi
rstl
evel
cachei
nhi
ber
nat
e?
A-Thef
ir
st-
lev
elcachei
stheSessi
onbasedcache.
B-Thef
ir
st-
lev
elcachei
stheSessi
onFact
orybasedcache.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q8-WhenaTr
ansact
ional
concur
rencyst
rat
egyi
stobeused?
A-Usei
tforr
efer
encedat
aonl
y.
B-Uset hi
sstrat
egyforr
ead-
most
lydat
awher
eiti
scr
it
ical
topr
eventst
aledat
ain
concur
renttr
ansact
ions.
C-Usethisstr
ategyi
fdat
ahar
dlyev
erchangesandasmal
ll
ikel
i
hoodofst
aledat
ais
notofcr
it
ical
concern.
D-Noneoft
heabov
e.
Q9-Whi
choft
hef
oll
owi
ngi
sacor
ecomponentofHi
ber
nat
e?
A-Tr
ansact
ion
B-Sessi
onFact
ory
C-Sessi
on
D-Al
loft
heabov
e
Q10-Whi
choft
hef
oll
owi
ngi
str
ueabout@Gener
atedVal
ueannot
ati
on?
A-@Gener
atedVal
ueannot
ati
ont
akest
wopar
amet
ersst
rat
egyandgener
ator
.
B-@Gener
atedVal
ueannot
ati
onpr
ovi
dest
hepr
imar
ykeygener
ati
onst
rat
egyt
obe
used.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q11-Whi
choft
hef
oll
owi
ngi
snotanORM f
ramewor
k?
A-Cast
or
B-Spr
ingDAO
C-Hi
ber
nat
e
D-NoSQL
Q12-Whi
choft
hef
oll
owi
ngi
str
ueaboutSessi
onFact
oryobj
ecti
nhi
ber
nat
e?
A-TheSessi
onFact
oryi
sheav
ywei
ghtobj
ect
.
B-Sessi
onFact
oryobj
ecti
scr
eat
eddur
ingappl
i
cat
ionst
artupandkeptf
orl
ateruse.
C-YouwouldneedoneSessi
onFact
oryobj
ectperdat
abaseusi
ngasepar
ate
conf
igur
ati
onf
il
e.
D-Al
loft
heabov
e.
Q13-Whi
choft
hef
oll
owi
ngi
str
ueaboutt
ransi
entst
ateofaper
sist
entent
it
y?
A-Anewi
nst
anceofaper
sist
entcl
asswhi
chi
snotassoci
atedwi
thaSessi
on.
B-Anewi
nst
anceofaper
sist
entcl
asswhi
chhasnor
epr
esent
ati
oni
nthedat
abase.
C-Anewi
nst
anceofaper
sist
entcl
asswhi
chhasnoi
dent
if
ierv
alue.
D-Al
loft
heabov
e.
Q14-Whi chmet
hodisusedt
ore-
readt
hest
ateoft
hegi
veni
nst
ancef
rom t
he
under
lyi
ngdat
abase?
A-Sessi
on.
ref
resh(
)
B-Sessi
on.
get
()
C-Sessi
on.
rel
oad(
)
D-Sessi
on.
ret
ri
eve(
)
Q15-Whi
choft
hef
oll
owi
ngel
ementmapsj
ava.
uti
l
.Li
stpr
oper
tyi
nhi
ber
nat
e?
A-<set
>
B-<l
i
st>
C-<bag>
D-<map>
Q16-Chil
dobj ectsarenotloadedwhenpar
enti
sloaded/
popul
atedf
rom dat
abase.
Whatt
histechniqueiscall
ed?
A-EagerLoadi
ng
B-LazyLoadi
ng
C-RequestbasedLoadi
ng
D-Noneoft
heabov
e.
Q17-WhatHQLst
andsf
or?
A-Hi
ber
nat
eQuer
yLanguage
B-Hi
ghQuer
yLanguage
C-Hy
bri
dQuer
yLanguage
D-Noneoft
heabov
e.
Q18-Whi
choft
hef
oll
owi
ngdat
abasei
snotsuppor
tedbyHi
ber
nat
e?
A-Or
acl
e
B-Mi
crosof
tSQLSer
verDat
abase
C-Foundat
ionDB
D-I
nfor
mixDy
nami
cSer
ver
Q19-ASessi
oni
susedt
ogetaphy
sical
connect
ionwi
thadat
abase.
A-t
rue
B-f
alse
Q20-Whi
choft
hef
oll
owi
ngi
str
ueaboutHQL?
A-Hi
ber
nat
esuppor
tsnamedpar
amet
ersi
nit
sHQLquer
ies.
B-HQLsuppor
tsar
angeofaggr
egat
emet
hods,
simi
l
art
oSQL.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q21-Whi
choft
hef
oll
owi
ngi
str
ueaboutHi
ber
nat
e?
A-Hi
ber
nat
eisanObj
ect
-Rel
ati
onal
Mappi
ng(
ORM)sol
uti
onf
orJAVA.
B-Hi
ber
nat
eisanObj
ect
-Rel
ati
onal
Mappi
ng(
ORM)sol
uti
onf
or.
NET
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q22-Whi chofthef
oll
owi
ngi
str
ueabouthi
ber
nat
e.di
alectpr
oper
tyi
nhi
ber
nat
e
conf
igur
ation?
A-Thispr
oper
tymakesHi
ber
nat
egener
atet
heappr
opr
iat
eSQLf
ort
hechosen
dat
abase.
B-Thi
sproper
tymakesHi
ber
nat
egener
atet
heappr
opr
iat
ejav
acodef
ort
hechosen
dat
abase.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q23-Whi chmet
hodisusedt
osav
ethest
ateoft
hegi
veni
nst
ancef
rom t
he
under
lyi
ngdat
abase?
A-Sessi
on.
stor
e()
B-Sessi
on.
keep(
)
C-Sessi
on.
sav
e()
D-Sessi
on.
load(
)
Q24-Whi
choft
hef
oll
owi
ngel
ementmapsj
ava.
uti
l
.Mappr
oper
tyi
nhi
ber
nat
e?
A-<set
>
B-<l
i
st>
C-<bag>
D-<map>
Q25-Whati
sQuer
ylev
elcachei
nhi
ber
nat
e?
A-Thequer y
-l
evelcachei
scachef
orquer
yresul
tset
sthati
ntegr
atescl
osel
ywi
tht
he
second-
lev
elcache.
B-Thequer
y-l
evel
cachei
stheSessi
onbasedcache.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q26-Whi
choft
hef
oll
owi
ngi
saconcur
rencyst
rat
egi
esi
nhi
ber
nat
e?
A-Tr
ansact
ional
B-Read-
wri
te
C-Nonst
ri
ct-
read-
wri
te.
D-Al
loft
heabov
e.
Q27-Whi
choft
hef
oll
owi
ngi
str
ueabout@I
dannot
ati
on?
A-Hi
ber
nat
edet
ect
sthatt
he@I
dannot
ati
oni
sonaf
iel
d.
B-Hiber
nateassumest
hati
tshoul
daccesspr
oper
ti
esonanobj
ectdi
rect
lyt
hrough
f
iel
dsatrunt
ime.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q28-Whi
choft
hef
oll
owi
ngi
str
ueaboutHQL?
A-HQLqueri
esaretr
ansl
atedbyHiber
nat
eint
oconv
ent
ional
SQLquer
ieswhi
chi
n
t
urnsper
for
m act
ionondatabase.
B-TheAScl
ausecanbeusedt
oassi
gnal
i
asest
othecl
assesi
nHQLquer
ies.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q29-Whi
choft
hef
oll
owi
ngi
str
ueaboutORM?
A-ORM st
andsf
orObj
ect
-Rel
ati
onal
Mappi
ng.
B-ORM isapr
ogr
ammi
ngt
echni
quef
orconv
ert
ingdat
abet
weenr
elat
ional
dat
abases.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q30-Whi
choft
hef
oll
owi
ngi
str
ueaboutQuer
yobj
ecti
nhi
ber
nat
e?
A-Queryobj
ect
sHiber
nateQuer
yLanguage(
HQL)st
ri
ngt
oret
ri
evedat
afr
om t
he
dat
abaseandcr
eat
eobjects.
B-Quer
yobj
ect
sSQLst
ri
ngt
oret
ri
evedat
afr
om t
hedat
abaseandcr
eat
eobj
ect
s.
C-AQueryi
nst
anceisusedtobindquerypar
ameter
s,l
imi
tthenumberofr
esul
ts
r
etur
nedbyt
hequery
, andf
inal
l
yt oexecut
ethequer
y.
D-Al
loft
heabov
e.
Q31-Sessi
on.
creat
eSQLQuer
ycr
eat
esanewi
nst
anceofQuer
yfort
hegi
venSQL
quer
yst
ri
ng.
A-t
rue
B-f
alse
Q32-Whi
chmet
hodi
susedt
ogetaper
sist
enti
nst
ancef
rom t
hedat
ast
ore?
A-Sessi
on.
read(
)
B-Sessi
on.
get
()
C-Sessi
on.
ret
ri
eve(
)
D-Sessi
on.
fet
ch(
)
Q33-Whi
choft
hef
oll
owi
ngi
str
ueabout<gener
ator
>el
ement
?
A-The<gener
ator
>el
ementwi
thi
nthei
del
ementi
susedt
oaut
omat
ical
l
ygener
ate
t
hepri
marykeyval
ues
B-Settheclassattr
ibuteoft
hegenerat
orel ementissett
onati
vetolethi
ber
nate
pi
ckupeitheridenti
ty,
sequenceorhi
loalgorit
hm tocreat
epr
imarykeydependi
ng
uponthecapabili
ti
esoftheunderl
yi
ngdat abase.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q34-Whi
choft
hef
oll
owi
ngel
ementi
susedt
orepr
esentone-
to-
manyr
elat
ionshi
pin
hi
ber
nat
e?
A-<one-
to-
many
>
B-<one-
many
>
C-<OneToMany
>
D-Noneoft
heabov
e.
Q35-I
squer
ylev
elcachi
ngmandat
oryi
nhi
ber
nat
e?
A-t
rue
B-f
alse
Q36-WhenaRead-
onl
yconcur
rencyst
rat
egyi
stobeused?
A-Usei
tforr
efer
encedat
aonl
y.
B-Uset hi
sstrat
egyforr
ead-
most
lydat
awher
eiti
scr
it
ical
topr
eventst
aledat
ain
concur
renttr
ansact
ions.
C-Usethisstr
ategyi
fdat
ahar
dlyev
erchangesandasmal
ll
ikel
i
hoodofst
aledat
ais
notofcr
it
ical
concern.
D-Noneoft
heabov
e.
Q37-Whi
choft
hef
oll
owi
ngi
str
ueabouthi
ber
nat
eannot
ati
ons?
A-HibernateAnnot
ati
onsi
sthepower
ful
wayt
opr
ovi
det
hemet
adat
afort
heObj
ect
andRelati
onalTabl
emappi
ng.
B-Allthemetadat
aiscl
ubbedint
ot hePOJOjav
afi
lealongwi t
hthecodethi
shel
ps
theusertounder
standt
hetabl
estructur
eandPOJOsimultaneousl
yduri
ngthe
devel
opment.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q38-Whi
choft
hef
oll
owi
ngi
snotacor
ecomponentofHi
ber
nat
e?
A-JDBC
B-Sessi
onFact
ory
C-Sessi
on
D-Conf
igur
ati
on
Q39-I
sSessi
onat
hread-
saf
eobj
ect
?
A-t
rue
B-f
alse
Q40-Whi
chmet
hodi
susedt
oremov
eaper
sist
enti
nst
ancef
rom t
hedat
ast
ore?
A-Sessi
on.
del
ete(
)
B-Sessi
on.
remov
e()
C-Sessi
on.
del
()
D-Sessi
on.
rm(
)
Q41-Whi
chmet hodisusedt
osav
eorupdat
ethest
ateoft
hegi
veni
nst
ancef
rom
t
heunder
lyi
ngdatabase?
A-Sessi
on.
sav
eOr
Updat
e()
B-Sessi
on.
keep(
)
C-Sessi
on.
updat
e()
D-Sessi
on.
load(
)
Q42-I
sfi
rstl
evel
cachi
ngmandat
oryi
nhi
ber
nat
e?
A-t
rue
B-f
alse
Q43-Whi
choft
hef
oll
owi
ngdat
abasei
ssuppor
tedbyHi
ber
nat
e?
A-DB2/
NT
B-Post
greSQL
C-Sy
baseSQLSer
ver
D-Al
loft
heabov
e
Q44-Conf
igur
ati
onobj
ecti
susedt
ocr
eat
eSessi
onFact
oryobj
ecti
nhi
ber
nat
e.
A-t
rue
B-f
alse
Q45-nameat tr
ibut
eof@Col
umnannot
ati
onper
mit
sthenameoft
hecol
umnt
obe
expl
i
cit
lyspeci
fi
ed.
A-t
rue
B-f
alse
Q46-Whi
choft
hef
oll
owi
ngi
str
ueaboutTr
ansact
ionobj
ecti
nhi
ber
nat
e?
A-ATr
ansact
ionr
epr
esent
sauni
tofwor
kwi
tht
hedat
abase.
B-Tr
ansact
ionsi
nHi
ber
nat
ear
ehandl
edbyanunder
lyi
ngt
ransact
ionmanager
.
C-Thisisanopt
ional
obj
ectandHibernat
eappl
icat
ionsmaychoosenott
ouset
his
i
nter
face,i
nst
eadmanagi
ngtransact
ionsi
nthei
rownappli
cat
ioncode.
D-Al
loft
heabov
e
Q47-Session.
beginTr
ansacti
onmet
hodbegi
nsauni
tofwor
kandr
etur
nst
he
associ
atedTr
ansacti
onobject
.
A-t
rue
B-f
alse
Q48-Whi
chel
ementofhbm.
xml
aut
omat
ical
l
ygener
atet
hepr
imar
ykeyv
alues?
A-i
d
B-gener
ator
C-pr
imar
yKey
D-Noneoft
heabov
e.
Q49-Whati
sthedi
ff
erencebet
weenget
()andl
oad(
)met
hodsofsessi
onobj
ect
?
A-get
()r
eturnsnul
lifnodat
ai spresentwhereasloadt
hrows
Obj
ect
NotFoundExcepti
onexcepti
oni nsuchcase.
B-get
()al
way
shi
tst
hedat
abasewher
easl
oad(
)met
hoddoesn'
thi
tthedat
abase.
C-get
()r
etur
nsact
ual
obj
ectwher
easl
oad(
)ret
urnspr
oxyobj
ect
.
D-Al
loft
heabov
e.
Q50-TheSessi
onFact
oryi
sheav
ywei
ghtobj
ect
.
A-f
alse
B-t
rue
Q51-Whi
choft
hef
oll
owi
ngi
str
ueaboutHQL?
A-Hi
ber
nat
eQuer
yLanguage(
HQL)i
sanobj
ect
-or
ient
edquer
ylanguage.
B-Insteadofoperat
ingont
abl
esandcol
umns,
HQLwor
kswi
thper
sist
entobj
ect
s
andtheirpr
opert
ies.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q52-Whi
choft
hef
oll
owi
ngi
str
ueaboutSessi
onFact
oryobj
ecti
nhi
ber
nat
e?
A-TheSessi
onFact
oryi
sheav
ywei
ghtobj
ect
.
B-Sessi
onFact
oryobj
ecti
scr
eat
eddur
ingappl
i
cat
ionst
artupandkeptf
orl
ateruse.
C-YouwouldneedoneSessi
onFact
oryobj
ectperdat
abaseusi
ngasepar
ate
conf
igur
ati
onf
il
e.
D-Al
loft
heabov
e.
Q53-Whi
choft
hef
oll
owi
ngsi
tuat
ionr
epr
esent
smany
-to-
manyr
elat
ionshi
p?
A-Anempl
oyeecanhav
emul
ti
plecer
ti
fi
cat
esandsamecer
ti
fi
cat
ecanbeconf
err
ed
t
omanyemployees.
B-Anempl
oyeecanhav
emul
ti
plecer
ti
fi
cat
es.
C-Acer
ti
fi
cat
ecanbeconf
err
edt
omanyempl
oyees.
D-Al
loft
heabov
e.
Q54-Whati
ssecondl
evel
cachei
nhi
ber
nat
e?
A-Thesecond-
lev
elcacheist
heSessi
onFactor
ybasedcacheandi
smai
nly
r
esponsi
blef
orcachi
ngobject
sacr
osssessions.
B-Thesecond-
lev
elcachei
stheSessi
onbasedcache.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q55-Whi
choft
hef
oll
owi
ngi
str
ueabout@Col
umnannot
ati
on?
A-The@Columnannot
ati
onisusedt
ospeci
fyt
hedet
ail
soft
hecol
umnt
owhi
cha
f
iel
dorpr
opert
ywil
lbemapped.
B-The@Col
umnannot
ati
oni
sappl
i
edonacl
ass.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q56-Whichoft
hef
oll
owi
ngobj
ecti
susedt
ocr
eat
eSessi
onFact
oryobj
ecti
n
hi
ber
nat
e?
A-Conf
igur
ati
on
B-Sessi
on
C-Sessi
onFact
ory
D-Tr
ansact
ion
Q57-Sessi
on.
creat
eQuer
ycr
eat
esanewi
nst
anceofQuer
yfort
hegi
venHQLquer
y
st
ri
ng.
A-t
rue
B-f
alse
Q58-Whi
choft
hef
oll
owi
ngi
str
ueabout<i
d>el
ement
?
A-The<id>el
ementmapst
heuni
queI
Dat
tri
but
eincl
asst
othepr
imar
ykeyoft
he
dat
abasetabl
e.
B-Thenameat
tri
but
eoft
hei
del
ementr
efer
stot
hepr
oper
tyi
nthecl
ass.
C-Thecol
umnat
tri
but
eoft
hei
del
ementr
efer
stot
hecol
umni
nthedat
abaset
abl
e.
D-Al
loft
heabov
e.
Q59-I
ssecondl
evel
cachi
ngmandat
oryi
nhi
ber
nat
e?
A-t
rue
B-f
alse
Q60-Whi
choft
hef
oll
owi
ngi
sacor
ecomponentofHi
ber
nat
e?
A-Tr
ansact
ion
B-Sessi
onFact
ory
C-Sessi
on
D-Al
loft
heabov
e
Q61-nameat tr
ibut
eof@Col
umnannot
ati
onper
mit
sthenameoft
hecol
umnt
obe
expl
i
cit
lyspeci
fi
ed.
A-t
rue
B-f
alse
Q62-Whi
choft
hef
oll
owi
ngi
str
ueabout<pr
oper
ty>el
ement
?
A-The<pr
oper
ty>el
ementi
susedt
omapaJav
acl
asspr
oper
tyt
oacol
umni
nthe
dat
abaset
abl
e.
B-Thenameat
tri
but
eoft
heel
ementr
efer
stot
hepr
oper
tyi
nthecl
ass.
C-Thecol
umnat
tri
but
eoft
heel
ementr
efer
stot
hecol
umni
nthedat
abaset
abl
e.
D-Al
loft
heabov
e.
Q63-Whi
choft
hef
oll
owi
ngi
str
ueabout@Ent
it
yannot
ati
on?
A-@Ent
it
yannot
ati
onmar
ksacl
assasanent
it
ybean.
B-Classmarkedwith@Entit
yannot
ati
onmusthav
eano-
argumentconst
ruct
ort
hat
i
svisi
blewi
thatleastpr
otect
edscope.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q64-Whi
choft
hef
oll
owi
ngi
str
ueaboutHi
ber
nat
e?
A-Hibernatet
akescar
eofmappingJav
acl
assest
odat
abaset
abl
esusi
ngXMLf
il
es
andwithoutwri
ti
nganyli
neofcode.
B-Hi
bernateprovi
dessimpl
eAPI
sforst
ori
ngandr
etr
iev
ingJav
aobj
ect
sdi
rect
lyt
o
andf
rom thedatabase.
C-Hi
ber
nateabstract
sawayt
heunf
ami
l
iarSQLt
ypesandpr
ovi
deust
owor
kar
ound
f
amil
i
arJav
aObj ects.
D-Al
loft
heabov
e.
Q65-Session.
beginTr
ansacti
onmet
hodbegi
nsauni
tofwor
kandr
etur
nst
he
associ
atedTr
ansacti
onobject
.
A-t
rue
B-f
alse
Q66-Whichel
ementofhbm.
xml
isusedt
omapaJav
acl
asspr
oper
tyt
oacol
umni
n
t
hedat
abasetabl
e?
A-i
d
B-gener
ator
C-pr
oper
ty
D-cl
ass
Q67-WhenaRead-
wri
teconcur
rencyst
rat
egyi
stobeused?
A-Usei
tforr
efer
encedat
aonl
y.
B-Uset hi
sstrat
egyforr
ead-
most
lydat
awher
eiti
scr
it
ical
topr
eventst
aledat
ain
concur
renttr
ansact
ions.
C-Usethisstr
ategyi
fdat
ahar
dlyev
erchangesandasmal
ll
ikel
i
hoodofst
aledat
ais
notofcr
it
ical
concern.
D-Noneoft
heabov
e.
Q68-Whi
choft
hef
oll
owi
ngi
str
ueabout<cl
ass>el
ement
?
A-The<class>el
ementsar
eusedt
odef
inespeci
fi
cmappi
ngsf
rom aJav
acl
asses
t
othedatabasetabl
es.
B-TheJav
acl
assnamei
sspeci
fi
edusi
ngt
henameat
tri
but
eoft
hecl
assel
ement
.
C-Thedat
abaset
abl
enamei
sspeci
fi
edusi
ngt
het
abl
eat
tri
but
eoft
hecl
ass
el
ement
.
D-Al
loft
heabov
e.
Q69-Whi
choft
hef
oll
owi
ngt
ool
s/f
ramewor
kspr
ovi
desi
ntegr
ati
onwi
thHi
ber
nat
e?
A-XDocl
etSpr
ing
B-J2EE
C-Mav
en
D-Al
loft
heabov
e.
Q70-Whi
choft
hef
oll
owi
ngel
ementmapsj
ava.
uti
l
.Col
l
ect
ionpr
oper
tyi
nhi
ber
nat
e?
A-<set
>
B-<l
i
st>
C-<bag>
D-<map>
Q71-Whi
choft
hef
oll
owi
ngi
str
ueaboutI
NSERTCLAUSEi
nHQL?
A-HQLsupportsI
NSERTINTOcl
auseonl
ywher
erecor
dscanbei
nser
tedf
rom one
obj
ectt
oanotherobj
ect
.
B-HQLsuppor
tsI
NSERTI
NTOcl
ausewi
thoutanyr
est
ri
cti
on.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q72-Whi
choft
hef
oll
owi
ngi
sther
ootnodeofhbm.
xml
fil
e?
A-hi
ber
nat
e-mappi
ng
B-hi
ber
nat
e-conf
ig
C-cl
ass-
mappi
ng
D-cl
ass-
conf
ig
Q1-WhatORM st
andsf
or?
A-Obj
ectRel
ati
onMap
B-Obj
ectRel
ati
onal
Mappi
ng
C-Obj
ectRecor
dMappi
ng
D-Noneoft
heabov
e.
Q2-Whi
choft
hef
oll
owi
ngi
str
ueaboutconf
igur
ati
oncomponentofHi
ber
nat
e?
A-TheConfi
gur
ati
onobj
ecti
sthef
ir
stHi
ber
nat
eobj
ecty
oucr
eat
einanyHi
ber
nat
e
appl
i
cat
ion.
B-TheConf
igur
ati
onobj
ecti
susual
l
ycr
eat
edonl
yoncedur
ingappl
i
cat
ioni
nit
ial
i
zat
ion.
C-TheConfi
gur
ati
onobj
ectr
epr
esent
saconf
igur
ati
onorpr
oper
ti
esf
il
erequi
redbyt
he
Hi
bernat
e.
D-Al
loft
heabov
e.
Q3-Sessi
on.
creat
eQuer
ycr
eat
esanewi
nst
anceofQuer
yfort
hegi
venHQLquer
y
st
ri
ng.
A-t
rue
B-f
alse
Q4-Whichel
ementofhbm.xmldefi
nesmapst
heuni
queI
Dat
tri
but
eincl
asst
othe
pr
imar
ykeyofthedat
abasetabl
e?
A-i
d
B-gener
ator
C-pr
imar
yKey
D-Noneoft
heabov
e.
Q5-Whi
choft
hef
oll
owi
ngel
ementmapsj
ava.
uti
l
.Sor
tedMappr
oper
tyi
nhi
ber
nat
e?
A-<set
>
B-<l
i
st>
C-<bag>
D-<map>
Q6-Whati
slazyl
oadi
ng?
A-Laz
yloadi
ngi
sat
echni
quei
nwhi
chobj
ect
sar
eloadedondemandbasi
s.
B-Lazyl
oadi
ngi
sat
echni
quei
nwhi
chobj
ect
sar
eper
sist
edondemandbasi
s.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q7-Whati
sfi
rstl
evel
cachei
nhi
ber
nat
e?
A-Thef
ir
st-
lev
elcachei
stheSessi
onbasedcache.
B-Thef
ir
st-
lev
elcachei
stheSessi
onFact
orybasedcache.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q8-WhenaTr
ansact
ional
concur
rencyst
rat
egyi
stobeused?
A-Usei
tforr
efer
encedat
aonl
y.
B-Uset hi
sstrat
egyforr
ead-
most
lydat
awher
eiti
scr
it
ical
topr
eventst
aledat
ain
concur
renttr
ansact
ions.
C-Usethisstr
ategyi
fdat
ahar
dlyev
erchangesandasmal
ll
ikel
i
hoodofst
aledat
ais
notofcr
it
ical
concern.
D-Noneoft
heabov
e.
Q9-Whi
choft
hef
oll
owi
ngi
sacor
ecomponentofHi
ber
nat
e?
A-Tr
ansact
ion
B-Sessi
onFact
ory
C-Sessi
on
D-Al
loft
heabov
e
Q10-Whi
choft
hef
oll
owi
ngi
str
ueabout@Gener
atedVal
ueannot
ati
on?
A-@Gener
atedVal
ueannot
ati
ont
akest
wopar
amet
ersst
rat
egyandgener
ator
.
B-@Gener
atedVal
ueannot
ati
onpr
ovi
dest
hepr
imar
ykeygener
ati
onst
rat
egyt
obeused.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q11-Whi
choft
hef
oll
owi
ngi
snotanORM f
ramewor
k?
A-Cast
or
B-Spr
ingDAO
C-Hi
ber
nat
e
D-NoSQL
Q12-Whi
choft
hef
oll
owi
ngi
str
ueaboutSessi
onFact
oryobj
ecti
nhi
ber
nat
e?
A-TheSessi
onFact
oryi
sheav
ywei
ghtobj
ect
.
B-Sessi
onFact
oryobj
ecti
scr
eat
eddur
ingappl
i
cat
ionst
artupandkeptf
orl
ateruse.
C-YouwouldneedoneSessi
onFact
oryobj
ectperdat
abaseusi
ngasepar
ate
conf
igur
ati
onf
il
e.
D-Al
loft
heabov
e.
Q13-Whi
choft
hef
oll
owi
ngi
str
ueaboutt
ransi
entst
ateofaper
sist
entent
it
y?
A-Anewi
nst
anceofaper
sist
entcl
asswhi
chi
snotassoci
atedwi
thaSessi
on.
B-Anewi
nst
anceofaper
sist
entcl
asswhi
chhasnor
epr
esent
ati
oni
nthedat
abase.
C-Anewi
nst
anceofaper
sist
entcl
asswhi
chhasnoi
dent
if
ierv
alue.
D-Al
loft
heabov
e.
Q14-Whi chmet
hodisusedt
ore-
readt
hest
ateoft
hegi
veni
nst
ancef
rom t
he
under
lyi
ngdat
abase?
A-Sessi
on.
ref
resh(
)
B-Sessi
on.
get
()
C-Sessi
on.
rel
oad(
)
D-Sessi
on.
ret
ri
eve(
)
Q15-Whi
choft
hef
oll
owi
ngel
ementmapsj
ava.
uti
l
.Li
stpr
oper
tyi
nhi
ber
nat
e?
A-<set
>
B-<l
i
st>
C-<bag>
D-<map>
Q16-Chil
dobj ectsarenotloadedwhenpar
enti
sloaded/
popul
atedf
rom dat
abase.
Whatt
histechniqueiscall
ed?
A-EagerLoadi
ng
B-LazyLoadi
ng
C-RequestbasedLoadi
ng
D-Noneoft
heabov
e.
Q17-WhatHQLst
andsf
or?
A-Hi
ber
nat
eQuer
yLanguage
B-Hi
ghQuer
yLanguage
C-Hy
bri
dQuer
yLanguage
D-Noneoft
heabov
e.
Q18-Whi
choft
hef
oll
owi
ngdat
abasei
snotsuppor
tedbyHi
ber
nat
e?
A-Or
acl
e
B-Mi
crosof
tSQLSer
verDat
abase
C-Foundat
ionDB
D-I
nfor
mixDy
nami
cSer
ver
Q19-ASessi
oni
susedt
ogetaphy
sical
connect
ionwi
thadat
abase.
A-t
rue
B-f
alse
Q20-Whi
choft
hef
oll
owi
ngi
str
ueaboutHQL?
A-Hi
ber
nat
esuppor
tsnamedpar
amet
ersi
nit
sHQLquer
ies.
B-HQLsuppor
tsar
angeofaggr
egat
emet
hods,
simi
l
art
oSQL.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q21-Whi
choft
hef
oll
owi
ngi
str
ueaboutHi
ber
nat
e?
A-Hi
ber
nat
eisanObj
ect
-Rel
ati
onal
Mappi
ng(
ORM)sol
uti
onf
orJAVA.
B-Hi
ber
nat
eisanObj
ect
-Rel
ati
onal
Mappi
ng(
ORM)sol
uti
onf
or.
NET
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q22-Whi chofthef
oll
owi
ngi
str
ueabouthi
ber
nat
e.di
alectpr
oper
tyi
nhi
ber
nat
e
conf
igur
ation?
A-Thispr
oper
tymakesHi
ber
nat
egener
atet
heappr
opr
iat
eSQLf
ort
hechosen
dat
abase.
B-Thi
sproper
tymakesHi
ber
nat
egener
atet
heappr
opr
iat
ejav
acodef
ort
hechosen
dat
abase.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q23-Whichmet
hodi
susedt
osav
ethest
ateoft
hegi
veni
nst
ancef
rom t
heunder
lyi
ng
dat
abase?
A-Sessi
on.
stor
e()
B-Sessi
on.
keep(
)
C-Sessi
on.
sav
e()
D-Sessi
on.
load(
)
Q24-Whi
choft
hef
oll
owi
ngel
ementmapsj
ava.
uti
l
.Mappr
oper
tyi
nhi
ber
nat
e?
A-<set
>
B-<l
i
st>
C-<bag>
D-<map>
Q25-Whati
sQuer
ylev
elcachei
nhi
ber
nat
e?
A-Thequer y
-l
evelcachei
scachef
orquer
yresul
tset
sthati
ntegr
atescl
osel
ywi
tht
he
second-
lev
elcache.
B-Thequer
y-l
evel
cachei
stheSessi
onbasedcache.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q26-Whi
choft
hef
oll
owi
ngi
saconcur
rencyst
rat
egi
esi
nhi
ber
nat
e?
A-Tr
ansact
ional
B-Read-
wri
te
C-Nonst
ri
ct-
read-
wri
te.
D-Al
loft
heabov
e.
Q27-Whi
choft
hef
oll
owi
ngi
str
ueabout@I
dannot
ati
on?
A-Hi
ber
nat
edet
ect
sthatt
he@I
dannot
ati
oni
sonaf
iel
d.
B-Hiber
nateassumest
hati
tshoul
daccesspr
oper
ti
esonanobj
ectdi
rect
lyt
hrough
f
iel
dsatrunt
ime.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q28-Whi
choft
hef
oll
owi
ngi
str
ueaboutHQL?
A-HQLqueriesar
etr
ansl
atedbyHi
ber
nat
eint
oconv
ent
ional
SQLquer
ieswhi
chi
ntur
ns
per
for
m act
ionondat
abase.
B-TheAScl
ausecanbeusedt
oassi
gnal
i
asest
othecl
assesi
nHQLquer
ies.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q29-Whi
choft
hef
oll
owi
ngi
str
ueaboutORM?
A-ORM st
andsf
orObj
ect
-Rel
ati
onal
Mappi
ng.
B-ORM i
sapr
ogr
ammi
ngt
echni
quef
orconv
ert
ingdat
abet
weenr
elat
ional
dat
abases.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q30-Whi
choft
hef
oll
owi
ngi
str
ueaboutQuer
yobj
ecti
nhi
ber
nat
e?
A-Queryobj
ect
sHiber
nateQuer
yLanguage(
HQL)st
ri
ngt
oret
ri
evedat
afr
om t
he
dat
abaseandcr
eat
eobjects.
B-Quer
yobj
ect
sSQLst
ri
ngt
oret
ri
evedat
afr
om t
hedat
abaseandcr
eat
eobj
ect
s.
C-AQueryi
nst
anceisusedtobindquerypar
ameter
s,l
imi
tthenumberofr
esul
ts
r
etur
nedbyt
hequery
, andf
inal
l
yt oexecut
ethequer
y.
D-Al
loft
heabov
e.
Q31-Sessi
on.
creat
eSQLQuer
ycr
eat
esanewi
nst
anceofQuer
yfort
hegi
venSQLquer
y
st
ri
ng.
A-t
rue
B-f
alse
Q32-Whi
chmet
hodi
susedt
ogetaper
sist
enti
nst
ancef
rom t
hedat
ast
ore?
A-Sessi
on.
read(
)
B-Sessi
on.
get
()
C-Sessi
on.
ret
ri
eve(
)
D-Sessi
on.
fet
ch(
)
Q33-Whi
choft
hef
oll
owi
ngi
str
ueabout<gener
ator
>el
ement
?
A-The<generat
or>el
ementwi
thi
nthei
del
ementi
susedt
oaut
omat
ical
l
ygener
atet
he
pr
imar
ykeyv al
ues
B-Sett heclassattr
ibut
eofthegenerat
orel
ementissettonat
ivet
olethibernat
epi
ck
upeitheridenti
ty,
sequenceorhi
loalgor
it
hm t
ocreatepri
marykeydependingupont
he
capabil
iti
esoftheunderlyi
ngdat
abase.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q34-Whi
choft
hef
oll
owi
ngel
ementi
susedt
orepr
esentone-
to-
manyr
elat
ionshi
pin
hi
ber
nat
e?
A-<one-
to-
many
>
B-<one-
many
>
C-<OneToMany
>
D-Noneoft
heabov
e.
Q35-I
squer
ylev
elcachi
ngmandat
oryi
nhi
ber
nat
e?
A-t
rue
B-f
alse
Q36-WhenaRead-
onl
yconcur
rencyst
rat
egyi
stobeused?
A-Usei
tforr
efer
encedat
aonl
y.
B-Uset hi
sstrat
egyforr
ead-
most
lydat
awher
eiti
scr
it
ical
topr
eventst
aledat
ain
concur
renttr
ansact
ions.
C-Usethisstr
ategyi
fdat
ahar
dlyev
erchangesandasmal
ll
ikel
i
hoodofst
aledat
ais
notofcr
it
ical
concern.
D-Noneoft
heabov
e.
Q37-Whi
choft
hef
oll
owi
ngi
str
ueabouthi
ber
nat
eannot
ati
ons?
A-Hiber
nateAnnot
ati
onsist
hepower
ful
wayt
opr
ovi
det
hemet
adat
afort
heObj
ectand
Rel
ati
onalTabl
emapping.
B-Allt
hemetadat
aiscl
ubbedi
ntothePOJOj
avaf
il
eal
ongwi t
hthecodethi
shel
psthe
usert
ounder
standthet
abl
estr
uctur
eandPOJOsi
mult
aneousl
yduri
ngthedevel
opment.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q38-Whi
choft
hef
oll
owi
ngi
snotacor
ecomponentofHi
ber
nat
e?
A-JDBC
B-Sessi
onFact
ory
C-Sessi
on
D-Conf
igur
ati
on
Q39-I
sSessi
onat
hread-
saf
eobj
ect
?
A-t
rue
B-f
alse
Q40-Whi
chmet
hodi
susedt
oremov
eaper
sist
enti
nst
ancef
rom t
hedat
ast
ore?
A-Sessi
on.
del
ete(
)
B-Sessi
on.
remov
e()
C-Sessi
on.
del
()
D-Sessi
on.
rm(
)
Q41-Whi chmethodisusedt
osav
eorupdat
ethest
ateoft
hegi
veni
nst
ancef
rom t
he
under
lyi
ngdatabase?
A-Sessi
on.
sav
eOr
Updat
e()
B-Sessi
on.
keep(
)
C-Sessi
on.
updat
e()
D-Sessi
on.
load(
)
Q42-I
sfi
rstl
evel
cachi
ngmandat
oryi
nhi
ber
nat
e?
A-t
rue
B-f
alse
Q43-Whi
choft
hef
oll
owi
ngdat
abasei
ssuppor
tedbyHi
ber
nat
e?
A-DB2/
NT
B-Post
greSQL
C-Sy
baseSQLSer
ver
D-Al
loft
heabov
e
Q44-Conf
igur
ati
onobj
ecti
susedt
ocr
eat
eSessi
onFact
oryobj
ecti
nhi
ber
nat
e.
A-t
rue
B-f
alse
Q45-nameat tr
ibut
eof@Col
umnannot
ati
onper
mit
sthenameoft
hecol
umnt
obe
expl
i
cit
lyspeci
fi
ed.
A-t
rue
B-f
alse
Q46-Whi
choft
hef
oll
owi
ngi
str
ueaboutTr
ansact
ionobj
ecti
nhi
ber
nat
e?
A-ATr
ansact
ionr
epr
esent
sauni
tofwor
kwi
tht
hedat
abase.
B-Tr
ansact
ionsi
nHi
ber
nat
ear
ehandl
edbyanunder
lyi
ngt
ransact
ionmanager
.
C-Thisisanopt
ional
obj
ectandHibernat
eappl
icat
ionsmaychoosenott
ouset
his
i
nter
face,i
nst
eadmanagi
ngtransact
ionsi
nthei
rownappli
cat
ioncode.
D-Al
loft
heabov
e
Q47-Session.
beginTr
ansacti
onmet
hodbegi
nsauni
tofwor
kandr
etur
nst
he
associ
atedTr
ansacti
onobject
.
A-t
rue
B-f
alse
Q48-Whi
chel
ementofhbm.
xml
aut
omat
ical
l
ygener
atet
hepr
imar
ykeyv
alues?
A-i
d
B-gener
ator
C-pr
imar
yKey
D-Noneoft
heabov
e.
Q49-Whati
sthedi
ff
erencebet
weenget
()andl
oad(
)met
hodsofsessi
onobj
ect
?
A-get
()r
eturnsnul
lifnodataispresentwhereasloadt
hrows
Obj
ect
NotFoundExcepti
onexcepti
oni nsuchcase.
B-get
()al
way
shi
tst
hedat
abasewher
easl
oad(
)met
hoddoesn'
thi
tthedat
abase.
C-get
()r
etur
nsact
ual
obj
ectwher
easl
oad(
)ret
urnspr
oxyobj
ect
.
D-Al
loft
heabov
e.
Q50-TheSessi
onFact
oryi
sheav
ywei
ghtobj
ect
.
A-f
alse
B-t
rue
Q51-Whi
choft
hef
oll
owi
ngi
str
ueaboutHQL?
A-Hi
ber
nat
eQuer
yLanguage(
HQL)i
sanobj
ect
-or
ient
edquer
ylanguage.
B-I
nst
eadofoper
ati
ngont
abl
esandcol
umns,
HQLwor
kswi
thper
sist
entobj
ect
sand
t
hei
rpr
oper
ti
es.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q52-Whi
choft
hef
oll
owi
ngi
str
ueaboutSessi
onFact
oryobj
ecti
nhi
ber
nat
e?
A-TheSessi
onFact
oryi
sheav
ywei
ghtobj
ect
.
B-Sessi
onFact
oryobj
ecti
scr
eat
eddur
ingappl
i
cat
ionst
artupandkeptf
orl
ateruse.
C-YouwouldneedoneSessi
onFact
oryobj
ectperdat
abaseusi
ngasepar
ate
conf
igur
ati
onf
il
e.
D-Al
loft
heabov
e.
Q53-Whi
choft
hef
oll
owi
ngsi
tuat
ionr
epr
esent
smany
-to-
manyr
elat
ionshi
p?
A-Anempl
oyeecanhav
emul
ti
plecer
ti
fi
cat
esandsamecer
ti
fi
cat
ecanbeconf
err
edt
o
manyempl
oyees.
B-Anempl
oyeecanhav
emul
ti
plecer
ti
fi
cat
es.
C-Acer
ti
fi
cat
ecanbeconf
err
edt
omanyempl
oyees.
D-Al
loft
heabov
e.
Q54-Whati
ssecondl
evel
cachei
nhi
ber
nat
e?
A-Thesecond-l
evelcacheistheSessionFact
orybasedcacheandi
smai
nlyr
esponsi
ble
f
orcachi
ngobjectsacrosssessions.
B-Thesecond-
lev
elcachei
stheSessi
onbasedcache.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q55-Whi
choft
hef
oll
owi
ngi
str
ueabout@Col
umnannot
ati
on?
A-The@Columnannotat
ioni
susedt
ospeci
fyt
hedet
ail
soft
hecol
umnt
owhi
chaf
iel
d
orpr
oper
tywil
lbemapped.
B-The@Col
umnannot
ati
oni
sappl
i
edonacl
ass.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q56-Whi
choft
hef
oll
owi
ngobj
ecti
susedt
ocr
eat
eSessi
onFact
oryobj
ecti
nhi
ber
nat
e?
A-Conf
igur
ati
on
B-Sessi
on
C-Sessi
onFact
ory
D-Tr
ansact
ion
Q57-Sessi
on.
creat
eQuer
ycr
eat
esanewi
nst
anceofQuer
yfort
hegi
venHQLquer
y
st
ri
ng.
A-t
rue
B-f
alse
Q58-Whi
choft
hef
oll
owi
ngi
str
ueabout<i
d>el
ement
?
A-The<id>el
ementmapst
heuni
queI
Dat
tri
but
eincl
asst
othepr
imar
ykeyoft
he
dat
abasetabl
e.
B-Thenameat
tri
but
eoft
hei
del
ementr
efer
stot
hepr
oper
tyi
nthecl
ass.
C-Thecol
umnat
tri
but
eoft
hei
del
ementr
efer
stot
hecol
umni
nthedat
abaset
abl
e.
D-Al
loft
heabov
e.
Q59-I
ssecondl
evel
cachi
ngmandat
oryi
nhi
ber
nat
e?
A-t
rue
B-f
alse
Q60-Whi
choft
hef
oll
owi
ngi
sacor
ecomponentofHi
ber
nat
e?
A-Tr
ansact
ion
B-Sessi
onFact
ory
C-Sessi
on
D-Al
loft
heabov
e
Q61-nameat
tri
but
eof@Col
umnannot
ati
onper
mit
sthenameoft
hecol
umnt
obe
expl
i
cit
lyspeci
fi
ed.
A-t
rue
B-f
alse
Q62-Whi
choft
hef
oll
owi
ngi
str
ueabout<pr
oper
ty>el
ement
?
A-The<pr
oper
ty>el
ementi
susedt
omapaJav
acl
asspr
oper
tyt
oacol
umni
nthe
dat
abaset
abl
e.
B-Thenameat
tri
but
eoft
heel
ementr
efer
stot
hepr
oper
tyi
nthecl
ass.
C-Thecol
umnat
tri
but
eoft
heel
ementr
efer
stot
hecol
umni
nthedat
abaset
abl
e.
D-Al
loft
heabov
e.
Q63-Whi
choft
hef
oll
owi
ngi
str
ueabout@Ent
it
yannot
ati
on?
A-@Ent
it
yannot
ati
onmar
ksacl
assasanent
it
ybean.
B-Classmar
kedwi th@Enti
tyannot
ati
onmusthav
eano-
argumentconst
ruct
ort
hati
s
vi
sibl
ewit
hatleastprot
ect
edscope.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q64-Whi
choft
hef
oll
owi
ngi
str
ueaboutHi
ber
nat
e?
A-Hibernatet
akescar
eofmappingJav
acl
assest
odat
abaset
abl
esusi
ngXMLf
il
es
andwithoutwri
ti
nganyli
neofcode.
B-Hibernat
epr ovi
dessi
mpl
eAPI
sforst
ori
ngandr
etr
iev
ingJav
aobj
ect
sdi
rect
lyt
oand
f
rom thedatabase.
C-Hi
ber
nateabstract
sawayt
heunf
ami
l
iarSQLt
ypesandpr
ovi
deust
owor
kar
ound
f
amil
i
arJav
aObj ects.
D-Al
loft
heabov
e.
Q65-Session.
beginTr
ansacti
onmet
hodbegi
nsauni
tofwor
kandr
etur
nst
he
associ
atedTr
ansacti
onobject
.
A-t
rue
B-f
alse
Q66-Whichel
ementofhbm.
xml
isusedt
omapaJav
acl
asspr
oper
tyt
oacol
umni
n
t
hedat
abasetabl
e?
A-i
d
B-gener
ator
C-pr
oper
ty
D-cl
ass
Q67-WhenaRead-
wri
teconcur
rencyst
rat
egyi
stobeused?
A-Usei
tforr
efer
encedat
aonl
y.
B-Uset hi
sstrat
egyforr
ead-
most
lydat
awher
eiti
scr
it
ical
topr
eventst
aledat
ain
concur
renttr
ansact
ions.
C-Usethisstr
ategyi
fdat
ahar
dlyev
erchangesandasmal
ll
ikel
i
hoodofst
aledat
ais
notofcr
it
ical
concern.
D-Noneoft
heabov
e.
Q68-Whi
choft
hef
oll
owi
ngi
str
ueabout<cl
ass>el
ement
?
A-The<class>el
ement
sar
eusedt
odef
inespeci
fi
cmappi
ngsf
rom aJav
acl
assest
o
t
hedatabasetabl
es.
B-TheJav
acl
assnamei
sspeci
fi
edusi
ngt
henameat
tri
but
eoft
hecl
assel
ement
.
C-Thedat
abaset
abl
enamei
sspeci
fi
edusi
ngt
het
abl
eat
tri
but
eoft
hecl
assel
ement
.
D-Al
loft
heabov
e.
Q69-Whi
choft
hef
oll
owi
ngt
ool
s/f
ramewor
kspr
ovi
desi
ntegr
ati
onwi
thHi
ber
nat
e?
A-XDocl
etSpr
ing
B-J2EE
C-Mav
en
D-Al
loft
heabov
e.
Q70-Whi
choft
hef
oll
owi
ngel
ementmapsj
ava.
uti
l
.Col
l
ect
ionpr
oper
tyi
nhi
ber
nat
e?
A-<set
>
B-<l
i
st>
C-<bag>
D-<map>
Q71-Whi
choft
hef
oll
owi
ngi
str
ueaboutI
NSERTCLAUSEi
nHQL?
A-HQLsupportsI
NSERTINTOcl
auseonl
ywher
erecor
dscanbei
nser
tedf
rom one
obj
ectt
oanotherobj
ect
.
B-HQLsuppor
tsI
NSERTI
NTOcl
ausewi
thoutanyr
est
ri
cti
on.
C-Bot
hoft
heabov
e.
D-Noneoft
heabov
e.
Q72-Whi
choft
hef
oll
owi
ngi
sther
ootnodeofhbm.
xml
fil
e?
A-hi
ber
nat
e-mappi
ng
B-hi
ber
nat
e-conf
ig
C-cl
ass-
mappi
ng
D-cl
ass-
conf
ig
1) In Spring AOP, the process of linking aspect with other application types or objects to create an advice
object is called ---------Weaving
4) Can you inject null and empty string values in Spring? -----yes
15) Element which can be used to inject a collection of name-value pairs where the name and the value can
be of any type.
a)<list>
b)<set>
c)<map>
d)<props>
16)Element which can be used to inject a collection of name-value pairs where the name and the value are
both Strings type.
a)<list>
b)<set>
c)<map>
d)<props>
24)ORM stands for Object-Relational Mapping (ORM) is a programming technique for converting data
between relational databases.-----------True
25)What is the difference between save() and persist() methods of session object?
A) There is no difference.
B)save saves the object and returns status whereas persist stores status in different variable.
C)save saves the object and returns the id of the instance whereas persist do not return anything
after saving the instance.
D)None of the above.
27)JDBC, ORM, OXM, JMS, Transactions are the modules of Data Access/ Integration layer.------True
35) The central artifact in spring javaConfig is the @Configuration annotated class?-----True
44)Different types of run advice "before" and "after" the advised method is invoked. Which of the
following is the correct option with respect to advice?
a.After returning
b.None
c.After throwing
d.around
45)HQL- easily stores, update and retrieve from the database--------- True
48) When we work with an object oriented system, there is mismatch between the object model and the
relational database State True or False
a) TRUE
b) FALSE
50) Form fields are validated using user defined validations class by implementing validation interface
State True or False.-------True
51) Spring does not separate three modules like presentation layer, business layer and data access layer
State True or False.-------False
52) Pick odd one out in the following annotations ( invalid annotations)
I.@PathValid II.@responsevalid
III.@Controller IV.@requestMapping
53) Length returns number of rows in a column for only string type.-------True
54) Which level cache implements a cache for query result sets
a.Third level cache
b.Second level cache
c.First level cache
d. Fourth level cache
62) The same XSD of BeanFactory can be used for View resolver interface?
State True or False
a) TRUE
b) FALSE
A) This event is published when the Servlet Context is either initialized or refreshed.
B)This event is published when the ApplicationContext is stopped using the stop() method on the
ConfigurableApplicationContext interface.
C)This event is published when the HTTP Request is received.
D)This event is published when the HTTP Response is returned.
65)XsltViewResolver-supports XsltView by resolving the view name of which of the following options
a) all of the listed options
b)VelocityView and its subclasses
c)URL of xslt
d)view name of the URL of the report file.
66) Spring MVC provides predefined templates for JDBC, Hibernate and JPA.---------True
67) ApplicationContext implements which of the following interface that is used to obtain localized
messages, with the actual implementation being pluggable
I. MessageSource
II. RequestMapping
a. only I
b.only II
c. Neither I or II
d. Both I and II
68) Which of the following are the best practices for writing spring XML Configurations?
a.Using consistent naming conventions
b. Rarely use classpath
c.Mentioning version numbers in schema references
d.reuse bean definitions as much as possible
69) To validate the form fields you need to have a separate UserValidator class that implements the
validator interface, Override the validate() method perform all the validations.---------True
70) Which of the listed options are TRUE for Bean configuration inheritance?
I. In spring, Inheritance is supported in bean configuration to share common values, properties or
configurations
II. A child bean or inherited bean can inherit its parent bean configurations, properties and some attributes
III. The parent bean allow to override the inherited values
71) which of the following options about Auto wiring in spring are correct?
I. The Auto wiring in spring framework can be performed by configuring in xml and spring Auto-Wiring
with Annotation @Autowired
II. Auto-wiring beans with xml configuration: In Spring framework, you can wire beans automatically with
auto wiring feature
III. To enable auto-wiring just define the "autowire" attribute in <bean> tag.
73) Which of the following explains about addClass function in the listed options(doubt)
I. This function translates a Java class name into file name
II. This translated file name is then loaded as an input stream from the java class loader
III. This addClass function is important if you want efficient usage of classes in your code
74) The application is designed around an object model. The SQL code is generated at build time and the
associations between objects are supported by the persistent mechanism, and queries are specified using an
object oriented expression language. This best suited for medium-sized applications with some complex
transactions. Used when the mappping exceeds 25 different databse products at a time.
78) The Spring MVC pattern does not separate the different aspects of the application into input logic,
business logic, and UI logic.-------------------false
80) Given the Spring configuration file, which are the correct statements?
<bean class="com.spring.service.BankServiceImpl"
p:bankName="NationalBank">
</bean>
a) The p namespace has to be declared
b) Bean id is bankServiceImpl
c) The BankServiceImpl references a NationalBank bean
d) NationalBank is a scalar value
82) Using the Spring AOP framework, what are the joinpoint methods of the following pointcut
expressions?
execution(public * *(..))
a) The execution of all public method
b) The execution of all public method returning a value
c) The execution of all public method having at least one parameter
d) The execution of all public method in class belonging to the default java package
83) What is the transaction behavior of the PROPAGATION_REQUIRES_NEW model? Select a unique
answer.
a) If a transaction exists, the current method should run within this transaction. Otherwise, it
should start a new transaction and run within its own transaction.
b) If a transaction is in progress, the current method should run within the nested transaction
of the existing transaction. Otherwise, a new transaction has to be started and run within its
own transaction.
c) The current method must start a new transaction and run within its own transaction. If there is an
existing transaction in progress, it is suspended.
d) None of the above
85) Which scope is a single bean definition to have any number of object instances ? -----prototype
86) Which annotation is used in setter? which type of annotation applies to bean property setter methods
select one
a)@Requires
b)@Resource
c)@Required
d)@Requiring
89) Cache enables the database to hit as much as possible for better performance in critical applications.----
------True
90) View Resolver provides a mapping between view names and actual views.-----------True
91) Which one interpret user input and transform it into a model that is represented to the user by the view.
a) controller
b) dispatcher servlet
c) model
d) browser
92) Assuming @Transactional annotation support is enabled and the transferMoney method is called
through a Spring AOP proxy, what is the behavior of the following code sample?
@Transactional(propagation=Propagation.REQUIRED)
public void transferMoney(Account src, Account target, double amount) {
add(src, -amount);
add(src, amount);
}
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void add(Account account, Double amount) {
// IMPLEMENTATION
}
a) The add() method executes code in a new transaction
b) The add() method uses the transaction of the transferMoney() method
c) When calling the add() method, an exception is thrown
d) Other behavior
93) Application contexts can publish events to beans that are registered as listeners.--------true
98) Hibernate helps in mapping of java objects with database tables ---------------true
99) Which of the following are mandatory rules to create validation for a normal employee table?
a.The "empNum" cant be empty
b."Name" cant be empty
c.The "empNum" cant be less than 1
d.All of the option
100) Which of the following allows as to add a new method or attributes to existing classes?
a.Introduction
b.Proxy
c.Weaving
d.Auto call
111. Length attribute of @column annotation permits the size of the column used to map a value
particularly for a string value.--------true
116.In spring MVC each tag provides support to the set of attributes of its corresponding HTML tag
counterpart making the tags familiar & intuitive to use----------------True
117.We can use index and type attribute together-----------true
120.Which is the query language that embodies a very powerful and flexible mechanism to query, store,
update and retrive
objects from a database?
a.PLSQL
b.RDBMS
c.SQL
d.HQL
122.When you need to upload a large number of records into your database using Hibernate, you can use
batch processing.------true
123.Implementation of viewResolver accets a configuration file written in XML with the same DTD as
spring XML bean factories.---------true
124.For a fast Development, the dependency injection feature of spring Framework &support to various
Frameworks makes the easy development of javaEE application.-------true
125.In hibernate implement cache for a query ,if the result sets can integrate closely,which level
of the cache can be implemented?
a.first level cache
b.second level cache
c.third level cache
d.Fourth level cache
126.In Spring MVC which of the following is the front controller class that initializes the context
based on the spring beans configuration?
a.org.springframework.web.servlet.DispatcherServlet
b.org.springframework.web.context.DispatcherServlet
c.org.springframework.web.servlet
d.org.springframework.web.context.ApplicationContext
128.In spring bean configuration bean atribute called 'scope' defines what kind of object
has to be created and returned. What returns a new bean instance each time when required?
a.Prototype
b.Session
c.Singleton
d.Global session
129. Which of the following is true about Hibernate?
A) Hibernate takes care of mapping Java classes to database tables using XML files and without writing
any line of code.
B)Hibernate provides simple APIs for storing and retrieving Java objects directly to and from the database.
C)Hibernate abstracts away the unfamiliar SQL types and provide us to work around familiar Java Objects.
D)All of the above.
130.Spring MVC provides a JSP tag library(Spring form) for making it easier to bind form elements to
model data.-------True
132. Spring MVC provides better way to separate which of the following?
a.Presentation
b.Tools
c.Data Access
d.Bussiness Logic(not sure)
134.The Model-View-Controller(MVC) is an architectural pattern that does not separate an application into
three main logical compponents: the model,the view and the controller.------false
135. How many layers are there in Hibernate architecture
a)3
b)4
c)5
d)2
136. Which tool helps to generate the mapping document Though many Hibernate users choose to write the
XML by hand
select one
a)oldgen
b)younggen
c)Middlegen
d) Mediumgen
137. Java based configuration option disables you to write most of your Spring configuration without XML
but with the help of few Java-based annotations ----------------False
138. What types of views supported by spring MVC for different presentation technologies
select one or more
a)JSP
b)HTML
c)velocity templates
d) all
140. A very powerful and high performance qurerying language used to Query,retrive,store data in DB is
select one
a)PLSQL
b)HQL
c)SQL
d)RDBMS
151. Spring Web MVC (and in Spring in general) is the "Open for extension, closed for modification"
principle.
The reason that this principle is being mentioned here is because a number of methods in the core classes in
Spring Web MVC are marked final.
a. true
b. false
152. Which of the among is not a special bean in WebApplicationContext?
a. Locale resolver
b. Theme resolver
c. multipart file
d. resolver
e. Handler exception resolver
f. Handler mappings
g. None of the above
153. How the Spring DispatcherServlet supports for returning the last-modification-date, as specified by
the Servlet API ?
154. WebApplicationContext has more scopes like request, session, globalSession to the standard
Application context (which only provides Singleton and Prototype scopes)-----------true
157. Which of the following controller inspects the URL and retrieves the filename of the file request and
uses that as a viewname ?For example, the filename of http://www.springframework.org/welcome.html
request is welcome.
a. UrlFilenameViewController
b. MultiActionMultiActionController
c. CommandController
d. AbstractController
a)A design pattern where dependent objects are defined in an xml for easy maintainability.
b)This is a design pattern whereby dependent objects are passed into an object from the
outside at the time application is initialized.
c)A unique feature of spring which allows object to be injected at the time of compilation.
@RequestMapping("/basket")
@Controller
public class Shopping {
@RequestMapping("/{id}")
public String doCheckOut(@PathVariable Date time) {
return "home";
}
}
Is declaration of Shopping#doCheckOut method correct?------------TRUE
164. If you were using Join Points, Pointcuts & Advice what would you be using?
a)Bean Contatiner
b)JPA
c)EJB
d)AOP
167. Spring 3.0 provides the PropertyEditor for performing thread-safe type conversion. This allows any
Type to be converted to any other Type.-------------FALSE
/WEB-INF/application-context.xml
/dispatcher-servlet.xml
/WEB-INF/dispatcher-servlet.xml
173. Which of the following tag is used to enable Aspect using XML configuration?
a)<aop:aspectj-autoproxy/>
b)<aop:aspectj-component/>
c)<aop:aspectj/>
d)<aop:aspectj-autoproxy-component-scan/>
175. Which of the following are valid return types, or values, from a controller implementation?
a)null
b)A String view name
c)void
d)All of the above
177. In Spring's form tag library which of the following tags are valid?
a) input and inputs
b) checkbox and checkboxes
c) radiobutton and radiobuttons
d) redirect
Solution
checkbox and checkboxes are valid spring tags.
radiobutton and radiobuttons are valid spring tags.
input is valid spring tag but inputs is not a valid spring tag.
178. If you want to provide the MessageSource functionality to application, providing access to messages
in i18n-style in your application. Which one should be used?
a) ApplicationContext
b) Property File
c) Servlet Context
182. What is the security annotation used in spring? (@autowire, @transicible ,……)
Ans :@PreAuthorize and @PostAuthorize
185. What are the things mapped in an XML? (Data type, value ,….)
186. Describe Global and Local transactions in Spring.
Ans: Global transactions help to work with multiple transactional resources like relational database and
message queue.
Global transactions are managed through JTA and JNDI. Local transactions are resource-specific like
JDBC connection.
Local Transactions can work with multiple transactional resources.
192.Name attribute of @Column annotation permits the name of the column to be explicitly specified.
a) true
b) false
193. which of the following Allows you to add new methods or attributes to existing classes?
a.Advice
b.Join point
c.Aspect
d.Pointcut
e.Target object
f.Weaving
g.Introduction
200. Beans, Core, Context, SpEL are the modules of core container.
a) true
b) false
203. Run advice before and after the advised method is invoked.
ans. around advice
204. Length attribute of @Column annotation permits the size of the column used to map a value
particularly for a String value.
A) false
B )true
209. Given the following Spring configuration file, what is the correct answer:
<bean class="com.spring.service.MyServiceImpl">
<property name="repository" ref="jpaDao"/>
</bean>
<bean class="com.spring.repository.JpaDao"/>
i. The first declared bean MyServiceImpl is missing an id must be named
myService
ii. The second declared bean JpaDao is missing an id must be named
jpaDao
iii. Answers 1 and 2 are both rights
iv. Answers 1 and 2 are both wrong
220. which of the following are the concerns which are needed in almost every module of an application
a)logging
b)security
c)data transfer
221. Hibernate is the open object relational mapping tool for java.
a)true
b)false
225. In Spring MVC which of the following is the front controller class that initializes the context based
on the spring beans configuration?
a)org.springframework.web.servlet.DispatcherServlet
b)org.springframework.web.context.DispatcherServlet
c)org.springframework.web.servlet
d)org.springframework.web.context.ApplicationContext
226. The central artefact in spring javConfig is the @Configuratuion annotated class?State True or False
a) TRUE
b) FALSE
231. In spring MVC each tag provides support to the set of attributes of its corresponding HTML tag
counterpart making the tags familiar & intuitive to use. State true or False.
a) True
b) false
234. Length returns number of rows in a column for only string type
a). TRUE
b). FALSE
235. The view interface inhibits the preparation of request and hands the request over to one of the view
technologies in spring. State true or false
a)true
b)false
236. The data required for the request is in which part of spring MVC component?
a)model
b)view
c)controller
d)all
240. To use Hibernate for multiple databases, Configure multiple sessionFactory instances. State True or
False.
a) True
b) False
242.Which scope is a single bean definition to have any number of object instances
Prototype
243. @RequestMapping annotation is used to map a URL either an entire class or to particular handler
method
a) True b) False
245. which of the following method returns the root element of the document in DOM parsing?
a) Node.getFirstChild
b) Node.getLastChild
c) Document.getDocumentElement
d) Node.getRoot
247. Element which can be used to inject a collection of name-value pairs where the name and the value
are both Strings type.
a)<list>
b)<set>
c)<map>
d)<props>
253. In how many ways, objects can be fetched from database in hibernate?
Hibernate provides following four ways to fetch objects from database:
a. Using HQL
b. Using identifier
c. Using Criteria API
d. Using Standard SQL
254.You would need one session factory object per database using a separate config file.
a) TRUE
b) FALSE
258. does sessionLocaleResolver interceptor detects if a special parameter is present in current Http req?
No
259. Which of the following are true about ‘clean' maven life cycle
a.used to build the application
b.generates site documentaion for the project
c.cleans up artefacts created by prior builds
d.none
261. Which clause allows you to narrow the list of instances returned?
a) Aggregate function
b) Where clause
c) Select clause
d) joins
b) FALSE
263. Which of the following great future if you can manage in long term?
A) constructor injection
B) schema mapping
C) classpath prefix
D) autowiring
264. Session.beginTransaction method begins a unit of work and returns the associated Transaction object.
A) true
B)false
265. How many bean scopes are specified in singleton by default?
a.6
b.7
c.5
d.none
266. Hibernate inhibits you to express queries in its own portable SQL extension (HQL)as well as in native
SQL ,or with an object oriented criteria
a)true
b)False
267. Tags generated by form tag lib are compliant with xhtml-1.0 strict specification and attendant dtd.
a) True
b) false
268. Archetype is a maven plugin whose task is to create a project structure as per its template
c) True
d) false
271. Named queries are created via which level of annotations on entities?
a.all-level
b.high-level
c.low
d.class level
273. What is the difference between get() and load() methods of session object?
A) get() returns null if no data is present where as load throws ObjectNotFoundException exception in such
case.
B)get() always hits the database whereas load() method doesn't hit the database.
C)get() returns actual object whereas load() returns proxy object.
D)All of the above.
274. The test module supports the testing of spring components with junit for testing
a) True
b) false
275. In controller which is responsible for rendering the page in spring mvc(not sure)
a.browser
b.http
c.database
d.application
281.The Spring MVC pattern does not separate the different aspects of the application into input logic,
business logic, and UI logic.
a) true
b) false
287. Using the Spring AOP framework, what are the joinpoint methods of the following pointcut
expressions?
execution(public * *(..))
a. The execution of all public method
b. The execution of all public method returning a value
c. The execution of all public method having at least one parameter
d. The execution of all public method in class belonging to the default java package
288. Identify the annotation which simply indicates that the affected bean property must be populated at
configuration time, through an explicit property value in a bean definition or through autowiring. The
container throws BeanInitializationException if the affected bean property has not been populated.
@Required
291 Session.createQuery creates a new instance of Query for the given HQL query string.
A) True
B)False
292. Which element of hbm.xml defines maps the unique ID attribute in class to the primary key of the
database table?
A) Id
B)Generator
C)Primary Key
D)None of the above.
301. Which of the following is true about transient state of a persistent entity?
A) A new instance of a persistent class which is not associated with a Session
B)A new instance of a persistent class which has no representation in the database.
C)A new instance of a persistent class which has no identifier value.
D)All of the above.
302. Which method is used to re-read the state of the given instance from the underlying database?
A) Session.refresh()
B)Session.get()
C)Session.reload()
D)Session.retrieve()
304. Child objects are not loaded when parent is loaded/populated from database. What this technique is
called?
A) Eager Loading
B)Lazy Loading
C)Request based Loading
D)None of the above.
306. Form tags are available in springs is more compatible with html tags for better development
State True or False
a) true
b) false
309. Which of the following is true about hibernate. Dialect property in hibernate configuration?
A) This property makes Hibernate generate the appropriate SQL for the chosen database.
B)This property makes Hibernate generate the appropriate java code for the chosen database.
C)Both of the above.
D)None of the above.
310. Which method is used to save the state of the given instance from the underlying database?
A) Session. Store ()
B)Session. Keep ()
C)Session. Save ()
D)Session. Load ()
312. Configure single sessionFactory per database, using separate configuration file.
a) True
b) False
322. Which of the following object is used to create SessionFactory object in hibernate?
A) Configuration
B)Session
C)SessionFactory
D)Transaction
326. Which of the following class can be used to execute Sql queries in spring?
A)JdbcTemplate
B) JDBCHelper
C)DBHelper
D)DBTemplate
335. Which class is used to map a database row to a java object in spring?
A) ResultSet
B)RowMapper
C)RowSetMapper
D)ResultSetMapper
342. Expression Language/ SpEL was introduced in which version of spring framework.
A) 1.0
B)2.0
C)3.0
D)4.0
343. What are the main advantage(s) for using Spring when writing integration tests?
a) Reuse Spring configuration files of the application
b) Create mock or stub
c) Be able to use the rollback after the test pattern
d) Use dependency injection
345. What are the different points where weaving can be applied?
A) Compile time, load time
B)Compile time, run time
C)Run time
D)Compile time, load Time, Run time
346. Which of the following is part of Data Access layer in Spring framework?
A) Beans
B)Aspects
C)JMS
D)Context
352. What are the types of the transaction management Spring supports?
A) Programmatic transaction management
B)Declarative transaction management
C)Both of above.
D)None of above.
357. Select the right statement about referring a Spring configuration file inside the package
com.example.myapp in the below example?
ApplicationContext context = new
ClassPathXmlApplicationContext("classpath:/com.example.myapp.config.xml");(checkbox ques)
a) The classpath: prefix could be omit
b) Package name with dot is not well formatted using the dot character
c) The slash character preceding com.example could be omit
d) All of the above
e) None of the above
366. What is/are typically case(s) where you usually need to manually instantiated an ApplicationContext?
a) In a web application
372. Hibernate session is the main runtime interface between java applications and hibernate.
a) TRUE b) FALSE
373. Which of the following is true about @Column annotation?
A) The @Column annotation is used to specify the details of the column to which a field or property will
be mapped.
B)The @Column annotation is applied on a class.
C)Both of the above.
D)None of the above.
377. Application contexts provide a generic way to load file resources, such as images.
a) True
b) False
378. What is easier to do by using Spring JMS support? Select one or more correct answers.
a. Register any Spring bean as JMX MBean
b. Register an existing MBean with a MBeanServer
c. Accessing to remote MBean
d. Control the attributes and the operations of a Spring bean exposes as a MBean
385. Which of the following class can be used to call Stored Procedures in spring?
A) SPHelper
B)JdbcTemplateCall
C)JdbcTemplate
D)SimpleJdbcCall
386. Which element of hbm.xml is used to map a Java class property to a column in the database table?
A) id
B)generator
C)property
D)class
389. Cache is simply to enhance the performance and it sits between application and database.
a) True
b) False
391. Scope that are used only in web aware application context
Request
Session
Global session
398. Session.createSQLQuery creates a new instance of Query for the given SQL query string.
A) true
B)false
399. Which method is used to get a persistent instance from the datastore?
A) Session.read()
B)Session.get()
C)Session.retrieve()
D)Session.fetch()
401. Which of the following element is used to represent one-to-many relationship in hibernate?
A) <one-to-many>
B)<one-many>
C)<OneToMany>
D)None of the above.
407. Which method is used to remove a persistent instance from the datastore?
A) Session.delete()
B)Session.remove()
C)Session.del()
D)Session.rm()
408. Which method is used to save or update the state of the given instance from the underlying database?
A) Session.saveOrUpdate()
B)Session.keep()
C)Session.update()
D)Session.load()
413. How could you implement a JMS Listener using the Spring JMS support? Select one or more correct
answers.
a. By implementing the javax.jms.MessageListener interface
b. By implementing the SessionAwareMessageListener interface provided by Spring
c. Without any code, only using the jms namespace provided by Spring
d. By writing a single POJO without parent class or interface
415. What do you have to do even if you are using the RMI Spring Remoting support? Select one or more
correct answers.
a. Implements the Remote interface
b. Extends the RemoteObject class
c. Catching the RemoteException exception
d. Implements the Serializable interface
418. Which one interpret user input and transform it into a model that is represented to the user by the
view.
a) controller
b) dispatcher servlet
c) model
d) browser
419. Which one runs advice before and after the advised method is invoked.
a) after
b) before
c) around
d) none of the above
420. Length attribute of @column annotation permits the size of the column used to map a value
particularly for a string value.
a) true b)false
421. Application contexts can publish events to beans that are registered as listeners.
a)true
b)false
424. To use spring MVC validator, which of the following is used to start the validator?- ve to select more than
1 so I chose al the check box..
A) override supports
B) override validate
C) override validator
D) override creates
425. index and type can be used in the constructor-arg at the same time?
State True or False
a)TRUE
b) FALSE
430. What is exact about the HttpInvokerServiceExporter? Select one or more correct answers.
a. Has to run into a HTPP server as Jetty
b. Could process both POST and GET requests
c. Could be used with any http client as Jakarta Commons HttpClient
d. Could consume SOAP http request
431. What is the method that is not provided by the JmsTemplate Spring class?
a. convertAndSend
b. onMessage
c. receiveAndConvert
d. setDefaultDestination
432. How is named the bean that is defined in the following configuration class. Select a single answer.
@Configuration
public class ApplicationConfig {
@Autowired
private DataSource dataSource;
@Bean
ClientRepository clientRepository() {
ClientRepository accountRepository = new JpaClientRepository();
accountRepository.setDataSource(dataSource);
return accountRepository;
}
}
1. JpaClientRepository
2. jpaClientRepository
3. clientRepository
4. Two beans are defined : a data souce and a repository
433. How could you externalize constants from a Spring configuration file or a Spring annotation into a
.properties file? Select one or more answers
a. By using the <util:constant /> tag
b. By declaring the ConstantPlaceholderConfigurer bean post processor
c. By using the <context:property-placeholder /> tag
d. By using the c: namespace
434. What is the purpose of the @ManageResource annotation? Select a single answer.
a. Expose a bean’s property (getter/setter) to JMX
b. Expose a bean’s method to JMX
c. Identify a Spring bean as a JMX MBean
d. None of the above
435. What are the right affirmations about the @PostConstruct, @Resource and the @PreDestroy
annotations?
a. Those annotations are specified in the JSR-250
b. The Spring Framework embedded those annotation
c. The <context:component-scan> tag enable them
d. The <context:annotation-config > tag enable them
e. Declaring the CommonAnnotationBeanPostProcessor enable them
436. What is/are typically case(s) where you usually need to manually instantiated an ApplicationContext?
a. In a web application
b. In an integration test running with the SpringJUnit4ClassRunner
c. In a standalone application started with a main method
d. None of the above
437.Select the right statement about referring a Spring configuration file inside the package
com.example.myapp in the below example?
ApplicationContext context = new
ClassPathXmlApplicationContext("classpath:/com.example.myapp.config.xml");
a) The classpath: prefix could be omit
b) Package name with dot is not well formatted using the dot character
c) The slash character preceding com.example could be omit
d) All of the above
e) None of the above
438. How to auto-inject into a field a bean by its name? Select one or more response.
a) With the name attribute of the @Autowired annotation
b) By using the single @Qualifier annotation
c) By using both the @Autowired and the @Qualifier spring annotations
d) By using the @Autowired annotation and naming the field with the bean name
439. What are the main advantages of using interfaces when designing business services? Select one or
more answers.
a. Mocking or stubbing the service
b. Be able to use the Spring auto-injection
c. Can do dependency checking
d. Loosely coupled code
440. Select one or many correct answers about spring bean life cycle.
1. The method annoted with @PostConstruct is called after bean instantiation and before
properties setting of the bean
2. The method @PreDestroy of a prototype bean is called when the bean is garbage collected
3. The init() method declared in the init-method attribute of a bean is called before the
afterPropertiesSet callback method of the InitializingBean interface
4. The method annotated with @PostConstruct is called before the afterPropertiesSet
callback method of the InitializingBean interface
441. Given the following configuration class, what are correct affirmations? Select one or more answers.
public class ApplicationConfig {
private DataSource dataSource;
@Autowired
public ApplicationConfig(DataSource dataSource) {
this.dataSource = dataSource;
}
@Bean(name="clientRepository")
ClientRepository jpaClientRepository() {
return new JpaClientRepository();
}
}
a. @Configuration annotation is missing
b. Default or no-arg constructor is missing
c. @Bean name is ambiguous
d. @Bean scope is prototype
442. What are the features of the XML <context: namespace? Select one or many answers.
1. @Transactional annotation scanning
2. @Aspect annotation detection enabling
3. @Autowired annotation enabling
4. @Component annotation scanning
443. Select one or more correct statements about developing integration test with Spring support.
a) A new Spring context is created for each test class
b) To get a reference on the bean you want to test, you have to call the getBean() method of
the Spring context
c) Spring context configuration could be inherits from the super class
d) The Spring context configuration file has to be provided to the @ContextConfiguration annotation
444.What are the main advantage(s) for using Spring when writing integration tests?
a. Reuse Spring configuration files of the application
b. Create mock or stub
c. Be able to use the rollback after the test pattern
d. Use dependency injection
445.What are the main advantage(s) for using Spring when writing unit tests?
a. Reuse Spring configuration files of the application
b. Use dependency injection
c. Provide some mocks for servlet classes
d. All of the above
e. None of the above
447.Select correct statement(s) about transactional support of the spring test module.
1. Transaction manager could be set within the @TransactionConfiguration annotation
2. Method annotated with @Before is executed outside of the test’s transaction
3. Spring test may rollback the transaction of a service configured with the REQUIRES_NEW
propagation
4. The transaction of a method annotated with the @Rollback annotation with its default
values is rolled back after the method has completed
448. Considering 2 classes AccountServiceImpl and ClientServiceImpl. Any of these 2 classes inherits from
each other. What is the result of the pointcut expressions?
execution(* *..AccountServiceImpl.update(..))
&& execution(* *..ClientServiceImpl.update(..))
1. Matches pubic update methods of the 2 classes, whatever the arguments
2. Matches any update methods of the 2 classes , whatever the arguments and method
visibility
3. Matches any update methods of the 2 classes , with one more arguments and whatever
method visibility
4. No joint point is defined
449. Using the Spring AOP framework, what is the visibility of the method matches by the following join
point?
@Pointcut("execution(* *(..))")
private void anyOperation() {};
1. All methods, whereas there visibility
2. All methods, except private method
3. Protected and public methods
4. Public methods
505. Select method’s signatures that match with the following pointcut:
execution(* com.test.service..*.*(*))
1. void com.test.service.MyServiceImpl#transfert(Money amount)
2. void com.test.service.MyServiceImpl#transfert(Account account, Money amount)
3. void com.test.service.account.MyServiceImpl#transfert(Money amount)
4. void com.test.service.account.MyServiceImpl#transfert(Account account, Money amount)
5. None of the above
506. What are the unique correct answers about Spring AOP support?
1. An advice could proxied a constructor’s class
2. A point cut could select methods that have a custom annotation
3. Static initialization code could be targeted by a point cut
4. Combination of pointcuts by &&, || and the ! operators is not supported
507.Using the Spring AOP framework, what are the joinpoint methods of the following pointcut
expressions?
execution(public * *(..))
1. The execution of all public method
2. The execution of all public method returning a value
3. The execution of all public method having at least one parameter
4. The execution of all public method in class belonging to the default java package
508.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.
1. It is mandatory for using Spring exception translation mechanism
2. May be improve performance when using Hibernate
3. Spring optimizes its transaction interceptor
4. Provides safeguards with Oracle and some other databases
509.What data access technology is supported by the Spring framework? Select one or more answers.
1. JDBC
2. NoSQL
3. Hibernate
4. JPA
513.What is/are incorrect statements about XML declaration of the transaction manager bean? Select
one or more answers.
1. The tx namespace provides JTA transaction manager declaration shortcut syntax
2. Id of the bean has to be transactionManager
3. Depending the application persistence technology, the HibernateTransactionManager or the
DataSourceTransactionManager could be used as bean class
4. Default transaction timeout could be given
514. Assuming @Transactional annotation support is enabled and the transferMoney method is called
through a Spring AOP proxy, what is the behavior of the following code sample?
@Transactional(propagation=Propagation.REQUIRED)
public void transferMoney(Account src, Account target, double amount) {
add(src, -amount);
add(src, amount);
}
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void add(Account account, Double amount) {
// IMPLEMENTATION
}
a. The add() method executes code in a new transaction
b. The add() method uses the transaction of the transferMoney() method
c. When calling the add() method, an exception is thrown
d. Other behavior
515. Does Spring provides programmatic transaction management? Select a unique answer.
a. Yes with the TransactionTemplate class
b. Yes with the TransactionService class
c. Yes using the @Transactional bean post processor
d. No
516. What is the transaction behavior of the PROPAGATION_REQUIRES_NEW mode? Select a unique
answer.
1. If a transaction exists, the current method should run within this transaction. Otherwise, it
should start a new transaction and run within its own transaction.
2. If a transaction is in progress, the current method should run within the nested transaction
of the existing transaction. Otherwise, a new transaction has to be started and run within its
own transaction.
3. The current method must start a new transaction and run within its own transaction. If there
is an existing transaction in progress, it is suspended.
4. None of the above
518. 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
519. Where do you cannot declare Spring MVC controller? Select one or more answers.
1. In a Spring application context XML configuration file
2. Into the web.xml file of the web application
3. Into the java code by using annotations
4. Into the JSP pages
521.How could you secure MVC controller with Spring Security? Select a unique answer.
a) With the @Secured annotation
b) With the @RolesAllowed annotation
c) In a XML security configuration file
d) All of the above
e) None of the above
522. What are the possible mechanisms provided by Spring Security to store user details? Select one or
more correct answers.
a. Database
b. JAAS
c. LDAP
d. Properties file
523. What is true about Spring security configuration and the security namespace? Select one or more
correct answers.
a. The access attribute of the intercept-url tag support both EL and constants together.
b. The patterns declared into the intercept-url tag are analyzed from up to bottom. Winning is
b) the first that matches.
a. The patterns declared into the intercept-url tag use by default the java regex syntax.
b. Security rules may applied depending request parameter
524. A many-to-one association is the most common kind of association where an object can be associated with
multiple objects.
a)true
b)false
526. The bean in the xml file is important for specifying the view resolver and view components
a)true
b)false
528. Spring provides @Validator annotation and Binding Result class through which we can get the errors
raised by Validator implementation in the controller request handler method.
A)true
B)false
530.spring provides a comprehensive set of data binding-aware tags for handling form elements when
using JSP and spring web MVC
a)true
b)false
533.SessionFactory allows application to create hibernate session by reading hibernate configuration file
hibernate.cfg.xml
a)true
b)false
536. to create new xml configuration extension which of the following are relatively simple steps
a)all
b)coding one or more BeanDefinitionParser implementation
c)coding a custom NamespaceHandler implementation
d)authoring an XML schema to describe your custom elements
e)registering all artefacts with the spring
537. which of the following statements are view resolver pattern and works in spring MVC?
a)it is a J2EE pattern which allows a web application to dynamically choose a view technology
b) spring MVC framework supplies inbuilt view resolver for selecting view
c)view resolver holds mapping of different views ,controller return the name of the view which is
then passed to the view resolver for a appropriate view
d)its does not support HTML, JSP, Tapestry, JSF and other controller technologies
HIBERNATE MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com
This section presents you various set of Mock Tests related to Hibernate Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
A - Java DB Connectivity
B - JDBC provides a set of Java API for accessing the relational databases from Java program.
C - JDBC APIs enables Java programs to execute SQL statements and interact with any SQL
compliant database.
A - Castor
B - Spring DAO
C - Hibernate
D - NoSQL
A - Hibernate takes care of mapping Java classes to database tables using XML files and without
writing any line of code.
B - Hibernate provides simple APIs for storing and retrieving Java objects directly to and from the
database.
C - Hibernate abstracts away the unfamiliar SQL types and provide us to work around familiar
Java Objects.
A - DB2/NT
B - MySQL
C - FoundationDB
D - PostgreSQL
A - XDoclet Spring
B - J2EE
C - Maven
A - JDBC
B - SessionFactory
C - Session
D - Configuration
A - Transaction
B - Provider
C - Criteria
D - Query
A - The Configuration object is the first Hibernate object you create in any Hibernate application.
B - The Configuration object is usually created only once during application initialization.
A - Configuration
B - Session
C - SessionFactory
D - Transaction
A - SessionFactory object configures Hibernate for the application using the supplied
configuration file.
C - You would need one SessionFactory object per database using a separate configuration file.
A - true
B - false
A - true
B - false
C - This is an optional object and Hibernate applications may choose not to use this interface,
instead managing transactions in their own application code.
A - Query objects Hibernate Query Language HQL string to retrieve data from the database and
create objects.
B - Query objects SQL string to retrieve data from the database and create objects.
C - A Query instance is used to bind query parameters, limit the number of results returned by
the query, and finally to execute the query.
A - This property makes Hibernate generate the appropriate SQL for the chosen database.
B - This property makes Hibernate generate the appropriate java code for the chosen database.
C - Both of the above.
A - Once we close the Hibernate Session, the persistent instance will become a detached
instance.
A - true
B - false
ANSWER SHEET
1 B
2 D
3 B
4 C
5 D
6 A
7 D
8 C
9 D
10 A
11 B
12 D
13 A
14 D
15 D
16 D
17 A
18 B
19 D
20 D
21 A
22 D
23 D
24 A
25 A
Loading [MathJax]/jax/output/HTML-CSS/jax.js
HIBERNATE MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com
This section presents you various set of Mock Tests related to Hibernate Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Q 1 - Session.createCriteria creates a new Criteria instance, for the given entity class,
or a superclass of an entity class.
A - true
B - false
Q 2 - Session.createQuery creates a new instance of Query for the given HQL query
string.
A - true
B - false
Q 3 - Session.createSQLQuery creates a new instance of Query for the given HQL query
string.
A - true
B - false
Q 4 - Session.createSQLQuery creates a new instance of Query for the given SQL query
string.
A - true
B - false
A - Session.delete
B - Session.remove
C - Session.del
D - Session.rm
A - Session.read
B - Session.get
C - Session.retrieve
D - Session.fetch
Q 7 - Which method is used to re-read the state of the given instance from the
underlying database?
A - Session.refresh
B - Session.get
C - Session.reload
D - Session.retrieve
Q 8 - Which method is used to save the state of the given instance from the
underlying database?
A - Session.store
B - Session.keep
C - Session.save
D - Session.load
Q 9 - Which method is used to update the state of the given instance from the
underlying database?
A - Session.store
B - Session.keep
C - Session.update
D - Session.load
Q 10 - Which method is used to save or update the state of the given instance from
the underlying database?
A - Session.saveOrUpdate
B - Session.keep
C - Session.update
D - Session.load
Q 11 - Which of the following is the root node of hbm.xml file?
A - hibernate-mapping
B - hibernate-config
C - class-mapping
D - class-config
Q 12 - Which of the following elements is used to define specific mappings from a Java
classes to the database tables?
A - property
B - hibernate-config
C - class
D - class-config
A - The <class> elements are used to define specific mappings from a Java classes to the
database tables.
B - The Java class name is specified using the name attribute of the class element.
C - The database table name is specified using the table attribute of the class element.
Q 14 - Which element of hbm.xml defines maps the unique ID attribute in class to the
primary key of the database table?
A - id
B - generator
C - primaryKey
A - The <id> element maps the unique ID attribute in class to the primary key of the database
table.
B - The name attribute of the id element refers to the property in the class.
C - The column attribute of the id element refers to the column in the database table.
A - id
B - generator
C - primaryKey
A - The <generator> element within the id element is used to automatically generate the
primary key values
B - Set the class attribute of the generator element is set to native to let hibernate pick up either
identity, sequence or hilo algorithm to create primary key depending upon the capabilities of the
underlying database.
A - id
B - generator
C - property
D - class
A - The <property> element is used to map a Java class property to a column in the database
table.
B - The name attribute of the element refers to the property in the class.
C - The column attribute of the element refers to the column in the database table.
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <many-to-one>
B - <many-one>
C - <ManyToOne>
ANSWER SHEET
1 A
2 A
3 B
4 A
5 A
6 B
7 A
8 C
9 C
10 A
11 A
12 C
13 D
14 A
15 D
16 B
17 C
18 C
19 D
20 A
21 B
22 C
23 D
24 D
25 A
Loading [MathJax]/jax/output/HTML-CSS/jax.js
HIBERNATE MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com
This section presents you various set of Mock Tests related to Hibernate Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
A - <many-to-one>
B - <many-one>
C - <ManyToOne>
A - <one-to-many>
B - <one-many>
C - <OneToMany>
A - <many-to-many>
B - <many-many>
C - <ManyToMany>
B - <one-many>
C - <OneToMany>
A - An employee can have multiple certificates and same certificate can be conferred to many
employees.
Q 6 - What is the difference between save and persist methods of session object?
A - There is no difference.
B - save saves the object and returns status whereas persist stores status in different variable.
C - save saves the object and returns the id of the instance whereas persist do not return
anything after saving the instance.
Q 7 - What is the difference between get and load methods of session object?
B - get always hits the database whereas load method doesn't hit the database.
A - true
B - false
Q 10 - Child objects are not loaded when parent is loaded/populated from database.
What this technique is called?
A - Eager Loading
B - Lazy Loading
A - HQL takes java objects in the same way as SQL takes tables.
B - The first-level cache is a mandatory cache through which all requests must pass.
C - The Session object keeps an object under its own power before committing it to the database.
A - The second-level cache is the SessionFactory based cache and is mainly responsible for
caching objects across sessions.
C - The second-level cache is mainly responsible for caching objects across sessions.
A - true
B - false
A - true
B - false
A - true
B - false
A - The query-level cache is cache for query resultsets that integrates closely with the second-
level cache.
B - Query level cache requires two additional physical cache regions that hold the cached query
results and the timestamps when a table was last updated.
C - Query level cache is only useful for queries that are run frequently with the same parameters.
B - Read-write
C - Nonstrict-read-write.
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.
ANSWER SHEET
1 A
2 A
3 A
4 A
5 A
6 C
7 D
8 A
9 A
10 B
11 A
12 D
13 A
14 D
15 A
16 D
17 A
18 B
19 B
20 A
21 D
22 D
23 B
24 B
25 C
Loading [MathJax]/jax/output/HTML-CSS/jax.js
HIBERNATE MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com
This section presents you various set of Mock Tests related to Hibernate Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.
C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.
A - ORM system lets business code access objects rather than DB tables.
A - Oracle
B - Microsoft SQL Server Database
C - FoundationDB
A - DB2/NT
B - PostgreSQL
A - Transaction
B - SessionFactory
C - Session
A - true
B - false
A - false
B - true
Q 9 - You would need one SessionFactory object per database using a separate
configuration file.
A - false
B - true
A - true
B - false
A - false
B - true
A - false
B - true
A - Hibernate Annotations is the powerful way to provide the metadata for the Object and
Relational Table mapping.
B - All the metadata is clubbed into the POJO java file along with the code this helps the user to
understand the table structure and POJO simultaneously during the development.
B - Hibernate assumes that it should access properties on an object directly through fields at
runtime.
B - Class marked with @Entity annotation must have a no-argument constructor that is visible
with at least protected scope.
A - The @Table annotation allows to specify the details of the table that will be used to persist the
entity in the database.
B - The @Table annotation allows to override the name of the table, its catalogue, and its
schema, and enforce unique constraints on columns in the table.
A - The @Column annotation is used to specify the details of the column to which a field or
property will be mapped.
A - true
B - false
Q 20 - length attribute of @Column annotation permits the size of the column used to
map a value particularly for a String value.
A - false
B - true
A - true
B - false
B - Instead of operating on tables and columns, HQL works with persistent objects and their
properties.
A - HQL queries are translated by Hibernate into conventional SQL queries which in turns
perform action on database.
B - The AS clause can be used to assign aliases to the classes in HQL queries.
A - HQL supports INSERT INTO clause only where records can be inserted from one object to
another object.
ANSWER SHEET
1 C
2 D
3 D
4 C
5 D
6 D
7 A
8 B
9 B
10 A
11 B
12 B
13 C
14 C
15 C
16 C
17 C
18 A
19 A
20 B
21 A
22 C
23 C
24 C
25 A
Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js
SPRING MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com
This section presents you various set of Mock Tests related to Spring Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Q 1 - What is spring?
D - All of above.
A - The functions that span multiple points of an application are called cross cutting concerns.
B - Cross-cutting concerns are conceptually separate from the application's business logic.
B - The SpEL module provides a powerful Expression Language for querying and manipulating an
object graph at runtime.
A - The JDBC module provides a JDBC-abstraction layer that removes the need to do tedious JDBC
related coding.
B - The ORM module provides integration layers for popular object-relational mapping APIs,
including JPA, JDO, Hibernate, and iBatis.
C - The Java Messaging Service JMS module contains features for producing and consuming
messages.
B - The Aspects module provides integration with AspectJ - Which is again a powerful and mature
aspect oriented programming AOP framework.
C - The Instrumentation module provides class instrumentation support and class loader
implementations to be used in certain application servers.
A - BeanFactory, ApplicationContext
B - ClassPathBeanFactory
C - FileSystemBeanFactory
D - AdvancedBeanFactory
A - FileSystemXmlApplicationContext, ClassPathXmlApplicationContext,
WebXmlApplicationContext
C - AdvancedApplicationContext, FileApplicationContext
D - FileSystemApplicationContext, ClassPathApplicationContext
B - Spring beans are instantiated, assembled, and otherwise managed by a Spring IoC container.
A - Bean scope forces Spring to produce a new bean instance as per the scope defined.
A - This scopes the bean definition to a single instance per Spring IoC container.
B - This scopes the bean definition to a single instance per HTTP Request.
C - This scopes the bean definition to a single instance per HTTP Session.
D - This scopes the bean definition to a single instance per HTTP Application/ Global session.
Q 21 - What is prototype scope?
A - This scopes a single bean definition to have any number of object instances.
B - This scopes the bean definition to a single instance per HTTP Request.
C - This scopes the bean definition to a single instance per HTTP Session.
D - This scopes the bean definition to a single instance per HTTP Application/ Global session.
A - singleton
B - prototype
C - request
D - session
C - This can be used to inject a collection of name-value pairs where name and value can be of
any type.
D - This can be used to inject a collection of name-value pairs where the name and value are
both Strings.
C - This can be used to inject a collection of name-value pairs where name and value can be of
any type.
D - This can be used to inject a collection of name-value pairs where the name and value are
both Strings.
C - This can be used to inject a collection of name-value pairs where name and value can be of
any type.
C - This can be used to inject a collection of name-value pairs where name and value can be of
any type.
D - This can be used to inject a collection of name-value pairs where the name and value are
both Strings.
A - Autowiring lets Spring resolve collaborators otherbeans for your bean by inspecting the contents
of the BeanFactory without using <constructor-arg> and <property> elements.
A - Default setting which means no autowiring and you should use explicit bean reference for
wiring.
C - Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
A - Default setting which means no autowiring and you should use explicit bean reference for
wiring.
B - Autowiring by property name. Spring tries to match and wire its properties with the beans
defined by the same names in the configuration file.
C - Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
A - Default setting which meas no autowiring and you should use explicit bean reference for
wiring.
B - Autowiring by property name. Spring tries to match and wire its properties with the beans
defined by the same names in the configuration file.
C - Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
D - Autowiring by property type. Spring tries to match and wire a property if its type matches with
exactly one of the beans name in configuration file.
A - Autowiring by property name. Spring tries to match and wire its properties with the beans
defined by the same names in the configuration file.
B - Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
C - Autowiring by property type. Spring tries to match and wire a property if its type matches with
exactly one of the beans name in configuration file.
D - Similar to byType, but type applies to constructor arguments. If there is not exactly one bean
of the constructor argument type in the container, a fatal error is raised.
A - Similar to byType, but type applies to constructor arguments. If there is not exactly one bean
of the constructor argument type in the container, a fatal error is raised.
B - Autowiring by property name. Spring tries to match and wire its properties with the beans
defined by the same names in the configuration file.
C - Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to
autowire by byType.
D - Autowiring by property type. Spring tries to match and wire a property if its type matches with
exactly one of the beans name in configuration file.
Q 38
A - Yes
B - No
A - This annotation indicates that bean property must be populated by the user.
B - This annotation indicates that bean property is required while saving the bean data to
database.
C - This annotation simply indicates that the affected bean property must be populated at
configuration time, through an explicit property value in a bean definition or through autowiring.
D - This annotation indicates that bean property is required while serializing the bean.
A - The @Autowired annotation can be used to autowire bean on the setter method.
B - This annotation provides more fine-grained control over where and how autowiring should be
accomplished.
C - The @Autowired annotation can be used to autowire bean on the methods with arbitrary
names and/or multiple arguments.
D - All of above.
A - This event is published when the Servlet Context is either initialized or refreshed.
A - This event is published when the Servlet Context is either initialized or refreshed.
C - This event is published when the ApplicationContext is started using the start method on the
ConfigurableApplicationContext interface.
A - This event is published when the Servlet Context is either initialized or refreshed.
B - This event is published when the ApplicationContext is stopped using the stop method on the
ConfigurableApplicationContext interface.
A - This event is published when the Servlet Context is either initialized or refreshed.
D - This event is published when the ApplicationContext is closed using the close method on the
ConfigurableApplicationContext interface.
Q 46 - What is RequestHandledEvent:event?
A - This event is published when the Servlet Context is either initialized or refreshed.
C - This represents a point in your object where you join injected values.
D - This represents a point in your application where you can plug-in AOP aspect.
Q 49 - What is Advice?
C - This is the actual action to be taken either before or after the method execution.
Q 50 - What is Pointcut?
A - This represents a point in your application where you can plug-in AOP aspect.
ANSWER SHEET
1 A
2 D
3 A
4 A
5 A
6 A
7 A
8 A
9 A
10 D
11 D
12 D
13 A
14 A
15 A
16 A
17 D
18 D
19 A
20 A
21 A
22 A
23 A
24 A
25 A
26 A
27 A
28 B
29 C
30 D
31 A
32 A
33 A
34 B
35 D
36 D
37 C
38 A
39 D
40 C
41 B
42 D
43 C
44 B
45 D
46 C
47 B
48 D
49 C
50 B
Loading [MathJax]/jax/output/HTML-CSS/jax.js
SPRING MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com
This section presents you various set of Mock Tests related to Spring Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Q 1 - What is Introduction?
A - An introduction represents a point in your application where you can plug-in AOP aspect.
A - A represents a object in your application where you can plug-in AOP aspect.
B - The object being advised by one or more aspects, this object will always be a proxy object,
also referred to as the advised object.
Q 3 - What is Weaving?
B - Weaving is the process of linking aspects with other application types or objects to create an
advised object.
C - Run time
C - Run advice after http response is returned only if http response is success.
A - Run advice after a method execution only if method exits by throwing an exception.
B - Run advice after a class loads only if class throws exception during load time.
C - Both of above.
D - None of above.
C - Both of above.
D - None of above.
A - Spring MVC framework is Model-Value-Class architecture and used to bind model data with
values.
B - The Spring web MVC framework provides model-view-controller architecture and ready
components that can be used to develop flexible and loosely coupled web applications.
C - Spring MVC framework is used for Transaction management for Web Applications.
A - The @Controller annotation indicates that a particular class serves the role of a controller.
C - Both of above.
D - None of above.
A - Hibernate
B - iBatis
C - JPA
D - All of above.
E - None of above.
A - MySql
B - PostgresSql
C - NoSql
D - Oracle
A - Beans
B - Aspects
C - JMS
D - Context
xml?
A - True
B - False
A - False
B - True
Q 22 - Which class acts as IoC Container?
A - ServletContext
B - DispatcherServlet
C - ApplicationContext
A - 1.0
B - 2.0
C - 3.0
D - 4.0
A - Yes
B - No
A - True
B - False
A - False
B - True
A - session
B - global-session
C - prototype
D - request
Q 29 - If a bean is created once per Ioc Container, scope is
A - singleton
B - global-session
C - prototype
D - request
A - 1.0
B - 2.0
C - 3.0
D - 4.0
A - session
B - global-session
C - prototype
D - request
A - global-session
B - singleton
C - prototype
D - request
A - session
B - global-session
C - prototype
D - request
A - global-session
B - session
C - prototype
D - request
Q 35 - How to handle shut down of IoC container?
A - Using shutdownHook
B - Using shutdownHandler
C - Using registerHook
D - Using registerShutdownHook
A - session
B - global-session
C - prototype
D - request
A - ResultSet
B - RowMapper
C - RowSetMapper
D - ResultSetMapper
Q 40
A - True
B - False
Q 41 - Which of the following class can be used to execute Sql queries in spring?
B - JDBCHelper
A - JdbcTemplate
C - DBHelper
D - DBTemplate
Q 42 - Which of the following class can be used to call Stored Procedures in spring?
A - SPHelper
B - JdbcTemplateCall
C - JdbcTemplate
D - SimpleJdbcCall
Q 43 - What is a DispatcherServlet?
B - Web.xml file
C - Meta-inf/dispatcher.xml
D - Web-inf/ dispatcher.xml
A - It is a concrete class.
B - It is an interface.
C - It is an abstract class.
B - It defines callback methods that you can implement to provide your own instantiation logic,
dependency-resolution logic etc.
A - True
B - False
A - True
B - False
A - SpringEvent
B - Event
C - ApplicationEvent
D - None of above
ANSWER SHEET
1 D
2 B
3 B
4 D
5 D
6 B
7 B
8 A
9 A
10 C
11 C
12 B
13 A
14 C
15 D
16 C
17 B
18 C
19 C
20 B
21 B
22 C
23 A
24 C
25 A
26 B
27 B
28 D
29 A
30 C
31 C
32 B
33 C
34 B
35 D
36 D
37 B
38 A
39 B
40 B
41 A
42 D
43 C
44 C
45 B
46 B
47 B
48 A
49 A
50 C
Loading [MathJax]/jax/output/HTML-CSS/jax.js
1.The central artifact in spring javaConfig is the @Configuration-annotated class.State true or False.
ans:true
a.Spring-faces -----------
b.Spring-bundling
c.Spring-container ------
d.Spring-webflow -----
4.In spring MVC each tag provides support to the set of attributes of its corresponding HTML tag
counterpart making the tags familiar & intuitive to use
5.Which of the following are mandatory rules to create validation for a normal employee table?
6.Which of the following allows as to add a new method or attributes to existing classes?
a.Introduction -----
b.Proxy
c.Weaving
d.Auto call
7.Given the following Spring configuration file, what is the correct answer:
<bean class="com.spring.service.MyServiceImpl">
</bean>
<bean class="com.spring.repository.JpaDao"/>
b. The second declared bean JpaDao is missing an id must be named jpaDao ------------
8.Which of the following are the best practices for writing spring XML configuration?
best practices:
a.Presentation
b.Tools
c.Data Access
a.Lightweight
b.Open Source
c.ORM
12.Which of the following options about Auto Wiring in spring are correct?
1.Auto-wiring in spring framework can be performed by configuring xml and auto-wiring with
annotation @Autowired. ----
2.Auto-wiring beans with xml configuration:I spring framework, you can wire automatically with auto-
wiring feature.
3.To enable auto-wiring just define the "autowire" attribute in <bean> tag. -------
13.Which of the following parses in xml based on expression and its used extensively in conjuction with
XLST?
c.STAX Parser
d.JDOM Parser
14.Length attribute of @column annotation permits the size of the column used to map a value
particularly for a string value.
15.When we work with an object oriented system there's a mismatch between the object modal and the
relational database. State true or False.
-----true
a.JDBC APIs enables java programs to execute SQL statements and interact with any SQL Complaint
database
c.it provides set of java API for accessing the relational databases from java program
18.Which of the listed statement are correct for spring Bean scope:Prototype?
1.Spring container creates new instance of bean for each and every request for that bean-------------
2.Prototype scoped bean is served by creating new instance of bean for each and every bean
dependency----------
3.After instatiating bean and submitting it to client spring container will maitain the record(not
maintain)
4.Prototype scope is spring standard scope and can be used in standalone as well as web application of
spring.------
---------true
20.Hibernate session is the main runtime interface between a java application and Hibernate.State true
or False.
-----true
1.sql queries may contain named and positional parameters, just like hibernate queries----------
4.You may call session.connection() and use JDBC Connection at any time
24.Which is the query language that embodies a very powerful and flexible mechanism to query, store,
update and retrive
a.PLSQL
b.RDBMS
c.SQL
d.HQL----------------
a.spring MVC framework is used for Transaction management for web application-----
b.spring MVC framework is Model-value-class architecture and used to bind model data
c.spring MVC framework is used for AOP for web application -------
d.spring web MVC framework provides model-view-controller architecture and ready components that
can be used to develop flexible and loosely coupled web applications
--------------
26.Which of the listed options are True for bean configuration inheritance?
1.In spring the inheritance is supported in bean to share common values properties or configurations.---
---
2.A child bean or inherited bean can inherit its parent bean configurations, properties & some
attributes --
27.XsltViewResolver-supports XsltView by resolving the view name of which of the following options?
28.[xml]
<generator/>
</id>
[xml]
b.Secondary key
c.Unique key
d.
29.When you need to upload a large number of records into your database using Hibernate, you can use
batch processing.State true or False.
---true
30.Different types of run advice "before" and "after" the advised method is invoked.Which of the
following is the correct option with respect to advice?
a.After returning
b.None
c.After throwing
d.around ---
31.Implementation of viewResolver accets a configuration file written in XML with the same DTD as
spring XML bean factories.State true or False.
---------true
32.Choose the odd one out respect to annotations from the following
a.@requestmapping
b.@controller
c.@responsevalid------------
d.@Pathvalid-------
33.For a fast Development, the depenndency injection feature of spring Framework &
support to various Frameworks makes the easy development of javaEE application.state true or False.---
--true
35.The application is designed around an object model.Sql code is generated at build time
& the assosiations between obj are supported by the persistence mechanism, and queries are
specified using an obj-oriented expression language.This is best suited for medium-sized applications
with some complex transactions.Used when mapping exceeds 25 differentdatabase products at a time.
a.Object mapping
36.Which of the following is not the steps for creating web MVC?
Ans:True
a.<many-to-one>
b.<ManyTOOne>
c.<many-one>
d.none
Ans:<many-to-one>
39.In hibernate implement cache for a query ,if the result sets can integrate closely,which level
40.Spring MVC provides predefined templates for JDBC, Hibernate and JPA.state true or False.------true
Ans:True
41.In Spring MVC which of the following is the front controller class that initializes the context
a.org.springframework.web.servlet.DispatcherServlet-----------------------------------
b.org.springframework.web.context.DispatcherServlet
c.org.springframework.web.servlet
d.org.springframework.web.context.ApplicationContext
a.Instance mapping-------------
b.Component mapping
c.Association mapping
d.Class mapping
45.In spring bean configuration bean atribute called 'scope' defines what kind of object
has to be created and returned. What returns a new bean instance each time when required?
a.Prototype----
b.Session
c.Singleton
d.Global session
46.To validate the form fields you need to have a seperate UserValidator class
that implements the validator interface,override the validate() method perform all the validations.state
true or False.
------true
47.The application context implements which of the following interface that is used to obtain localized
1.messageSource -------------------
2.RequestMapping
3.both
4.neither
a.Aggregate(property name)
c.max(property name)-------------------
d.avg(property name)-------------------
1. Constuctor and properties autowiring in the same bean are not compatible
3. The <constructor-arg> tag could take type, name and index to reduce ambiguity
A - This event is published when the Servlet Context is either initialized or refreshed.
B - This event is published when the HTTP Request is received.
D - This event is published when the ApplicationContext is closed using the close method on the
51.Which of the following explains about addclass function in the listed options?
b.this translated file name is then loaded as an input stream from the java class loader
c.this addclass function is important if you want efficient usage of classes in your code----------
52.Spring MVC provides a JSP tag library(Spring form) for making it easier to bind form elements to
model data.state true or False.
Ans:True
c.Testing an application written with spring is simple because environment-dependent code is moved
into this framework.
d.All of above.------------------------
c. Spring MVC view resolvers help the Dispatcher Servlet in identifying the views which has to be
rendered in response for a request.
d.none--------------------------
55.What are the benefits of Spring Framework's transaction management?
a.It Provides a consistent programming model across different transaction APIs such as JTA, JDBC,
Hibernate, JPA, and JDO.
c.It Provides a simpler API for programmatic transaction management than a number of complex
transaction APIs such as JTA.
56.Given the following configuration class, what are correct affirmations? Select one or more answers.
@Autowired
this.dataSource = dataSource;
@Bean(name="clientRepository")
ClientRepository jpaClientRepository() {
C.This can be used to inject a collection of name-value pairs where name and value can be of
any type.--------<map>
D.This can be used to inject a collection of name-value pairs where the name and value are
both Strings.----------<props>
A.FileSystemXmlApplicationContext,ClassPathXmlApplicationContext,
WebXmlApplicationContext-------------
C.AdvancedApplicationContext, FileApplicationContext
D.FileSystemApplicationContext, ClassPathApplicationContext
1)Given the following configuration class, what are correct affirmations? Select one or more answers.
this.dataSource = dataSource;
@Bean(name="clientRepository")
ClientRepository jpaClientRepository() {
---------------------------------------------------------------------------------------------------------------
<generatoers/>
<id/>
[/xml]
Select One:
a.DB key
b.Unique key
c.Secondary key
d.Primary key--------ANS
--------------------------------------------------------------------------------------------------------------------
3)ApplicationContext implements which of the following interface that is used to obtain localized
messages, with the actual implementation being pluggable
I. MessageSource
II. RequestMapping
Select One:
a. only I--------------ANS
b.only II
c. Neither I or II
d. Both I and II
--------------------------------------------------------------------------------------------------------------------
a) many-to-one
b) <many-to-one>---------ANS
d) <Manyone>
-------------------------------------------------------------------------------------------------------------
select one
a. Constuctor and properties autowiring in the same bean are not compatible
c. The <constructor-arg> tag could take type, name and index to reduce ambiguity
select one
a)Select
b)Where
c)Sub---------------Ans
d)Having
--------------------------------------------------------------------------------------------------
select one
True----------Ans
False
-----------------------------------------------------------------------------------------
select one
a)3
b)4------------Ans
c)5
d)2
------------------------------------------------------------------------
select one
True----------Ans
False
-------------------------------------------------------------------------------------------------------
10) PROPAGATION_REQUIRES_NEW
Ans: Creates a new transaction, suspending the current transaction if one exists.
----------------------------------------------------------------------------------------------------------
11)Element which can be used to inject a collection of name-value pairs where the name and the value
can be of any type.
select one
a)<list>
b)<set>
c)<map>---------------ANS
d)<props>
-----------------------------------------------------------------------------------------------------------------
12)Element which can be used to inject a collection of name-value pairs where the name and the value
are both Strings type.
select one
a)<list>
b)<set>
c)<map>
d)<props>---------------ANS
-----------------------------------------------------------------------------------------
select one
a)@Requires
b)@Resource
c)@Required----------------ANS
d)@Requiring
----------------------------------------------------------------------------------------------------------------------
14)ORM stands for Object-Relational Mapping (ORM) is a programming technique for converting data
between relational databases.
select one
True----------Ans
False
-------------------------------------------------------------------------------------------------------------
15)Which tool helps to generate the mapping document Though many Hibernate users choose to write
the XML by hand
select one
a)oldgen
b)younggen
c)Middlegen----------------ANS
d) Mediumgen
-------------------------------------------------------------------------------------------------------------
16)Java based configuration option disables you to write most of your Spring configuration without XML
but with the help of few Java-based annotations
select one
True
False----------Ans
----------------------------------------------------------------------------------------------------------------------------
17) What types of views supported by spring MVC for different presentation technologies
b)HTML
c)velocity templates
d)
---------------------------------------------------------------------------------------------------------------------------------
select one
True
False----------Ans
-------------------------------------------------------------------------------------------------------------------------
19)A very powerful and high performance qurerying language used to Query,retrive,store data in DB is
select one
a)PLSQL
b)HQL-------ANS
c)SQL
d)RDBMS
----------------------------------------------------------------------------------------
20)which of the following options about Auto wiring in spring are correct?
I. The Auto wiring in spring framework can be performed by configuring in xml and spring Auto-Wiring
with Annotation @Autowired
II. Auto-wiring beans with xml configuration: In Spring framework, you can wire beans automatically
with auto wiring feature
III. To enable auto-wiring just define the "autowire" attribute in <bean> tag.
Select One:
c.I and II
----------------------------------------------------------------------------------------------------------------------------------
1) In Spring AOP, the process of linking aspect with other application types or objects to create an advice
object is called ________________.
Weaving(ans)
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
4) Can you inject null and empty string values in Spring? ans: yes
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
6) SpEL is NOT part of core container. ANS: false (it is part of core container)
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
7)Following class can be extended to create custom event in spring. ans: ApplicationEvent
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
d - all-----------------ANS
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
10) how many intances can be created fora global session : one
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
14)which can be used to inject a collection of name-value pairs where name and value can be of any
type. ANS--------MAP
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
A - This event is published when the Servlet Context is either initialized or refreshed.
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
select
where
having
sub-----ans
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
17)which is a aggregate function in HQL(multiple choice)? ANS-sum, avg and count (dont select
aggregate)
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
A - DB2/NT
B - MySQL
C - FoundationDB----ANS
D - PostgreSQL
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
20)What is the difference between save() and persist() methods of session object?
A - There is no difference.
B - save saves the object and returns status whereas persist stores status in different variable.
C - save saves the object and returns the id of the instance whereas persist do not return anything after
saving the instance.------ANS
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
22)
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
23)
JDBC, ORM, OXM, JMS, Transactions are the modules of Data Access/ Integration layer.------TRUE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
24)ContextStartedEvent event is published when the ApplicationContext is started using the start()
method on the ConfigurableApplicationContext interface.-----TRUE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
26)singleton is the default scope of any spring bean.-----TRUE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
27)
<bean class="com.spring.service.MyServiceImpl">
</bean>
<bean class="com.spring.repository.JpaDao"/>
I. The "id" attribute must be declared for the bean "MyServiceImpl" because it is mandatory attribute.
II. In the second bean of type "com.spring.repository.JpaDao" the “id" attribute must be specified with
name "jpaDao".
Select One
b II only-------------------------ANS
c I only
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
28)Which of the following parses in XML based on expression and its used extensively in conjugation
with xstl ?
Select One:
a)JDOM parser
b)SAX parser
c) STAX parser
d) Xpath parser0------ANS
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
ANS-
FileSystemXmlApplicationContext,ClasspathXmlApplicationContext,WebxmlApplicationContext(answers
are confusing- xml should be common in those three)
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
32) The central artefact in spring javConfig is the @Configuratuion annotated class?
a). TRUE-------------ANS
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
select one
a. Constuctor and properties autowiring in the same bean are not compatible
c. The <constructor-arg> tag could take type, name and index to reduce ambiguity
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
36) Given the following configuration class, what are correct affirmations? Select one or more answers.
@Autowired
this.dataSource = dataSource;
@Bean(name="clientRepository")
ClientRepository jpaClientRepository() {
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
38)[xml]
<generatoers/>
<id/>
[/xml]
Select One:
a.DB key
b.Unique key
c.Secondary key
d.Primary key--------ANS
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
I. instance mapping---ans
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
42)Around advice------Run advice before and after the advised method is invoked.
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
a). TRUE-------------ANS
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
45)Hibernate session is the main runtime interface between java applications and hibernate.
State True or False
a). TRUE-------------ANS
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
46)When we work with an object oriented system, there is mismatch between the object model and the
relational database.
a). TRUE-------------ANS
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
a). TRUE-------ANS
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
48)form fields are validated using user defined validations class by implementing validation interface
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
49) spring does not seperate three modules like presentation layer,bussiness layer and data access layer
a). TRUE
b). FALSE-------ANS
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
II.@responsevalid---ans
III.@Controller
IV.@requestmapping
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
a). TRUE---ans
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
52)which level cache implements a cache for query resultsets
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
54)form tags are available in springs is more compatible wth html tags for better development
a). TRUE-----------ANS
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
I. SQL queries may contain named and positioned parameters, just like Hibernate queries
III. Hibernate take care of the mapping from result sets to objects
IV. You may call session.connection() and use the JDBC Connection at any time.
select one
b. I, II, and IV
c. I, III, and IV
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
spring-webflow
spring-
spring-
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
II.bean definition
IV.@controller usage
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
a). TRUE--ans
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
60.index and type can be used in the constrictor-arg at the same time?
a). TRUE---ans
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
a) <many-to-many>
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
62) the same XSD of BeanFactory can be used for View resolver interface?
a). TRUE---------------ANS
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
C - Testing an application written with spring is simple because environment-dependent code is moved
into this framework.
D - All of above.---------ANS
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
64)
B - This event is published when the ApplicationContext is stopped using the stop() method on the
ConfigurableApplicationContext interface.-------ANS
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
65)XsltViewResolver-supports XsltView by resolving the view name of which of the following options
c)URl of xslt-------------------------------ANS
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
66) Spring MVC provides predefined templates for JDBC, Hibernate and JPA.
a). TRUE-------------ANS
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
67) ApplicationContext implements which of the following interface that is used to obtain localized
messages, with the actual implementation being pluggable
I. MessageSource
II. RequestMapping
Select One:
a. only I--------------ANS
b.only II
c. Neither I or II
d. Both I and II
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
68) Which of the following are the best practices for writing spring XML Configurations?
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
69) To validate the form fields you need to have a seperate UserValidator class that implements the
validator interface, Override the validate() method perform all the validations.
a). TRUE-------------ANS
b). FALSE
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
70) which of the listed options are TRUE for Bean configuration inheritance?
II. A child bean or inherited bean can inherit its parent bean configurations, properties and some
attributes
Select One:
b.I and II
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
71) which of the following options about Auto wiring in spring are correct?
I. The Auto wiring in spring framework can be performed by configuring in xml and spring Auto-Wiring
with Annotation @Autowired
II. Auto-wiring beans with xml configuration: In Spring framework, you can wire beans automatically
with auto wiring feature
III. To enable auto-wiring just define the "autowire" attribute in <bean> tag.
Select One:
c.I and II
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
Select One:
a.Readable Metadata
c.Collecion metadata
e.Column/Table Mapping
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
73) Which of the following explains about addClass function in the listed options
II. This translated file name is then loaded as an input stream from the java class loader
III. This addClass function is important if you want efficient usage of classes in your code
Select One
b. I and III
c. I and II
d. II and III
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
74) The application is designed around an object model. The SQL code is generated at build time and the
associations between objects are supported by the persistent mechanism, and queries are specified
using an object oriented expression language. This best suited for medium-sized applications with some
complex transactions. Used when the mappping exceeds 25 different databse products at a time.
Select One:
d. Object Mapping
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
Expected Questions:
after-returning advice----------Run advice after the method execution, only if the method completes
successfully.
after-throwing advice-----------Run advice after the method execution, only if the method exits by
throwing an exception.
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
2). ResourceLoader support: Spring's Resource interface us a flexible generic abstraction for handling
low-level resources. An application context itself is a ResourceLoader, Hence provides an application
with access to deployment-specific Resource instances.
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
3).Which of the following are the best practices for writing spring XML Configurations?
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
Web(MVC/Remoting)--WebSocket,Servlet,Web, Portlet
AOP
Aspects
Instrumentation
Messaging
Test
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
5)
6)Bean Scopes:
Scope Description
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
7) Spring-Injecting Collection:
Element Description
<list> This helps in wiring i.e., injecting a list of values,
allowing duplicates.
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
8) Autowiring Modes:
Mode Description
Autowiring Limitations:
Limitations Description
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
@Autowired----The @Autowired annotation can apply to bean property setter methods, nonsetter
methods, constructor and properties.
@Qualifier----The @Qualifier annotation along with @Autowired can be used to remove the confusion
by specifiying which exact bean will be wired.
JSR-250 Annotations----Spring supports JSR-250 based annotations which include @Resource,
@PostConstruct and @PreDestroy annotations.(Go through these annotations
also)
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
10) @Configuration-----indicates that the class can be used by the Spring IoC container as a source of
bean definitions.
@Bean--------------annotation tells Spring that a method annotated with @Bean will return an object
that should be registered as a bean in the Spring application context
@Import------------annotation allows for loading @Bean definitions from another configuration class
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
RequestHandledEvent-------This is a web-specific event telling all beans that an HTTP request has been
serviced.
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
Terms Description
requirement.
------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
Approach Description
------------------------------------------------------------------------------------------------------------------------------------------
----------------------------
ACID:
Atomicity: A transaction should be treated as a single unit of operation, which
Isolation: There may be many transaction processing with the same data set at
the same time. Each transaction should be isolated from others to prevent data
corruption.
Durability: Once a transaction has completed, the results of this transaction have
to be made permanent and cannot be erased from the database due to system
failure.
------------------------------------------------------------------------------------------------------------------------------------------
----------------------------
15)
isolation levels:
------------------------------------------------------------------------------------------------------------------------------------------
----------------------------
This section presents you various set of Mock Tests related to Spring Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Q 1 - What is Introduction?
A - An introduction represents a point in your application where you can plug-in AOP aspect.
A - A represents a object in your application where you can plug-in AOP aspect.
B - The object being advised by one or more aspects, this object will always be a proxy object,
also referred to as the advised object.
Q 3 - What is Weaving?
B - Weaving is the process of linking aspects with other application types or objects to create an
advised object.
C - Run time
C - Run advice after http response is returned only if http response is success.
A - Run advice after a method execution only if method exits by throwing an exception.
B - Run advice after a class loads only if class throws exception during load time.
C - Both of above.
D - None of above.
C - Both of above.
D - None of above.
A - Spring MVC framework is Model-Value-Class architecture and used to bind model data with
values.
B - The Spring web MVC framework provides model-view-controller architecture and ready
components that can be used to develop flexible and loosely coupled web applications.
C - Spring MVC framework is used for Transaction management for Web Applications.
A - The @Controller annotation indicates that a particular class serves the role of a controller.
C - Both of above.
D - None of above.
A - Hibernate
B - iBatis
C - JPA
D - All of above.
E - None of above.
A - MySql
B - PostgresSql
C - NoSql
D - Oracle
A - Beans
B - Aspects
C - JMS
D - Context
xml?
A - True
B - False
A - False
B - True
Q 22 - Which class acts as IoC Container?
A - ServletContext
B - DispatcherServlet
C - ApplicationContext
A - 1.0
B - 2.0
C - 3.0
D - 4.0
A - Yes
B - No
A - True
B - False
A - False
B - True
A - session
B - global-session
C - prototype
D - request
Q 29 - If a bean is created once per Ioc Container, scope is
A - singleton
B - global-session
C - prototype
D - request
A - 1.0
B - 2.0
C - 3.0
D - 4.0
A - session
B - global-session
C - prototype
D - request
A - global-session
B - singleton
C - prototype
D - request
A - session
B - global-session
C - prototype
D - request
A - global-session
B - session
C - prototype
D - request
Q 35 - How to handle shut down of IoC container?
A - Using shutdownHook
B - Using shutdownHandler
C - Using registerHook
D - Using registerShutdownHook
A - session
B - global-session
C - prototype
D - request
A - ResultSet
B - RowMapper
C - RowSetMapper
D - ResultSetMapper
Q 40
A - True
B - False
Q 41 - Which of the following class can be used to execute Sql queries in spring?
B - JDBCHelper
A - JdbcTemplate
C - DBHelper
D - DBTemplate
Q 42 - Which of the following class can be used to call Stored Procedures in spring?
A - SPHelper
B - JdbcTemplateCall
C - JdbcTemplate
D - SimpleJdbcCall
Q 43 - What is a DispatcherServlet?
B - Web.xml file
C - Meta-inf/dispatcher.xml
D - Web-inf/ dispatcher.xml
A - It is a concrete class.
B - It is an interface.
C - It is an abstract class.
B - It defines callback methods that you can implement to provide your own instantiation logic,
dependency-resolution logic etc.
A - True
B - False
A - True
B - False
A - SpringEvent
B - Event
C - ApplicationEvent
D - None of above
ANSWER SHEET
1 D
2 B
3 B
4 D
5 D
6 B
7 B
8 A
9 A
10 C
11 C
12 B
13 A
14 C
15 D
16 C
17 B
18 C
19 C
20 B
21 B
22 C
23 A
24 C
25 A
26 B
27 B
28 D
29 A
30 C
31 C
32 B
33 C
34 B
35 D
36 D
37 B
38 A
39 B
40 B
41 A
42 D
43 C
44 C
45 B
46 B
47 B
48 A
49 A
50 C
Loading [MathJax]/jax/output/HTML-CSS/jax.js
Core Spring 3.0 Certification Mock Exam
Question
Container
Question 1
Given the following Spring configuration file, what is the correct answer:
<bean class="com.spring.service.MyServiceImpl">
<property name="repository" ref="jpaDao"/>
</bean>
<bean class="com.spring.repository.JpaDao"/>
Question 2
Given the Spring configuration file, which are the correct statements?
<bean class="com.spring.service.BankServiceImpl"
p:bankName="NationalBank">
</bean>
Question 3
How is named the bean that is defined in the following configuration class. Select a single answer.
@Configuration
public class ApplicationConfig {
@Autowired
private DataSource dataSource;
@Bean
ClientRepository clientRepository() {
ClientRepository accountRepository = new JpaClientRepository();
accountRepository.setDataSource(dataSource);
return accountRepository;
}
}
1. JpaClientRepository
2. jpaClientRepository
3. clientRepository
4. Two beans are defined : a data souce and a repository
Question 4
How could you externalize constants from a Spring configuration file or a Spring annotation into a
.properties file? Select one or more answers
Question 5
1. Constuctor and properties autowiring in the same bean are not compatible
2. A bean should have a default or a no-args constructor
3. The <constructor-arg> tag could take type, name and index to reduce ambiguity
4. None of the above
5. All of the above
Question 6
What are the right affirmations about the @PostConstruct, @Resource and the @PreDestroy
annotations?
Question 7
What is/are typically case(s) where you usually need to manually instanciated an ApplicationContext?
1. In a web application
2. In an integration test running with the SpringJUnit4ClassRunner
3. In a standalone application started with a main method
4. None of the above
Question 8
Select the right statement about referring a Spring configuration file inside the package
com.example.myapp in the below example?
ApplicationContext context = new
ClassPathXmlApplicationContext("classpath:/com.example.myapp.config.xml");
Question 9
How to auto-inject into a field a bean by its name? Select one or more response.
Question 10
What are the main advantages of using interfaces when designing business services? Select one or
more answers.
Question 11
Select one or many correct answers about spring bean life cycle.
1. The method annoted with @PostConstruct is called after bean instantiation and before
properties setting of the bean
2. The method @PreDestroy of a prototype bean is called when the bean is garbage collected
3. The init() method declared in the init-method attribute of a bean is called before the
afterPropertiesSet callback method of the InitializingBean interface
4. The method annotated with @PostConstruct is called before before the afterPropertiesSet
callback method of the InitializingBean interface
Question 12
Given the following configuration class, what are correct affirmations? Select one or more answers.
public class ApplicationConfig {
@Autowired
public ApplicationConfig(DataSource dataSource) {
this.dataSource = dataSource;
}
@Bean(name="clientRepository")
ClientRepository jpaClientRepository() {
return new JpaClientRepository();
}
}
Question 13
What are the features of the XML <context: namespace? Select one or many answers.
Test
Question 14
Select one or more correct statements about developing integration test with Spring support.
Question 15
What are the main advantage(s) for using Spring when writing integration tests?
What are the main advantage(s) for using Spring when writing unit tests?
Question 17
1. It provides an abstraction layer for the main open source mock frameworks
2. Provides the @Mock annotation
3. It dynamically generates mock objects
4. All of the above
5. None of the above
Question 18
Select correct statement(s) about transactional support of the spring test module.
AOP
Question 19
Considering 2 classes AccountServiceImpl and ClientServiceImpl. Any of these 2 classes inherits from
each other. What is the result of the pointcut expressions?
execution(* *..AccountServiceImpl.update(..))
&& execution(* *..ClientServiceImpl.update(..))
Question 20
Using the Spring AOP framework, what is the visibility of the method matches by the following join
point?
@Pointcut("execution(* *(..))")
private void anyOperation() {};
Question 21
1. AOP proxies are created by Spring in order to implement the aspect contracts
2. AOP proxies are always created with a JDK dynamic proxy
3. Only classes that implements a least one interface could be proxied
4. All methods could be proxied
5. Proxies are created by a BeanPostProcessor
Question 22
Question 23
Question 24
Question 25
Question 26
execution(* com.test.service..*.*(*))
Question 27
What are the unique correct answers about Spring AOP support?
Question 28
Using the Spring AOP framework, what are the joinpoint methods of the following pointcut
expressions?
execution(public * *(..))
Data Access
Question 29
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.
Question 30
What data access technology is supported by the Spring framework? Select one or more answers.
1. JDBC
2. NoSQL
3. Hibernate
4. JPA
Question 31
Question 32
Using JdbcTemplate, what is the Spring provided class you will use for result set parsing and merging
rows into a single object? Select a unique answer.
1. RowMapper
2. RowCallbackHandler
3. ResultSetExtractor
4. ResultSetMapper
Question 33
Transaction
Question 34
What is/are incorrect statements about XML declaration of the transaction manager bean? Select
one or more answers.
Question 35
Assuming @Transactional annotation support is enabled and the transferMoney method is called
through a Spring AOP proxy, what is the behavior of the following code sample?
@Transactional(propagation=Propagation.REQUIRED)
public void transferMoney(Account src, Account target, double amount) {
add(src, -amount);
add(src, amount);
}
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void add(Account account, Double amount) {
// IMPLEMENTATION
}
Question 36
Question 37
What is the transaction behavior of the PROPAGATION_REQUIRES_NEW mode? Select a unique
answer.
1. If a transaction exists, the current method should run within this transaction. Otherwise, it
should start a new transaction and run within its own transaction.
2. If a transaction is in progress, the current method should run within the nested transaction
of the existing transaction. Otherwise, a new transaction has to be started and run within its
own transaction.
3. The current method must start a new transaction and run within its own transaction. If there
is an existing transaction in progress, it is suspended.
4. None of the above
Question 38
Sping @MVC
Question 39
What could not return a Spring MVC controller? Select a single answer.
Question 40
Where do you cannot declare Spring MVC controller? Select one or more answers.
Question 41
What is the easiest method to write a unit test?
3. @RequestMapping("/displayAccount")
String displayAccount(@RequestParam("accountId") int id, Model model)
4. @RequestMapping("/displayAccount")
String displayAccount(@PathVariable("accountId") int id, Model model)
Spring Security
Question 42
How could you secure MVC controller with Spring Security? Select a unique answer.
Question 43
What are the possible mechanisms provided by Spring Security to store user details? Select one or
more correct answers.
1. Database
2. JAAS
3. LDAP
4. Properties file
Question 44
What is true about Spring security configuration and the security namespace? Select one or more
correct answers.
1. The access attribute of the intercept-url tag support both EL and constants together.
2. The patterns declared into the intercept-url tag are analyzed from up to bottom. Winning is
the first that matches.
3. The patterns declared into the intercept-url tag use by default the java regex syntax.
4. Security rules may applied depending request parameter
Remoting
Question 45
What do you have to do even if you are using the RMI Spring Remoting support? Select one or more
correct answers.
Question 46
What is exact about the HttpInvokerServiceExporter? Select one or more correct answers.
JMS
Question 47
What is the method that is not provided by the JmsTemplate Spring class?
1. convertAndSend
2. onMessage
3. receiveAndConvert
4. setDefaultDestination
Question 48
How could you implement a JMS Listener using the Spring JMS support? Select one or more correct
answers.
1. By implementing the javax.jms.MessageListener interface
2. By implementing the SessionAwareMessageListener interface provided by Spring
3. Without any code, only using the jms namespace provided by Spring
4. By writing a single POJO without parent class or interface
JMX
Question 49
What is easier to do by using Spring JMS support? Select one or more correct answers.
Question 50
Container
Question 1
Answer 2 is correct. Those beans are anonymous because no id is supplied explicitly. Thus Spring
container generates a unique id for that bean. It uses the fully qualified class name and appends a
number to them. However, if you want to refer to that bean by name, through the use of the ref
element you must provide a name (see Naming Beans section of the Spring reference manual). To be
correct, the 2nd bean has to declare a jpaDao id attribute in order to be reference by the
repository property of the first bean.
Question 2
1. To set bean’s property with the p:propertyName shortcut, you have to declare the
http://www.springframework.org/schema/p in your xml configuration file. No xsd is
required.
2. The bean is anonymous. Spring generates a unique id:
com.spring.service.BankServiceImpl#0
3. To reference another bean with the p namespace, you have to use the p:propertyName-ref
syntax
4. Due to the above explanation, NationalBank is not a bean reference, so it is a simple String
and thus a scalar value.
Question 3
Correct answer is 3.
The @Bean annotation defines a String bean with the id "clientRepository". JpaClientRepository is
the implementation class of the bean. The data source is injected and is not declared in this class.
Question 4
Question 5
The statements number 5 is right.
1. You may auto-wiring properties by constructor, setter or properties in the same bean
2. The <constructor-arg> tag helps to instanciated a bean without default or no-args
constructor
3. The <constructor-arg> tag could take type and index to reduce ambiguity, but not name
which requires debug symbols.
Question 6
1. The @PostConstruct, @PreDestroy and @Resource annotations are defined in the JSR-250
2. They belong to the javax.annotation package. You should add an external jar to use them in
Java 5. Java 6 and 7 integrates them.
3. The <context:component-scan> automatically detects stereotyped classes and turns on the
<context:annotation-config>
4. The <context:annotation-config > activates the Spring infrastructure for various annotations
to be detected in bean classes, including the JSR 250 annotations
5. The CommonAnnotationBeanPostProcessor supports common Java annotations out of the
box, in particular the JSR-250 annotations.
Question 7
Question 8
Question 9
Question 10
1. With modern mock API like Mockito or EasyMock, interfaces are not mandatory for mocking
or stubbing the service. But using interface remains easier when you have to manually mock
the service in unit test.
2. Auto-injection is possible with class. Spring uses CGLIB.
3. Dependency checking is an advantage of dependencies injection.
4. The Inversion of Control pattern requires an interface to separate 2 classes. This pattern
provides code more flexible, unit testable, loosely coupled and maintainable.
Question 11
Correct answers: 4
1. In the bean lifecycle, method annotated with @PostConstruct is called after the properties
set step and the BeanPostProcessors#postProcessBeforeInitialization step
2. Destroy methods of prototype beans are never called
3. In the bean lifecycle, the afterPropertiesSet callback method of the InitializingBean is called
after the method annotated with the @PostConstruct annotation and before the init-method
declared in the XML configuration file.
4. In the bean lifecycle, the method annotated with the @PreDestroy annotation is called
before the destroy callback of the DisposableBean interface and before the destroy-method
declared in the XML configuration file.
Question 12
1. In order to be taken into account by Spring, the ApplicationConfig class has to be annotated
with the @Configuration annotation
2. Default or no-arg constructor is mandatory. Here, the provided constructor with a
dataSource parameter is not taken into account
3. The bean name is clientRepository. The name property of the @Bean annotation is specified
thus the method name jpaClientRepository is ignored.
4.
Question 13
Test
Question 14
1. The Spring context is cached across tests unless you use @DirtiesContext annotation
2. With the Spring test module, dependency injection is available in test case. So you may auto-
wired the bean to test
3. By default, a @ContextConfiguration annoted class inherits the spring context configuration
file locations defined by an annotated superclass. The inheritLocations of this attribute
allows to change this default behavior.
4. If no context configuration file is provided to the @ContextConfiguration annotation, Spring
use a file convention naming. It try to load a file named with the test class name and suffices
by the "-context.xml" suffice (i.e. MyDaoTest-context.xml)
Question 15
What are the main advantage(s) for using Spring when writing integration tests?
1. More than testing multiple classes together, integration test may allow to test your spring
configuration file and/or to reuse it.
2. Mocking or stubbing is more frequent in unit tests than in integration tests. And Spring does
not provide any implementation or abstraction of mock framework.
3. The framework may create and roll back a transaction for each test method. Default rollback
policy could be change by using the @TransactionConfiguration annotation. And default
mode could be overridden by the @Rollback annotation.
4. DependencyInjectionTestExecutionListener provides support for dependency injection and
initialization of test instances.
Question 16
Question 17
Answer 5 is correct.
1. The spring test module does not provide an abstraction layer for open source mock
frameworks like EasyMock, JMock or Mockito
2. The @Mock annotations comes from the Mockito framework
3. The spring test module does not provide mechanism to generate mock objects at runtime
Question 18
AOP
Question 19
Considering 2 classes AccountServiceImpl and ClientServiceImpl. Any of these 2 classes inherits from
each other. What is the result of the pointcut expressions?
execution(* *..AccountServiceImpl.update(..))
&& execution(* *..ClientServiceImpl.update(..))
Poincut expression could not satisfied both first and second execution point. Do not confuse the &&
operator and || operator.
Question 20
Due to the proxy-based nature of Spring's AOP framework, protected methods are by definition not
intercepted, neither for JDK proxie nor for CGLIB proxies. As a consequence, any given pointcut will
be matched against public methods only!
To intercept private and protected methods, AspecJ weaving should be used instead of the Spring’s
proxy-bases AOP framework.
Question 21
1. An object created by the AOP framework in order to implement the aspect contracts
2. If the target object does not implement any interfaces then a CGLIB proxy will be created.
You could also use CGLIB proxy instead of JDK dynamic proxy
3. If the target object does not implement any interfaces then a CGLIB proxy will be created.
4. When CGLIB proxy is used, final methods cannot be advised, as they cannot be overridden.
5. AOP Proxies are created by the AbstractAutoProxyCreator#postProcessAfterInitialization
method.
Question 22
Question 23
Correct answer: 4
Question 24
Correct answer: 1
1. Definition of an advice
2. Definition of a joint point
3. Represents nothing
4. Definition of a point cut
Question 25
Correct answer: 2
1. Definition of an advice
2. Definition of a pointcut
3. Represents nothing
Question 26
Correct answers: 1, 3
execution(* com.test.service..*.*(*))
1. True
2. The pattern (*) matches a method taking one parameter of any type
3. The com.test.service.account sub-package matches the pointcut
4. False for the same reason as answer number 2.
Question 27
Correct answers: 2
1. Interception of constructors requires the use of Spring-driven native AspectJ weaving instead
of Spring's proxy-based AOP framework
2. The @annotation designator enables to select methods that are annotated by a given
annotation
3. The staticinitialization AspectJ designator is not supported by Spring AOP
4. Pointcut expressions can be combined using &&, || and !
Question 28
Correct answers: 1
Data Access
Question 29
Correct answers: 2 , 4
Question 30
Correct answers: 1, 3, 4
Question 31
Correct answer: 1
Question 32
Correct answer: 3
1. RowMapper : result set parsing when need to map each row into a custom object
2. RowCallbackHandler : result set parsing without returning a result to the JdbcTemplate caller
3. ResultSetExtractor : for result set parsing and merging rows into a single object
4. ResultSetMapper : this class does not exist
Question 33
Correct answer: 3
Transaction
Question 34
Correct answer: 2
1. <tx:jta-transaction-manager />
2. Id of the transaction manager bean could be customized (ie. txManager)
3. DataSourceTransactionManager is a transaction manager for a JDBC data source.
HibernateTransactionManager may be used to manage transaction with Hibernate.
4. The AbstractPlatformTransactionManager has a defaultTimeout property that could be
customized
Question 35
Correct answer: 2
In proxy mode, only external method calls coming in through the proxy are intercepted. In the code
snippet, the add() method is self-invocated. This means that, the @Transactional annotation of the
add() method is not interpreted. The REQUIRES_NEW propagation level is not taken into account.
To summary, when the transferMoney() methods calls add() method directly, the transaction
attributes of add() method are not used
Question 36
Correct answer: 1
Question 37
Correct answer: 3
1. PROPAGATION_REQUIRED
2. PROPAGATION_NESTED
3. PROPAGATION_REQUIRES_NEW
Question 38
Correct answer: 2
1. False.
2. True
3. False
4. False
Sping @MVC
Question 39
Correct answer: 1
Question 40
Correct answer: 2, 4
1. Spring MVC controllers are beans. So you can declare them into a Spring application context
XML configuration file that could be loaded by the DispatcherServlet.
2. In the web.xml, you may declarer and a ContextLoaderListener and a DispatcherServlet that
are in charge to load XML Spring configuration files. But you cannot declare controllers
directly in these file.
3. The @Controller annotation may be used to annoted Spring MVC Controller beans that
handle HTTP requests.
4. JSP is the View of the MVC Pattern. Thus this is not the right place to declare controllers.
Question 41
Correct answer: 3
3. This method is not dependent of the servlet API. Id of the account to display may be directly
passed through the call stack. Thus test methods are simplified.
4. The @PathVariable annotation has to be bound to a URI template variable. This is not the
case.
Sping Security
Question 42
Correct answer: 4
Question 43
Question 44
Correct answer: 2
Remoting
Question 45
Correct answer: 4
Question 46
Correct answers: 1, 3
JMS
Question 47
Correct answer: 2
1. The convertAndSend method sends a given object to a destination, converting the object to
a JMS message.
2. The onMessage method does not exist.
3. The receiveAndConvert method receives a message synchronously then convert the
message into an object
4. The setDefaultDestination method sets the destination to be used on send/receive
operations that do not have a destination parameter.
Question 48
Correct answers: 1, 2 , 4
JMX
Question 49
Correct answers: 1, 2, 3, 4
1. The MBeanExporter class allow to expose any Spring bean as a JMX MBean
2. Exiting MBean could be declared as Spring bean. Then the <context:mbean-export />
directive enables their registration to the MBeanServer
3. Remote MBean could be access through a proxy
4. Implementations of the MBeanInfoAssembler interface do the job
Question 50
Correct answer: 3