MCQs on Java EE (Jakarta EE) | Enterprise Java Development

Master Enterprise Java Development with 30 MCQs on Java EE (Jakarta EE)

Enhance your understanding of Java EE (Jakarta EE) with 30 expertly crafted MCQs covering core topics like Enterprise JavaBeans (EJB), Java Message Service (JMS), JavaServer Faces (JSF), and more.


MCQs

1-10: Introduction to Java EE

  1. Which of the following is the primary goal of Java EE (Jakarta EE)?
    • A) To build lightweight applications
    • B) To develop robust, scalable enterprise-level applications
    • C) To focus on web development
    • D) To create mobile applications
  2. Which of the following Java EE specifications is used for creating RESTful web services?
    • A) EJB
    • B) JMS
    • C) JAX-RS
    • D) JSF
  3. Java EE is primarily based on which Java platform?
    • A) Java SE
    • B) Java ME
    • C) Java EE
    • D) JavaFX
  4. What is the role of a container in Java EE?
    • A) To manage server resources
    • B) To compile Java source files
    • C) To manage lifecycle and transactions of components
    • D) To execute Java code outside the JVM
  5. Which of the following is NOT part of the Java EE specification?
    • A) EJB
    • B) JPA
    • C) JMS
    • D) JUnit
  6. What does the term “dependency injection” in Java EE refer to?
    • A) Manually creating objects
    • B) Framework providing necessary objects to a class
    • C) Injecting dependencies via constructor
    • D) Injecting values in the database
  7. Java EE is now known as:
    • A) Jakarta EE
    • B) Java Spring
    • C) JavaFX
    • D) Java Core
  8. Which of the following features is offered by Java EE for managing the persistence layer?
    • A) JPA (Java Persistence API)
    • B) JDBC
    • C) JAX-RS
    • D) JSF
  9. Java EE applications typically consist of which type of components?
    • A) Web-based components only
    • B) Enterprise components like EJBs and servlets
    • C) Database and security components
    • D) Only frontend components
  10. In Java EE, the Enterprise JavaBeans (EJB) technology is used to develop:
    • A) Distributed business logic
    • B) User interfaces
    • C) Simple web applications
    • D) Real-time communication services

11-20: Enterprise JavaBeans (EJB)

  1. What is the main purpose of Enterprise JavaBeans (EJB)?
    • A) To manage business logic and transaction control
    • B) To create GUI components
    • C) To perform batch jobs
    • D) To handle web services
  2. Which of the following is NOT a type of EJB?
    • A) Session Bean
    • B) Message-Driven Bean
    • C) Entity Bean
    • D) Entity Query Bean
  3. Stateless session beans in EJB:
    • A) Maintain client state between method invocations
    • B) Do not maintain client state between method invocations
    • C) Are used for message-driven processing
    • D) Store database connections
  4. Which type of EJB is used to handle asynchronous messaging?
    • A) Message-Driven Bean
    • B) Stateless Session Bean
    • C) Stateful Session Bean
    • D) Singleton Bean
  5. Which EJB type is used to maintain conversational state between client invocations?
    • A) Stateless Session Bean
    • B) Stateful Session Bean
    • C) Singleton Bean
    • D) Message-Driven Bean
  6. EJB components are typically deployed in which environment?
    • A) Virtual Machine
    • B) Application Server
    • C) Client Machine
    • D) Database Server
  7. The EJB container manages all of the following EXCEPT:
    • A) Transaction management
    • B) Security
    • C) Database connectivity
    • D) Bean lifecycle
  8. Which of the following annotations is used to define a stateless session bean in EJB?
    • A) @EJB
    • B) @Stateful
    • C) @Stateless
    • D) @MessageDriven
  9. What does EJB provide in terms of transaction management?
    • A) Automatic and declarative transaction management
    • B) Manual transaction handling
    • C) External transaction management
    • D) No transaction management
  10. The method remove() in EJB is used to:
    • A) Remove a bean from the container
    • B) Remove the current transaction
    • C) Remove an entity object
    • D) Remove a message from JMS

21-30: Java Message Service (JMS) and JavaServer Faces (JSF)

  1. What is the primary function of Java Message Service (JMS)?
    • A) To manage the database connection
    • B) To handle messaging between Java applications
    • C) To provide user interface components
    • D) To execute business logic
  2. Which type of messaging model does JMS support?
    • A) Point-to-Point and Publish/Subscribe
    • B) Only Point-to-Point
    • C) Only Publish/Subscribe
    • D) Client-Server
  3. JMS is part of which Java platform?
    • A) Java SE
    • B) Java ME
    • C) Java EE
    • D) Java FX
  4. Which of the following methods is used to send a message in JMS?
    • A) sendMessage()
    • B) send()
    • C) post()
    • D) publish()
  5. In JMS, the MessageConsumer interface is used to:
    • A) Send messages to a queue
    • B) Receive messages from a queue
    • C) Publish messages to a topic
    • D) Create new queues
  6. JavaServer Faces (JSF) is used for:
    • A) Managing business logic
    • B) Building user interfaces for web applications
    • C) Managing database transactions
    • D) Handling web services
  7. Which of the following is a key feature of JavaServer Faces (JSF)?
    • A) Managed beans
    • B) Multi-threading support
    • C) Message-driven beans
    • D) Transaction management
  8. In JSF, the @ManagedBean annotation is used to:
    • A) Define a user interface component
    • B) Create a bean that can be accessed by JSF pages
    • C) Handle database operations
    • D) Bind components to the backend
  9. Which of the following is a core JSF component used to create user interface elements?
    • A) h:form
    • B) javax.servlet
    • C) @WebServlet
    • D) javax.ejb
  10. What is the purpose of the faces-config.xml file in JSF?
    • A) To define managed beans
    • B) To store database configurations
    • C) To configure Java classes
    • D) To store servlet mappings

Answer Key

QnoAnswer
1B) To develop robust, scalable enterprise-level applications
2C) JAX-RS
3A) Java SE
4C) To manage lifecycle and transactions of components
5D) JUnit
6B) Framework providing necessary objects to a class
7A) Jakarta EE
8A) JPA (Java Persistence API)
9B) Enterprise components like EJBs and servlets
10A) Distributed business logic
11A) To manage business logic and transaction control
12D) Entity Query Bean
13B) Do not maintain client state between method invocations
14A) Message-Driven Bean
15B) Stateful Session Bean
16B) Application Server
17C) Database connectivity
18C) @Stateless
19A) Automatic and declarative transaction management
20A) Remove a bean from the container
21B) To handle messaging between Java applications
22A) Point-to-Point and Publish/Subscribe
23C) Java EE
24B) send()
25B) Receive messages from a queue
26B) Building user interfaces for web applications
27A) Managed beans
28B) Create a bean that can be accessed by JSF pages
29A) h:form
30A) To define managed beans

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top