Computer Knowledge

Java Enterprise and Web Technologies

2,183 Questions

Java enterprise and web technologies questions focus on J2EE architecture, web services like SOAP, and servlet functionalities. These topics frequently appear in IT officer and specialist scale examinations. Regular practice ensures familiarity with enterprise application components.

HttpServlet methodsSOAP and web servicesEJB architecture rolesJ2EE componentsJSP servlet callingUDDI concepts

Java Enterprise and Web Technologies Questions

Multiple choice technology architecture
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Entity bean primary keys must be serializable and comparable to support caching and database operations. The answer is False because Java primitive types (int, long, etc.) are not objects and cannot be used directly. Instead, you must use wrapper classes (Integer, Long, String) or custom primary key classes that implement Serializable. The container needs to handle primary keys as objects for operations like findByPrimaryKey.

Multiple choice technology architecture
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

EJB callback methods like ejbCreate and ejbRemove have standardized signatures in the EJB specification, but their internal implementation varies by application server vendor. The answer is True because while the API contract is the same (method names, signatures, and behavior requirements), each vendor (WebLogic, JBoss, WebSphere, etc.) implements these differently internally. The container manages the bean lifecycle, and vendor implementations optimize this differently.

Multiple choice technology architecture
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Message Driven Beans (MDBs) share structural similarities with Session Beans. The answer is True because MDBs follow the same lifecycle callback pattern (ejbCreate, ejbRemove) as session beans, and they're also managed by the container. The key difference is MDBs don't have a client-visible interface - they respond to JMS messages instead of direct client calls. But structurally, they mimic session bean patterns for lifecycle management.

Multiple choice technology programming languages
  1. A browser that uses a plug-in to process user data.

  2. A distributed application where the client program does not process data, but instead passes data for processing to an enterprise bean running on an application server

  3. An application that cannot be stopped by firewall

  4. An application compiled with the thin option of the javac command

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A thin-client application is characterized by minimal processing on the client side. The client primarily handles the user interface and passes data to server-side components (like enterprise beans) for actual business logic and data processing. This reduces client-side resource requirements.

Multiple choice technology programming languages
  1. Special icons for creating the user interface elements for thin clients

  2. A data module saved to the component area of the database.

  3. A self-contained functional software unit that is assembled into a J2ee application and interfaces with other application components

  4. A JAR file

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

A J2EE component is a self-contained, reusable software unit that is assembled into a J2EE application. Components like EJBs, servlets, and JSPs have defined interfaces and interact with other components through containers, enabling modular enterprise application development.

Multiple choice technology programming languages
  1. Entity-bean data survives crashes.

  2. An entity-bean represents non-persistent data.

  3. It creates its own JAR file during deployment

  4. You get authentication code without having to write any.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Entity beans represent persistent business data that survives system crashes because they are backed by a database. Session beans, in contrast, are transient and only exist for the duration of a client session, representing business processes rather than persistent state.

Multiple choice technology programming languages
  1. When you want to be certain your application data persists between program invocations , even in the event of a crash

  2. If you need to initiate a database transaction

  3. To process transient data that can be re-created in the event of a crash.

  4. to keep people who do not know how to program , from accidentally changing important logic code.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Session beans are designed for transient, short-lived operations that don't need to survive crashes. They process business logic that can be restarted if lost. Persistence between program invocations requires entity beans or database storage. Database transactions can be initiated from various components, not just session beans.

Multiple choice technology programming languages
  1. To make the user interface more interesting.

  2. To simplify application deployment.

  3. To prevent malicious programs from gaining access to sensitive information on your database server.

  4. To make the application much easier to update, maintain, and manage

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Separating user data entry (JSP) from business logic (JavaBeans) follows the Model-View-Controller pattern, making applications easier to maintain and update. Changes to the UI (JSP) don't affect business logic (JavaBeans), and vice versa. This is about maintainability, not security, deployment, or visual interest.

Multiple choice technology programming languages
  1. The thin client.

  2. Deployment descriptors

  3. The JAR file.

  4. The bean's container

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In J2EE, the EJB container handles all database access (data storage and retrieval) for container-managed persistence (CMP) entity beans. Thin clients, deployment descriptors, and JAR files do not execute database operations or manage bean persistence directly.

Multiple choice technology programming languages
  1. When you implement entity or session bean methods to use SQL commands you provide

  2. When the bean's container handles data storage and retrieval.

  3. When the J2EE server is never shut down.

  4. When changes to database data are lost during a crash

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Bean-managed persistence means the bean developer writes explicit SQL/JDBC code in the bean's methods to handle database operations. Container-managed persistence (the alternative) lets the container handle storage automatically. The J2EE server shutdown and crash scenarios are unrelated to the persistence mechanism type.

Multiple choice technology programming languages
  1. By thin clients.

  2. By calls to the database

  3. By the J2EE server.

  4. By the bean's container.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Life cycle methods (ejbCreate, ejbRemove, etc.) are called by the bean's container, not by clients, the server directly, or database calls. The container manages bean instances and invokes these methods at appropriate times during the bean's life cycle. This is fundamental to EJB architecture.

Multiple choice technology security
  1. SQL Injection

  2. Denial of Service

  3. XML Injection

  4. All of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

To answer this question, the user needs to have knowledge of common web application attacks and their impact on web services.

Now, let's go through each option and explain whether it is right or wrong:

A. SQL Injection: This type of attack targets the database layer of the application and is not specific to web service interfaces. However, if a web service is accessing a database and is not properly secured against SQL injection attacks, then the web service can be compromised. Therefore, SQL injection can be a threat to web services but is not specific to them.

B. Denial of Service: This type of attack floods the target with traffic or requests, making it unavailable to legitimate users. Web services are often targeted by denial of service attacks because they are critical components of many applications. Therefore, denial of service attacks are a threat to web services.

C. XML Injection: This type of attack exploits vulnerabilities in the way XML data is processed by an application. Although web services often use XML to exchange data, XML injection is not specific to web services. However, if a web service is not properly secured against XML injection attacks, then it can be compromised. Therefore, XML injection can be a threat to web services but is not specific to them.

D. All of the above: This option is correct because all of the attacks listed (SQL injection, denial of service, and XML injection) can be a threat to web services. Web service interfaces are exposed to the same attacks as other web applications and must be secured accordingly.

The Answer is: D

Multiple choice technology security
  1. Page Scope

  2. Session Scope

  3. Request Scope

  4. Application Scope

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Session scope stores data that persists across multiple requests from the same user session, making it specific to that user. Page scope is for a single page, request scope lasts only for one HTTP request, and application scope is shared across all users and sessions. Session data typically includes user identity, shopping cart contents, or preferences.

Multiple choice technology security
  1. The length of the User's Session

  2. The length of a single HTTP response

  3. The length of a single HTTP request

  4. Until the server is rebooted

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Request scope exists only for the duration of processing a single HTTP request/response cycle. Variables in request scope are created when the request arrives and destroyed after the response is sent. This is shorter than session scope (A) and application scope (D).