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

Multiple choice technology web technology
  1. page , request , out , application

  2. request , response , session , out

  3. page , request , session , application

  4. request , response , session , application

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

The jsp:useBean action defines four valid scope values: page (default), request, session, and application. The 'out' scope does not exist in JSP - 'out' is an implicit object for writing to the JSPWriter, not a bean scope. Similarly, 'response' is not a valid scope value.

Multiple choice technology databases
  1. Connection Management

  2. Bean Management

  3. Transaction Management

  4. Object relational mapping

  5. Relational Management

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

Hibernate's three main architectural components are Connection Management (handles database connections), Transaction Management (manages ACID transactions and ensures data consistency), and Object Relational Mapping (maps Java objects to database tables). These form the core framework for database interaction. Bean Management and Relational Management are not standard Hibernate architectural components - the framework uses POJOs (Plain Old Java Objects) rather than managing beans directly.

Multiple choice technology databases
  1. To create the connection pool and setup required environment

  2. To configure bean management setup environment

  3. To talk to the database directly with out this configuration file

  4. To create an object and map the data with corresponding object

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

The hibernate.cfg.xml configuration file's primary purpose is to set up the Hibernate environment - database connection parameters (driver class, URL, credentials), dialect, connection pool settings, and other runtime configurations. Option B refers to Spring bean management, Option C is incorrect (you need this file), and Option D describes mapping, not configuration.

Multiple choice technology databases
  1. Session

  2. ApplicationContext

  3. SessionFactory

  4. Hibernate Object

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

The SessionFactory is responsible for creating Session instances. It reads the configuration from hibernate.cfg.xml during initialization and provides a thread-safe factory for creating Sessions. The Session itself is created by SessionFactory, not the other way around. ApplicationContext is a Spring concept.

Multiple choice technology databases
  1. SessionFactory sessionFactory = new Configuration().configure();

  2. SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();

  3. SessionFactory sessionFactory = new Configuration().configure().sessionFactory();

  4. SessionFactory sessionFactory = new Configuration().buildSession();

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

The correct Hibernate API to create a SessionFactory is: new Configuration().configure().buildSessionFactory(). The configure() method reads hibernate.cfg.xml, and buildSessionFactory() constructs the SessionFactory. Option A is incomplete (no buildSessionFactory), Option C has a wrong method name, and Option D is incorrect.