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

  2. setContent

  3. setContentType

  4. setResponseContentType

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

The HttpServletResponse class provides the setContentType(String) method to specify the MIME type of the response content. This tells the browser how to interpret the returned data (e.g., text/html, application/json).

Multiple choice technology web technology

A user types the URL http://www.javaprepare.com/scwd/index.html . Which HTTP request gets generated. Select the one correct answer.

  1. GET method

  2. PUT method

  3. POST method

  4. HEAD method

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

To understand the type of HTTP request generated, the user needs to know the following:

  • HTTP request methods
  • The structure of a URL

The HTTP request method indicates the type of action the client wants the server to perform on a resource. The structure of a URL is made up of several parts, including the protocol, domain name, and path.

When a user types the URL http://www.javaprepare.com/scwd/index.html:

Based on this information, the correct answer is:

The Answer is: A (GET method)

The GET method is used to request a representation of the specified resource. In this case, the user is requesting the resource located at http://www.javaprepare.com/scwd/index.html by typing the URL into their web browser. As a result, a GET method HTTP request is generated to retrieve the resource.

Multiple choice technology web technology
  1. ServeltRequest

  2. HttpSession

  3. ServletConfig

  4. ServletContext

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

To answer this question, the user needs to know about the different levels of scope in Java web applications.

ServletRequest refers to the request scope, which is the smallest level of scope and lasts only for the duration of a single request.

HttpSession refers to the session scope, which lasts for the duration of a user's session with the web application.

ServletConfig refers to the servlet configuration scope, which is used to pass initialization parameters to a servlet.

ServletContext refers to the application scope, which is the largest level of scope and lasts for the duration of the web application.

Therefore, the correct answer is:

The Answer is: D. ServletContext

Multiple choice technology programming languages
  1. Pojo classes

  2. Poto classes

  3. Session classes

  4. Persistent classes

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

Hibernate uses POJO (Plain Old Java Objects) classes as entity classes. These are simple Java classes with no special requirements (no need to extend specific classes) and use annotations or XML mappings for persistence configuration.

Multiple choice technology programming languages
  1. only one session factory is created

  2. depends on the application developed

  3. depends on thesession interfaces to be created

  4. Atleast 2 factories has to be created

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

A SessionFactory in Hibernate is a heavyweight, thread-safe object that is initialized once during application startup. Because it manages connections and mappings for the database, only one instance is typically created and shared across the entire application, making the other options incorrect.

Multiple choice technology programming languages
  1. maps domain object with the corresponding entity in databse

  2. mapping from property to primary cloumn

  3. generates unique identifiers for instances

  4. declares a persistent ,Java Bean style

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

The element in Hibernate mapping documents declares a persistent property of a Java class following JavaBean conventions. It maps a JavaBean property to a database column but does not handle primary key mapping (that's ) or identifier generation (that's ).

Multiple choice technology web technology
  1. Java servlet paper

  2. Java server Paper

  3. Java Server Pages

  4. None

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

JSP stands for Java Server Pages, which is a server-side technology that extends Servlet capabilities by allowing dynamic content generation with Java code embedded in HTML templates.

Multiple choice technology web technology
  1. init(ServletConfig config)

  2. service( ServletRequest req, ServletResponse res)

  3. destroy( ServletRequest req, ServletResponse res)

  4. destroy()

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

Servlet lifecycle has three key methods: init() for initialization (receives ServletConfig), service() for handling requests (receives request/response objects), and destroy() for cleanup (no parameters). Option C incorrectly shows destroy() with request/response parameters.

Multiple choice technology web technology
  1. They are a part of J2SE1.4

  2. They are not part of J2SE1.4

  3. They provide developers with parser-implementation API to process XML

  4. They do not support validation of XML documents against schema

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

JAXP (Java API for XML Processing) was integrated into J2SE 1.4, making it part of the standard Java platform (option A correct). It provides parser-implementation APIs that enable developers to process and manipulate XML documents through DOM, SAX, and XSLT interfaces (option C correct). Option B is false because JAXP is indeed part of J2SE 1.4. Option D is false because JAXP does support validation of XML documents against schemas (DTD, XSD). These characteristics made JAXP the standard Java XML processing API, eliminating the need for vendor-specific XML parsers.

Multiple choice technology web technology
  1. Can be used to generate server side and client side Java (Web Service) code from a WSDL

  2. Can be used to generate a WSDL from Java (Web Service) code

  3. None

  4. Both

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

JAX-RPC supports both code generation directions: from WSDL to Java (client/server stubs) and from Java to WSDL. This bidirectional support enables both top-down (start with WSDL) and bottom-up (start with Java) web service development approaches.