Computer Knowledge

Java Enterprise and Web Technologies

2,279 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 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 web technology
  1. Master Page

  2. Page Class

  3. Session Class

  4. None of the Above

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

Page Class is correct because all ASP.NET Web Forms inherit from the System.Web.UI.Page class, which provides the base functionality for web pages. Master Page (A) is used for consistent layouts but is not the base class, Session Class (C) manages state, and 'None of the Above' is incorrect.

Multiple choice technology web technology
  1. Rule-Connect-SOAP

  2. Rule-Connect-WebService

  3. Connector

  4. Rule-Service-SOAP

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

In Pega PRPC, Rule-Connect-SOAP is the rule type used to connect to SOAP-based web services for fetching data. Rule-Connect-WebService is a more generic connector, but Rule-Connect-SOAP is specifically designed for SOAP services which is what the question asks about.

Multiple choice technology web technology
  1. Rule-Obj-Flow

  2. Rule-Activity

  3. Rule-Obj-Activity

  4. They are each separate rule types

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

In Pega, Router, Notify, and Utility shapes in a flow rule execute activities. All activities are instances of the Rule-Obj-Activity rule type, with their specific behavior type (like Router or Utility) specified in their Security tab.

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).

Multiple choice technology security
  1. LoginException

  2. EnterpriseSecurityException

  3. SecurityException

  4. IntrusionException

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

The login method throws EnterpriseSecurityException, which is a custom exception specific to the security framework being used. Standard Java exceptions like LoginException, SecurityException, or IntrusionException are not the correct custom exception for this API.

Multiple choice technology security
  1. void setNoCacheHeaders(javax.servlet.http.HttpServletResponse response)

  2. void setNoCacheHeaders(javax.servlet.http.HttpServletRequest request)

  3. boolean setNoCacheHeader(javax.servlet.http.HttpServletResponse response)

  4. void setNoCacheHeaders(javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException

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

The setNoCacheHeaders() method takes an HttpServletResponse parameter and sets cache-control headers to prevent browsers and proxies from caching sensitive content. It doesn't need HttpServletRequest, doesn't return a boolean, and doesn't throw ServletException.

Multiple choice technology security
  1. encryptHiddenField(java.lang.String value)

  2. addCSRFToken(final java.lang.String href)

  3. verifySecureComm(javax.servlet.http.HttpServletRequest request)

  4. setSafeContentType(javax.servlet.http.HttpServletResponse response)

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

The addCSRFToken() method is specifically designed to add CSRF protection tokens to links, which is the primary defense against cross-site request forgery attacks. The other methods serve different purposes: encryption, secure communication verification, and content type setting.

Multiple choice technology security
  1. It checks if the http request is made on an SSL channel

  2. It checks if the http method is a POST

  3. Both of the above

  4. None of the above

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

The isSecureRequest method checks both SSL channel (HTTPS) and POST method. This dual check is important because sensitive data should be transmitted over SSL and state-changing operations should use POST, not GET.