Joqpqphevj
Joqpqphevj
Direct Questions:
What is the purpose of the Java enterprise application model?
• Answer: It defines how various components of an enterprise application are
organized to ensure portability, security, and high developer productivity.
What are the three essential components widely used in Java EE applications?
Unit 2
Direct Questions:
What is design patterns ,and list four primary categories of design patterns?
A) Factory Pattern
B) Singleton Pattern
C) Observer Pattern
D) Proxy Pattern
Answer: B) Singleton Pattern
3. In a Singleton pattern, why is the constructor of the class made private?
A) Structural Patterns
B) Creational Patterns
C) Algorithmic Patterns
D) Concurrency Patterns
Answer: C) Algorithmic Patterns
5. Which of the following patterns defines the interaction between objects?
A) Behavioral Patterns
B) Structural Patterns
C) Creational Patterns
D) MVC Patterns
Answer: A) Behavioral Patterns
6. Which of the following is a commonly used Structural Pattern?
A) Singleton Pattern
B) Observer Pattern
C) Factory Pattern
D) Adapter Pattern
Answer: D) Adapter Pattern
7. What role does the controller play in MVC architecture?
A) To handle UI components
B) To define security policies
C) To enable communication between different components
D) To handle user requests
Answer: C) To enable communication between different components
9. Which of the following is NOT part of the MVC architecture?
A) Model
B) Controller
C) Observer
D) View
Answer: C) Observer
10. What kind of pattern is the Factory Pattern classified under?
A) Structural Pattern
B) Creational Pattern
C) Behavioral Pattern
D) Concurrency Pattern
Answer: B) Creational Pattern
Unit 7
Direct Questions:
What is JSF and list 3 Benefits of JSF?
What are the two main phases in the lifecycle of a JSF application?
• The two main phases are the execute phase and the render phase.
What is managed bean and list the five scope options for a managed bean in JSF?
• The managed bean implements the logic for the application.
The five scope options are request, session, application, view, and none.
Unit 8
What are the components required in a typical JSF Web page?
Answer:
• Namespace declarations
• HTML head and body tags (optional)
• Form tag for user input components
•
Unit 9
What is Facelets and list 3 Advantages of Facelets?
Answer: Facelets is a Web template system used to create Web pages with the help
of a view declaration language.
Advantages of Facelets:
Facelets allow the developer to create templates and composite components.
JSF allows for content reuse through referencing a file or through defining custom
tags
The compilation time for Facelets is less and it allows compile time validation of EL
expressions.
3. Which phase in the Facelets lifecycle handles the rendering of the response?
a) Execute phase
b) Render phase
c) Navigation phase
d) View phase
Answer: b) Render phase
9. Where are Facelets web resources such as images and stylesheets typically
stored?
a) /webpages
b) /resources
c) /meta
d) /components
Answer: b) /resources
Unit 10
Multiple-Choice Questions
1. Which of the following is NOT a feature provided by enterprise beans?
o A) Transaction management
o B) Scalability
o C) Direct database access
o D) Security authorization
o Answer: C) Direct database access
2. Which version of EJB introduced significant lightweight enhancements for
Web services?
o A) EJB 1.0
o B) EJB 2.0
o C) EJB 3.2
o D) EJB 4.0
o Answer: C) EJB 3.2
3. Which package must be imported to implement message-driven beans?
o A) javax.ejb.MessageDriven
o B) javax.jms.message
o C) javax.ejb.SessionBean
o D) javax.persistence.Entity
o Answer: B) javax.jms.message
4. How does an EJB container help manage transactions?
o A) By automatically rolling back failed transactions
o B) By requiring developers to manually manage transactions
o C) By storing transactions in a file system
o D) By preventing transactions from being aborted
o Answer: A) By automatically rolling back failed transactions
5. Which type of session bean is best suited for a Web service endpoint?
o A) Stateful
o B) Stateless
o C) Singleton
o D) Entity
o Answer: C) Singleton
What happens when a local client accesses a bean method with passed
parameters?
• A) It operates on a copy of the parameter.
• B) It operates on the actual parameter.
• C) The parameter is ignored.
• D) The method fails to execute.
• Answer: B) It operates on the actual parameter.
Unit 11
Multiple-Choice Questions
1. Which of the following is NOT a valid persistent data type in JPA?
o A) java.math.BigInteger
o B) java.sql.Blob
o C) java.util.Date
o D) java.math.BigDecimal
Answer: B) java.sql.Blob
2. What is the default access modifier for instance variables in an entity class?
o A) Public
o B) Private or Protected
o C) Default (package-private)
o D) None of the above
Answer: B) Private or Protected
3. Which annotation is used to map an entity class to a database table?
o A) @Table
o B) @Column
o C) @Entity
o D) @Id
Answer: C) @Entity
4. Which annotation is used to indicate a composite primary key in JPA?
o A) @CompositeKey
o B) @IdClass
o C) @PrimaryKey
o D) @EmbeddedId
Answer: B) @IdClass
5. Which of the following interfaces can be used to represent a collection of
objects in an entity?
o A) java.util.List
o B) java.util.Set
o C) java.util.Map
o D) All of the above
Answer: D) All of the above
6. What is required if an entity class contains a persistent property?
o A) Getter and setter methods
o B) A constructor
o C) A toString() method
o D) An equals() method
Answer: A) Getter and setter methods
7. Which annotation is used to define a many-to-many relationship?
o A) @ManyToMany
o B) @OneToMany
o C) @ManyToOne
o D) @Relationship
Answer: A) @ManyToMany
8. Which of the following is NOT a requirement for a primary key class?
o A) Must be public
o B) Must implement Serializable
o C) Must extend another class
o D) Must have a default constructor
Answer: C) Must extend another class
9. Which of the following statements about transient fields in JPA is TRUE?
o A) They must be explicitly initialized in the constructor
o B) They are not stored in the database
o C) They must have getter and setter methods
o D) They can only be of primitive data types
Answer: B) They are not stored in the database
10. Which JPA annotation is used to validate that a field cannot be null?
o A) @Size
o B) @NonNull
o C) @NotNull
o D) @Valid
Answer: C) @NotNull
Unit 13
What are administered objects in JMS, and what are the two types?
• Answer: Administered objects are configuration objects for JMS clients, and
the two types are Connection Factories and Destinations.
Unit 15
What are the three layers of security mechanisms defined in Java EE applications?
• Answer: Application Layer Security, Transport Layer Security, and Message
Layer Security.
Multiple-Choice Questions
1. Which of the following is NOT a characteristic of security mechanisms?
• A) Authentication
• B) Efficiency
• C) Data Integrity
• D) Non-repudiation
• Answer: B) Efficiency
2. What is the main purpose of message layer security?
• A) To protect communication only between two entities
• B) To allow security mechanisms to be applied only to a part of the message
• C) To depend entirely on the transport protocol
• D) To eliminate the need for encryption
• Answer: B) To allow security mechanisms to be applied only to a part of the
message
3. Which security mechanism ensures that users cannot deny an action they
performed?
• A) Authorization
• B) Authentication
• C) Non-repudiation
• D) Confidentiality
• Answer: C) Non-repudiation
4. What is a disadvantage of application layer security?
• A) It cannot protect communication between components
• B) It is not fine-grained
• C) It is not transferable among multiple application types
• D) It does not allow for secure authentication
• Answer: C) It is not transferable among multiple application types
5. What is the role of JAAS in Java security?
• A) It provides authentication and authorization services
• B) It encrypts data during communication
• C) It prevents unauthorized users from accessing databases
• D) It ensures role-based access to files only
• Answer: A) It provides authentication and authorization services
Which Java security mechanism is NOT part of Java EE but works at the
application layer?
• a) Declarative security
• b) Message security
• c) Programmatic security
• d) Form-based authentication
• Answer: b) Message security