0% found this document useful (0 votes)
709 views9 pages

Spring JDBC Support

This document contains questions and answers related to Spring JDBC support and using Hibernate in Spring. Some key points covered include: - Spring provides the JdbcTemplate class which helps avoid common bugs and simplifies JDBC coding. It also supports connection pooling. - Popular ORM frameworks that integrate well with Spring include Hibernate, EclipseLink, and OpenJPA. Hibernate uses Hibernate Query Language (HQL) to issue queries. - When using Hibernate with Spring, the SessionFactory and EntityManager beans can be configured via XML or annotations. Hibernate models object-relational associations that are important for data modeling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
709 views9 pages

Spring JDBC Support

This document contains questions and answers related to Spring JDBC support and using Hibernate in Spring. Some key points covered include: - Spring provides the JdbcTemplate class which helps avoid common bugs and simplifies JDBC coding. It also supports connection pooling. - Popular ORM frameworks that integrate well with Spring include Hibernate, EclipseLink, and OpenJPA. Hibernate uses Hibernate Query Language (HQL) to issue queries. - When using Hibernate with Spring, the SessionFactory and EntityManager beans can be configured via XML or annotations. Hibernate models object-relational associations that are important for data modeling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Spring JDBC support

1. Which is generally more widely used for


web application development, especially
on the
Linux platform?
A. PL/pgSQL
B. MySQL
C. PostgreSQL
D. JDBC
Ans. B
2. Which is procedural a language?
A. MySQL
B. JDBC
C. PL/psSQL
D. None
Ans. C
3. A database is a collection of data.
A. True
B. False
Ans. A
4. Which is the open source databases
A. PostgreSQL
B. HSQL
C. Derby
D. All above
Ans:D
5. The difference between a DataSource and
a Connection is that a DataSource
provides and manages Connections.
A. True
B. False
Ans. A(p280)
6. Which package provides
DriverManagerDataSource?
A. org.springframework.jdbc.object
B. org.springframework.jdbc.support
C. org.springframework.jdbc.config
D. none
Ans. D
7. The DriverManagerDataSource does
support database connection pooling
makes this class unsuitable for anything
other than testing.
A. True
B. False
Ans. B
8. Which is/are the JEE application server?
A. JBoss
B. WebSphere
C. GlassFish
D. Above all
E. None
Ans. D
9. Springs JndiObjectFactoryBeanto obtain
the data source by
A. JDBC lookup
B. JNDI lookup
C. MySQL lookup
D. None
Ans. B
10. As of version 3.1, Spring supports by
default
A. HSQL

B. H2
C. DERBY
D. All Above
Ans. A
11. Which is/are ORM frameworks
A. Hibernate
B. EclipseLink/ TopLink
C. OpenJPA
D. All are
Ans. D
12. Which one is appropriate process to
create a Table?
a. Create table (
Id int not null auto_increment,
First_name varchar(25),
Primary key(id));
b. Create table (
Id int not null auto_increment,
First_name varchar,
Primary key(id));
c. Create table customer(
Id int not null auto_increment,
First_name varchar(25),
Primary key(id));
Ans: c
13. Which is not Spring JDBC Packages?
a. Core
b. Datasource
c. Object
d. Config
e. servlet
Ans:e p-279
14. What is the correct extension of properties
file?
a. jdbc.properties
b. Jdbc.property
c. Jdbc.propertyfile
Ans: a p-281
15. Which one is not JEE application server ?
a. JBoss
b. webSpher
c. GlassFish
d. Primefaces
Ans: d p-281
16. DML stand for ?
a. Data manipulation language
b. Data maintain language
c. Data margin language
Ans: a p-283
17. SQL Exception are runtime exceptions
True or False ?
a. True
b. False
Ans: a p-286
18. Public class IdbExam{
Private DataSource datasource;
Public void setDataSource(DataSource
dadasource){

This.datasource=datasource;
}
}
Above this application datasource is a --a. Interface
b. Class
c. Variable
Ans: b
19. JdbcTemplete is a Interface True or False ?
a. True
b. False
Ans: b p-287
20. Which is database management software?
a MySQL
b Primeface
c Java
d Html
Answer : a(page-270)
21. RDBMS stands for
a Relational Database Management
Software.
b Relational Database Management
System.
c Relative Database Management
System.
Answer: b( page-270)
22. DriverManagerDataSource is under the
package of
a Org.springframework.jdbc.JDBC
b Org.springframework.jdbc.datasour
ce
c Org.springframework.jdbc.jdbcTam
plete
d Org.springframework.jdbc.DriverM
anagerDataSource
Answer: b( page-280)
23. What is friendlier to Oracle developers?
a) MySQL
b) PstgreSQL
c) Oracle
d) Above all
Answer: b(page- 269)
24. MySQL is generally more widely used
for.
a) Web application development
b) Desktop application development
c) Both a and b
d) None
Answer: a(page- 269)
25. ORM stands for
a) Object-Related Mapping
b) Object-Related Module
c) Object-Relational Mapping
d) Object-Relational Module
Answer: c.(page- 269)
26. What is the alternative of ObjectRelational Mapping ?
a) JDBC
b) ODBC
c) JPA
d) Hibernate

Answer: a(page- 269)


27. The instance of RDBMS is called
a) Database management software
b) Database engine
c) Database server
d) Database management system
Answer: b.(page- 270)
28. In the Spring Jdbc module , there is a class
called
a) JdbcDaoSupport
b) JdbcTemplateSupport
c) JdbcTemplateDaoSupport
d) JdbcObjectDaoSuppor
Answer: a(page-288)
29. Popular ORM framework is/are
a) Hibernate
b) EclipseLink
c) OpenJPA
d) Above all
Answer: d. (page-316)
30. What is friendlier to Oracle developers?
a) MySQL
b) PstgreSQL
c) Oracle
d) Above all
Answer: b(page- 269)
31. MySQL is generally more widely used for
a) Web application development
b) Desktop application
development
c) Both a and b
d) None
Answer: a. (page- 269)
32. ORM stands for
a) Object-Related Mapping
b) Object-Related Module
c) Object-Relational Mapping
d) Object-Relational Module
Answer: c.(page- 269)
33. What is the alternative of ObjectRelational Mapping ?
a) JDBC
b) ODBC
c) JPA
d) Hibernate
Answer: a(page- 269)
34. The instance of RDBMS is called
a) Database management
software
b) Database engine
c) Database server
d) Database management system
Answer: b.(page- 270)
35. In the Spring Jdbc module , there is a class
called
a) JdbcDaoSupport
b) JdbcTemplateSupport
c) JdbcTemplateDaoSupport
d) JdbcObjectDaoSuppor
Answer: a(page-288)
e) Popular ORM framework is/are
a) Hibernate
b) EclipseLink
c) OpenJPA

d) Above all
Answer: d. (page-316)
36. what are the advantage of jdbcTamplate?
a. mentioned problems of JDBC API.
b. It provides you methods to write the
queries directly,
c. it saves a lot of work and time.
d.All of the above
ans: d
37. what is a powerful mechanism to connect to
the database and execute SQL queries?
a.Jdbc
b.jdbcTamplate
c.odbcTamplate
d.none of above
Ans: b
38. ResultSetExtractor interface can be used
a. to fetch records from the database
b.to delete records from the database
c. a+b
d.none
Ans: a
39. What are spring Jdbc package?
a.org.springframework.jdbc.core
b.org.springframework.jdbc.datasource
c.org.springframework.jdbc.config
d.all of the above
ans: d
40. DriverManager datasource what under the
package?
a.org.springframework.jdbc.core
b.org.springframework.jdbc.datasource
c.org.springframework.jdbc.config
d.none
ans: b
41. where from spring property placeholder will
load the connection information?
a. jdbc.properties
b. jdbc.config
c. jdbc.support
d. jdbc.object
Ans: a
42. Datasource implement by --a. JEE Application server
b. JMV Application server
c. ODBC Application server
d. Object Application server
ans: a
43. whice verson spring offer embedded
database supported
a. verson 4.0

b. verson 3.0
c. verson 1.0
d.all
ans: b
44. jdbcTemplate
a. allow to issue any type of sql statement
b. return any type of result
c. both a+b
d. none
ans: c
45. when will be jdbcTemplate initialized
automatically
a. then extend DAO supported
b. then extend JDBC supported
c. a+b
d. only b
ans: a
46. what are the not Hibernate configuration
property
a. hibernate.dialect
b. hibernate.batch
c. hibernate.batch-size
d. hibernate.fetch-size
ans: b
47. Adventage of ORM
a. less coding in required
b. esay to test
c. batter exception handling
d. all of above
ans: d
48. what are spring supported
EntiyManagerFactorya. LocalEntiyManagerFactory Bean
b. JEE6 compliant container
c. localContaineLocalEntiyManagerFactory
Bean
d. all of above
ans: d
Using Hibernate in Spring
1) Some popular ORM libraries are
A. Hibernate
B. TopLink
C. JDO
D. All
E. None
Ans. D
2) POJO stand for ?
a. Plain Old java Object
b. Pre old java object
c. Plain order java object
Ans: a
3) The relationship between hibernate and
JPA is very close True or False?
a. True

4)

5)

6)

7)

b. False
Ans: a p-317
When we use the
AnnotationSessionFactoryBean ?
a. Xml annotation support
b. Hibernate annotation support
c. None of the above
Ans: b p-325
How many approaches are there to the
mapping Hibernate Annotations ?
a. One
b. Two
c. Three
Ans: b p-326
HQL Stand for ?
a. Hibernate query Language
b. Hibernate quick language
c. Hibernate query length
Ans: a p-335
Which one is correct method for deleting
data ?
// other code omitted
a. Public void delete(Contact contact)
{
sessionFactory.getCurentSession().dele
te(contact);
log.info(contact delete with id: +
contact.getId());
}
// other code omitted
b. Public void delete(Contact contact)
{
sessionFactory.getCurentSession().dele
te();
log.info(contact delete with id: +
contact.getId());
}
// other code omitted
c. Public void delete(Contact contact)
{
sessionFactory.getCurentSession().dele
te(delete());
log.info(contact delete with id: +
contact.getId());
}

Ans: a p-342
8) The core concept of Hibernate is based on
the
a Java
b Jdbc
c Session
d Bean
Answer: c( page-323)
9) Object-Relational Mapping libraries that
has wide support in spring

a) Hibernate
b) JDBC
c) JPA
d) ODBC
Answer: a(page-317)
10) JDO stands for
a) Java Data Object
b) Java Database Object
c) None
Answer: a..(page-317)
11) Popular ORM libraries are .
a) Hibernate
b) TopLink
c) JDO
d) None
Answer: a, b,c (page-317)
12) JPA stands for
a) Java Persistence API
b) Java Persistence Access
c) Java Persistent API
d) None
Answer: a..(page-317)
13) The relationship between the Hibernate
and JPA is very close
a) False
b) True
Answer: b.(page-317)
14) Who is the founder of Hibernate?
a) Rod Johnson
b) John Hibernate
c) Gavin King
d) Gavin Smith
Answer: c(page-317)
15) Annotation approach is much more
popular approach.
a) True
b) False
Answer: a(page-318)
16) Hibernate has the capability to model a lot
of different kinds of.
a) Generation
b) Performance
c) Associations
d) Above all
Answer: c.(page-331)
17) Object-Relational Mapping libraries that
has wide support in spring
e) Hibernate
f) JDBC
g) JPA
h) ODBC
Answer: a(page-317)
18) JDO stands for
d) Java Data Object
e) Java Database Object
f) None
Answer: a..(page-317)
19) Popular ORM libraries are
e) Hibernate
f) TopLink
g) JDO
h) None
Answer: a, b,c. (page-317)
20) JPA stands for

e) Java Persistence API


f) Java Persistence Access
g) Java Persistent API
h) None
Answer: a..(page-317)
21) The relationship between the Hibernate
and JPA is very close
c) False
d) True
Answer: b.(page-317)
22) Who is the founder of Hibernate?
e) Rod Johnson
f) John Hibernate
g) Gavin King
h) Gavin Smith
Answer: c(page-317)
23) Annotation approach is much more
popular approach.
c) True
d) False
Answer: a(page-318)
24) Hibernate has the capability to model a lot
of different kinds of..
e) Generation
f) Performance
g) Associations
h) Above all
Answer: c(page-331)

Data Access in Spring with JPA2


1) EntityManager is
A. A class
B. An object
C. An interface
Ans. C
2) The main job of EntityManager is to
maintain a persistence context, in which
all the entity instances under
management will be stored.
A. True
B. False
Ans. A
3) JPQL is very similar to
A. MySQL
B. HQL
C. iBatis
D. None
Ans. B
4) A SQL resultset mapping is defined at the
entity class level using the annotation
A. @SqlResultSetMapping
B. @SqlResultSetExactor
C. @SqlResultSetQuery
Ans. A
5) EntityManager.getCriteriaBuilder()was
called to retrieve an instance of
CriteriaBuilder.
A. True
B. False
Ans. A
JPA stand for ? p-345
a. Java platform api

6)

b. Java persistence api


c. Java perform api
Ans: b
JPQL Stand for p- 345
a. Java persistence query language
b. Java persistence quick language
c. Java platform query language
Ans: a

7) Which is not jpa persistence ?


a. Hibernate
b. eclipseLink
c. OracleToplink
d. Maven
Ans:d p-145
8) In jpa 2 Which one is same as
SessionFactory ?
a. EntityManagerFactory
b. SessionManagerFactory
c. Session
Ans: a p-346
9) How many type spring supports
EntityManagerFactory configuration ?
a. One
b. Two
c. Three
d. Four
Ans: c p-350
10) JPQL stands for
a) Java Persistence Query Language
b) Java Persistency Query Language
c) Java Persistent Query Language
d) Java Persist Query Language
Answer: a..(page-345)
11) Spring also provides intensive support for
JPA.
a) True
b) False
Answer: a(page-345)
12) Which project created by STS? (page-348)
a) Web based project
b) Maven based project
c) Java based project
d) None
Answer: b
13) How many types of EntityManagerFactory
configuration Spring supports?
a) Two
b) Five
c) Three
d) Four
Answer:c(page-350)
14) Which method is used to delete data in
JPA?
a) EntityManager.remove()
b) EntityManager.destroy()
c) EntityManager.delete()
d) None
Answer: a(page-364)

15) A hierarchical in an oracle database. This


kind of query is database-specific and
referred to as a
a) Custom query
b) Simple query
c) Native query
d) JPA query
Answer: c(page-366)
16) JPQL stands for
e) Java Persistence Query Language
f) Java Persistency Query Language
g) Java Persistent Query Language
h) Java Persist Query Language
Answer: a..(page-345)
17) Spring also provides intensive support for
JPA.
c) True
d) False
Answer: a(page-345)
18) Which project created by STS?
e) Web based project
f) Maven based project
g) Java based project
h) None
Answer: b(page-348)
19) How many types of EntityManagerFactory
configuration Spring supports?
e) Two
f) Five
g) Three
h) Four
Answer:c(page-350)
20) Which method is used to delete data in
JPA?
e) EntityManager.remove()
f) EntityManager.destroy()
g) EntityManager.delete()
h) None
Answer: a(page-364)
21) A hierarchical in an oracle database. This
kind of query is database-specific and
referred to as a (page-366)
e) Custom query
f) Simple query
g) Native query
h) JPA query
Answer: c
Designing and Implementing
Spring-Based Applications
1) DOM refers to
A. Document Object Model
B. Domain Object Model
C. Delivery Object Model
Ans. B
2) DOM is a collection of ______ that provides
an abstract model of the data.
A. Object
B. Interface
C. Method
Ans. A

3) An applications service layer is where all


of the business logic that makes up the
application is encapsulated.
A. True
B. False
Ans. A
4) In Java, a class has only _____ shot at
concrete inheritance.
A. One
B. Two
C. Three
D. Five
Ans. A
5) Consider a system that has a business
interface called.
A. FreeService
B. OrderService
C. ExecuteService
Ans. B
6) Which is/are the drawbacks of the Basic
Factory Pattern
A. There is no way to change an
implementing class without a
recompile.
B. There is no way simply to switch
instantiation models.
C. Only A
D. Both A and B
Ans. D
7) The Value Object Pattern is same as the
Data Transfer Object Pattern.
A. True
B. False
Ans. B
8) Which one is traditional OOP best
practice?
a. Interface-driven design
b. Building domain object model
c. None of the avove
Ans: a p-437
9) What is the responsibility of Factory
Pattern?
a) To provide application
component
b) To provide application context
c) To provide application initiated
object
d) Above all
Answer: a(page-440)
10) How there are many drawbacks of Factor
Pattern?
a) Five
b) Six
c) Two
d) Three
Answer: d(page-440)
11) What is the biggest drawback of the
traditional Factory Pattern?
a) Multiple implementation
b) Single implementation
c) Both a and b
d) None

Answer: a(page-440)
12) What is the basic method of the Basic
Factory class?
a) getOrderService()
b) getService()
c) getObjectService()
d) getInstnceService()
Answer: a(page-440)
13) A Domain Object Model (DOM) is asset
classes that model concepts from the
problem domain.
a) True
b) False
Answer: a(page-442)
14) A good DOM makes it easier for
developers to transform application
requirements into application features.
a) True
b) False
Answer: a(page-443)
15) The goal of DOM is to create a set of ...
a) Methods
b) Classes
c) Objects
d) Instances
Answer: b(page-444)
16) DTO stands for.
a) Data Objects
b) Database Objects
c) Data Transfer Objects
d) None
Answer: c.(page-454)
17) What is the responsibility of Factory
Pattern?
e) To provide application
component
f) To provide application context
g) To provide application initiated
object
h) Above all
Answer: a(page-440)
18) How there are many drawbacks of Factor
Pattern?
e) Five
f) Six
g) Two
h) Three
Answer: d(page-440)
19) What is the biggest drawback of the
traditional Factory Pattern?
e) Multiple implementation
f) Single implementation
g) Both a and b
h) None
Answer: a(page-440)
20) What is the basic method of the Basic
Factory class?
e) getOrderService()
f) getService()
g) getObjectService()
h) getInstnceService()
Answer: a(page-440)

21) A Domain Object Model (DOM) is asset


classes that model concepts from the
problem domain.
c) True
d) False
Answer: a(page-442)
22) A good DOM makes it easier for
developers to transform application
requirements into application features.
c) True
d) False
Answer: a(page-443)
23) The goal of DOM is to create a set of ..
e) Methods
f) Classes
g) Objects
h) Instances
Answer: b.(page-444)
24) DTO stands for..
e) Data Objects
f) Database Objects
g) Data Transfer Objects
h) None
Answer: c(page-454)

Validation and type Conversion


and formatting
1) SPI stands for .
a) Service Provider
Interface
b) Service Provider
Inheritance
c) Service Provider
Interfaces
d) None
Answer: a(page-495)
2) Spring provides a few implementations of
commonly used types, including..
a) CurrencyFormatter
b) DateFormatter
c) NumberFormatter
d) PercentFormatter
e) Above all
Answer: e(page-505)
3) Validations rules applied on domain
objects ensure that all business data is
well structured and fulfills all business
logic.
a) True
b) False
Answer: a(page-508)
4) JSR-303 is a JEE standard and is broadly
supported by many fronted/backend
framework. Which are these?
a) Spring
b) JPA2
c) Spring MVC
d) GWT
e) Above all

Answer: e(page-519)
5) SPI stands for .
a) Service Provider
Interface
b) Service Provider
Inheritance
c) Service Provider
Interfaces
d) None
Answer: a(page-495)
6) Spring provides a few implementations of
commonly used types, including..
f) CurrencyFormatter
g) DateFormatter
h) NumberFormatter
i) PercentFormatter
j) Above all
Answer: e(page-505)
7) Validations rules applied on domain
objects ensure that all business data is
well structured and fulfills all business
logic.
c) True
d) False
Answer: a(page-508)
8) JSR-303 is a JEE standard and is broadly
supported by many fronted/backend
framework. Which are these?
f) Spring
g) JPA2
h) Spring MVC
i) GWT
j) Above all
Answer: e(page-519)
Web application with Spring
1) Which one is not web application
frameworks ?
a. Spring MVC
b. Struts
c. Java Server Faces(JSF)
d. Jsp
Ans: jsp p-585
2) Spring MVC which is the central servlet
that receives requests and dispatchers
then to the appropriate controllers ?
a. DispatcherServlet
b. Servlet
c. ActionServlet
d. None of the above
Ans: a p-595
3) Which one is not Interface ?
a. HandlerExceptionResolver
b. ViewResolver
c. ModelAndView
Ans: c p-595
4) Major consideration for developing web
application choose all that apply ?
a. Performance
b. User-friendly
c. Accessibility
d. All

Ans:d
5) What is the Artifact ID of joda-time?
a. joda-time-jsptags
b. joda-time-htmltags
c. joda-time-jsftags
d. None
Ans:a
6) The usage of Spring MVC ?
a. Internationalization
b. Theming
c. Page templating
d. All
Ans:d
7) Richness to the SpringBlogeplication
highlights are ?
a.User Interface
b. Rich-text-editing
c. Data grid with pagination
d. None
Ans: a,b,c
8) The main principle of MVC is to define an
architecture with clear responsibilities for
different component?
a) True
b) False
Answer: a(page-593)
9)
GWT stands for.(page-585)
a) Google Web Toolkit
b) Google Website Toolkit
c) Google Web-based Toolkit
d) Nome
Answer: a
10) The main principle of MVC is to define an
architecture with clear responsibilities for
different component?
c) True
d) False
Answer: a(page-593)
11) Spring provides comprehensive support
the theming of web application.
a) True
b) False
Answer: a(page-610)
12) How many steps contains to implements
the show view?
a) Five
b) Four
c) Three
d) Two
Answer: c(page-620)
13) jQuery is one of the most popular
JavaScript libraries being used for
.development.(page-634)
a) Desktop application
b) Web fronted
c) Both a and b
d) None
Answer: b
14) What is needed to be able to use jQuery
and jQuery UI components in your view?
(page-634)
a) Style sheets JavaScript files

b) Style sheets Java files


c) Style sheets jsp files
d) Style sheets jsf files
Answer: a

Spring Web- flow and JSF


1) Which are Spring web flow modules?
a. spring-faces
b. spring-binding
c. spring-js
d. spring-webflow
e.All
Ans: e
2) Which is not the Spring web flow feature?
a. Flow
b.View
c. Controller
d. Conversation
Ans: c P-668
3) Which is not JSF Life Cycle phases ?
a. Restore view
b. Apply request
c. Process validation
d. Apply conversation
Ans:d p-671
4) Which are the required dependencies for
developing application using spring web flow
with primefaces?
a. org.springframework.webflow
b. com. Sun.faces
c. org.primefaces
d. All
Ans: d P-675
5) DriverManagerDatasource is the
implementation of a--a.mysqlDatasource
b. Database
c.Datasource
Ans: c
6) EntityManager Interface is the core
concept of -----a. JPA
b.SQL
c.JEE
d. JDA
Ans:a
7) Spring Web Flow is an extension to the
MVC pattern, it provides support for developing
flow based applications and supports more finegrained bean scopes.
a) True

b) False
Answer: a(page-668)
8)The architecture of Spring Web Flow is built
around by how many concepts?
a) Three
b) Four
c) Five
d) Six
Answer: a(page-668)
9)A flow is a business process
representing a use case. In Spring Web
Flow, a flow consists of a series of steps
called
a) Object
b) Model
c) Instance
d) States
Answer: d(page-668)
10) How many types of conversion?
a) Two
b) Three
c) Four
d) Five
Answer: b(page-668)
11) Which are types of conversion?
a) Request
b) Session
c) Application
d) Above all
Answer: d (page-668)
12) Available bean scopes in Spring Web
Flow..
a) Flow
b) View
c) Request
d) Flush
e) Conversation
f) Above all
Answer: f(page-669)
13) How there are many application life
cycle?
a) Five
b) Four
c) Six
d) Three
Answer: c(page-671)
14) What are the components of
application life cycle?
a) Restore view
b) Apply request
c) Process validations
d) Update model values
e) Invoke application
f) Render response
g) Above all
Answer: g (page-671)

You might also like