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 programming languages
  1. setContentWriter()

  2. setWriter()

  3. setPrintType()

  4. setContentType()

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

The setContentType() method must be called before using PrintWriter because it sets the content type (MIME type) of the response being sent to the client. Once the PrintWriter is obtained and used to write content, the response headers are committed and cannot be modified.

Multiple choice technology programming languages
  1. AirthmaticFormat

  2. CurrencyFormat

  3. NumberFormat ==

  4. StringBuffer

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

To solve this question, the user needs to know what class can be used for formatting money on a JSP page.

The correct answer is:

C. NumberFormat

Option C is correct because the NumberFormat class is used for formatting numbers, including currency values. It provides methods for formatting numbers into strings that can be displayed on a JSP page. The CurrencyFormat class does not exist in Java and AirthmaticFormat and StringBuffer are not used for formatting currency values.

Therefore, the answer is: C. NumberFormat.

Multiple choice technology programming languages
  1. <%= expressions %>

  2. <% code fragment %

  3. <%! Declarations %>

  4. <%-- comment -- %>

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

The <% code fragment %> tag (scriptlet) contains Java code fragments that are valid in the page scripting language. This code is placed in the _jspService() method of the generated Servlet and executes during request processing.

Multiple choice technology programming languages
  1. None of the above

  2. content safe

  3. synchornised

  4. thread safe

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

Setting <%@ page isThreadSafe="false" %> indicates the JSP is not thread-safe, implementing the SingleThreadModel interface. This ensures only one thread executes the JSP at a time by serializing requests through the same servlet instance, making it thread-safe by preventing concurrent access.

Multiple choice technology web technology
  1. service() method is invoked by the container once per request.

  2. service() method can be invoked only once.

  3. init() is invoked by the container only once per request.

  4. init() is invoked by the container only once per instance.

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

In the servlet lifecycle, the service() method is invoked by the container for each incoming request, making it responsible for request processing. The init() method is called only once per servlet instance when it's first loaded, not for each request. This lifecycle design ensures efficient resource management - initialization happens once, while request handling can occur many times concurrently.

Multiple choice technology web technology
  1. Generic Servlet is an Abstract Class and it extends Servlet Config Class

  2. HttpServlet is an Abstract class extending Generic Servlet Abstract Class.

  3. HttpServlet is an Abstract Class that extends Servlet Interface.

  4. Generic Servlet is an Abstract Class and it extends Servlet Config Interface

Reveal answer Fill a bubble to check yourself
B,D Correct answer
Multiple choice technology web technology
  1. True

  2. False

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

SOA (Service-Oriented Architecture) is an architectural design pattern that can be implemented using various technologies including web services, CORBA, REST APIs, message queues, or other distributed computing approaches. Web services are one popular implementation but not the only way.

Multiple choice technology web technology
  1. Simple Access API for Java

  2. SOAP with Attachments API for Java

  3. Serial Access API for Java

  4. Sun Access API for Java

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

SAAJ stands for SOAP with Attachments API for Java. It's a Java API for creating and sending SOAP messages with attachments. The other options are fabricated: Simple Access, Serial Access, and Sun Access are not real Java API names.