- EJB Tutorial
- EJB - Home
- EJB - Overview
- EJB - Environment Setup
- EJB - Create Application
- EJB - Stateless Bean
- EJB - Stateful Bean
- EJB - Persistence
- EJB - Message Driven Beans
- EJB - Annotations
- EJB - Callbacks
- EJB - Timer Service
- EJB - Dependency Injection
- EJB - Interceptors
- EJB - Embeddable Objects
- EJB - Blobs/Clobs
- EJB - Transactions
- EJB - Security
- EJB - JNDI Bindings
- EJB - Entity Relationships
- EJB - Access Database
- EJB - Query Language
- EJB - Exception Handling
- EJB - Web Services
- EJB - Packaging Applications
- EJB Useful Resources
- EJB - Quick Guide
- EJB - Useful Resources
- EJB - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
EJB Mock Test
This section presents you various set of Mock Tests related to EJB 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.
EJB Mock Test I
Q 1 - What EJB stands for?
Answer : B
Explaination
EJB stands for Enterprise Java Bean.
Q 2 - Which of the following is true about EJB?
A - EJB is an essential part of a J2EE platform.
Answer : D
Explaination
EJB stands for Enterprise Java Beans. EJB is an essential part of a J2EE platform. J2EE platform have component based architecture to provide multi-tiered, distributed and highly transactional features to enterprise level applications. EJB provides an architecture to develop and deploy component based enterprise applications considering robustness, high scalability and high performance.
Q 3 - Which of the following is true about EJB?
A - Simplified development of large scale enterprise level application.
Answer : D
Explaination
EJB provides all of the above mentioned benefits.
Q 4 - Which of the following is true about session bean?
A - This type of bean stores data of a particular user for a single session.
Answer : A
Explaination
Session bean stores data of a particular user for a single session. It can be stateful or stateless. It is less resource intensive as compared to entity beans. Session bean gets destroyed as soon as user session terminates.
Q 5 - Which of the following is true about session bean?
A - Session bean stores data of a particular user for a single session.
B - Session bean can be stateful or stateless.
C - Session bean is less resource intensive as compared to entity beans.
Answer : D
Explaination
Session bean stores data of a particular user for a single session. It can be stateful or stateless. It is less resource intensive as compared to entity beans.
Q 6 - Which of the following is true about entity bean?
A - This type of bean stores data of a particular user for a single session.
Answer : C
Explaination
Entity beans represents persistent data storage. User data can be saved to database via entity beans and later on can be retrived from the database in the entity bean.
Q 7 - Which of the following is true about entity bean?
A - User data can be saved to database via entity beans.
B - User data can be retrived from the database in the entity bean.
Answer : D
Explaination
Entity beans represents persistent data storage. User data can be saved to database via entity beans and later on can be retrived from the database in the entity bean.
Q 8 - Which of the following is true about message driven bean?
A - This type of bean stores data of a particular user for a single session.
Answer : B
Explaination
A message driven bean is a type of enterprise bean which is invoked by EJB container when it receives a message from queue or topic. Message driven bean is a stateless bean and is used to do task asynchronously.
Q 9 - Which of the following is true about message driven bean?
A - Message driven bean is a stateless bean.
Answer : D
Explaination
A message driven bean is a type of enterprise bean which is invoked by EJB container when it receives a message from queue or topic. Message driven bean is a stateless bean and is used to do task asynchronously.
Q 10 - Which of the following is true about stateful bean?
B - A stateful session bean as per its name keeps associated client state in its instance variables.
Answer : C
Explaination
A stateful session bean is a type of enterprise bean which preserve the conversational state with client. A stateful session bean as per its name keeps associated client state in its instance variables.
Q 11 - Which of the following is true about stateful bean?
A - EJB Container creates a separate stateful session bean to process client's each request.
B - As soon as request scope is over, statelful session bean is destroyed.
Answer : C
Explaination
EJB Container creates a separate stateful session bean to process client's each request. As soon as request scope is over, statelful session bean is destroyed.
Q 12 - Which of the following is true about stateless bean?
Answer : C
Explaination
A stateless session bean is a type of enterprise bean which is normally used to do independent operations. A stateless session bean as per its name does not have any associated client state, but it may preserve its instance state.
Q 13 - Which of the following is true about stateless bean?
Answer : C
Explaination
EJB Container normally creates a pool of few stateless bean's objects and use these objects to process client's request. Because of pool, instance variable values are not guaranteed to be same across lookups/method calls.
Q 14 - Which of the following bean stores data of a particular user for a single session?
Answer : A
Explaination
Session bean stores data of a particular user for a single session.
Q 15 - Which of the following bean is invoked by EJB container when it receives a message from queue or topic?
Answer : C
Explaination
Message driven bean is invoked by EJB container when it receives a message from queue or topic.
Q 16 - Which of the following bean is represents persistent data storage?
Answer : B
Explaination
Entity bean represents persistent data storage.
Q 17 - When a local session bean is used in EJB?
Answer : A
Explaination
A local session bean is used in EJB if ejb client is in same environment where ejb session bean is to be deployed.
Q 18 - When a remote session bean is used in EJB?
Answer : B
Explaination
A remote session bean is used in EJB if ejb client is in different environment where ejb session bean is to be deployed.
Q 19 - When a remote session bean is used in EJB?
Answer : B
Explaination
A remote session bean is used in EJB if ejb client is in different environment where ejb session bean is to be deployed.
Q 20 - Which of the following is correct about Entity in EJB persistence API?
A - It is a persistent object representing the data-store record. It is good to be serializable.
C - It describes the properties of persistence mechanism.
D - It describes the data-store related properties like connection url. user-name,password etc.
Answer : A
Explaination
Entity is a persistent object representing the data-store record. It is good to be serializable.
Q 21 - Which of the following is correct about EntityManager in EJB persistence API?
A - It is a persistent object representing the data-store record. It is good to be serializable.
C - It describes the properties of persistence mechanism.
D - It describes the data-store related properties like connection url. user-name,password etc.
Answer : B
Explaination
EntityManager is an interface to do data operations like add/delete/update/find on persistent object. It also helps to execute queries using Query interface.
Q 22 - Which of the following is correct about Persistence unit in EJB persistence API?
A - It is a persistent object representing the data-store record. It is good to be serializable.
C - It describes the properties of persistence mechanism.
D - It describes the data-store related properties like connection url. user-name,password etc.
Answer : C
Explaination
Persistence unit describes the properties of persistence mechanism.
Q 23 - Which of the following is correct about Data Source in EJB persistence API?
A - It is a persistent object representing the data-store record. It is good to be serializable.
C - It describes the properties of persistence mechanism.
D - It describes the data-store related properties like connection url. user-name,password etc.
Answer : D
Explaination
Data Source describes the data-store related properties like connection url. user-name,password etc.
Q 24 - Which of the following is correct about name attribute in @javax.ejb.Stateless annotation?
A - It is used to specify name of the session bean.
B - it is used to specify the JNDI name of the session bean.
Answer : A
Explaination
name attribute in @javax.ejb.Stateless annotation is used to specify name of the session bean.
Q 25 - Which of the following is correct about mappedName attribute in @javax.ejb.Stateless annotation?
A - It is used to specify name of the session bean.
B - it is used to specify the JNDI name of the session bean.
Answer : B
Explaination
mappedName attribute in @javax.ejb.Stateless annotation is used to specify the JNDI name of the session bean.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | D |
3 | D |
4 | A |
5 | D |
6 | C |
7 | D |
8 | B |
9 | D |
10 | C |
11 | C |
12 | C |
13 | C |
14 | A |
15 | C |
16 | B |
17 | A |
18 | B |
19 | B |
20 | A |
21 | B |
22 | C |
23 | D |
24 | A |
25 | B |