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 web technology
  1. Make the information available from a singleton

  2. Store the information in the ServletContext

  3. Store the information in an HttpSession

  4. Store the information in a Properties file

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

ServletContext is shared across the entire web application, making it the standard mechanism to store dynamic information accessible to all servlet requests.

Multiple choice technology web technology
  1. Cookies

  2. URL rewriting

  3. HttpSessions

  4. Hidden tags

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

HttpSession stores state on the server side, making it independent of client browser settings. The session ID can be transmitted via cookies or URL rewriting as a fallback, ensuring reliable state management.

Multiple choice technology web technology
  1. They are instantiated every time a request is made

  2. They are a mechanism used by the class loader to download applets

  3. They can be used instead of CGI scripts

  4. They require a web browser that supports JDK 1.1

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

Servlets are server-side Java programs that extend server capabilities, typically running in a web container with a single instance handling multiple requests via threading (not reinstantiated per request). They can replace CGI scripts for generating dynamic web content and run entirely on the server, so client browser JDK support is irrelevant. The statement about class loaders downloading applets is unrelated to servlets - that describes applet mechanisms, not servlet technology.

Multiple choice technology web technology
  1. Client side program

  2. Server side program

  3. Both are true

  4. None of these

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

A servlet is a Java program that runs on a server side, typically within a web container. It handles client requests and generates dynamic responses, extending the server's capabilities. Servlets are not client-side programs (like JavaScript), and the question asks for a binary choice between client and server side.

Multiple choice technology web technology
  1. Persistent Objects

  2. Database Tables

  3. Only a

  4. Both a & b

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

Hibernate is an ORM (Object-Relational Mapping) framework that maps Java classes (persistent objects) to database tables. The mapping allows Java objects to be persisted to and retrieved from a relational database without writing SQL. Option C is garbled and should read 'Only A'. Option D is incorrect because it's not 'both' - the tables are the destination, not a parallel mapping.

Multiple choice technology web technology
  1. utility classes

  2. Pojo

  3. both 1 & 2

  4. none

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

Hibernate uses POJO (Plain Old Java Objects) classes for mapping Java objects to database tables. The mapping is typically done through XML mapping files or Java annotations on POJO classes. Utility classes are not the primary mapping mechanism in Hibernate.

Multiple choice technology web technology
  1. gives an error

  2. generates ID automatically

  3. throws exception

  4. none of the above

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

Hibernate automatically generates unique identifiers for entities based on the configured generator strategy (like 'increment', 'native', 'uuid', etc.). This is a core feature of Hibernate - you don't need to manually generate or manage primary keys. The framework handles this through the element in mapping files or annotations.

Multiple choice technology web technology
  1. True

  2. False

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

Hibernate Types are indeed used to map Java property types to JDBC types, enabling the translation between Java objects and database columns. Each Java type (String, Integer, Date, etc.) has a corresponding Hibernate Type that knows how to convert to and from appropriate JDBC types for database operations.

Multiple choice technology programming languages
  1. An IllegalStateException is thrown at runtime.

  2. An InvalidSessionException is thrown at runtime.

  3. The string "value=null" appears in the response stream.

  4. The string "value=myAttributeValue" appears in the response stream.

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

Calling session.invalidate() immediately invalidates the session. Any subsequent attempt to call session.getAttribute() or perform operations on that invalidated session object will throw an IllegalStateException at runtime.

Multiple choice technology programming languages
  1. The HttpServletRequestWrapper is an example of the Decorator pattern.

  2. The HttpServletRequestWrapper can be used to extend the functionality of a servlet request.

  3. A subclass of HttpServletRequestWrapper CANNOT modify the behavior of the getReader method.

  4. An HttpServletRequestWrapper may be used only by a class implementing the javax.servlet.Filter interface.

  5. An HttpServletRequestWrapper CANNOT be used on the request passed to the RequestDispatcher.include

  6. An HttpServletRequestWrapper may modify the header of a request within an object implementing the

Reveal answer Fill a bubble to check yourself
A,B,F Correct answer
Multiple choice technology programming languages
  1. HttpSession

  2. ServletConfig

  3. ServletContext

  4. HttpServletRequest

  5. HttpServletResponse

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

The HttpServletRequest object is passed during a request forward. Attributes stored in the request are shared only with the forwarded resource for that specific request lifecycle, keeping them invisible to other sessions or unrelated servlets.

Multiple choice technology programming languages
  1. True

  2. False

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

This statement is false. JVMTI (JVM Tool Interface) was introduced in JDK 5.0 (1.5) as a replacement for JVMPI (JVM Profiling Interface) and JDWP (Java Debug Wire Protocol). JDK 1.4 did NOT contain JVMTI - it used the older JVMPI profiling interface instead. JVMTI is the profiling/debugging tool in JDK 1.5 and later, not in 1.4.