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
  1. As a CGI script

  2. As an independent process

  3. By one of Tomcat's threads

  4. None of the above is correct

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

Tomcat executes JSP pages using threads from its thread pool rather than spawning separate processes or using CGI. When a JSP is requested, Tomcat uses one of its worker threads to execute the compiled servlet (which is what a JSP becomes after compilation), making it much more efficient than CGI scripts or separate processes.

Multiple choice
  1. Java applet.

  2. Java servlet.

  3. Either 1 or 2 above.

  4. Neither 1 nor 2 above.

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

JSP pages are translated into Java servlets by the JSP container. The servlet is then compiled into bytecode and executed by the server. This transformation happens automatically the first time the JSP is accessed or when it's modified. Options A is incorrect because applets run on the client side, not the server.

Multiple choice
  1. VBScript only

  2. Jscript only

  3. Java only

  4. All of the above are supported

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

JSP uses Java as its primary server-side scripting language. While JavaScript may appear in client-side code within JSP pages, the server-side scriptlets and expressions must be written in Java. Options A and B are Microsoft technologies not used in JSP, and D is incorrect because JSP does not support VBScript or JScript.

Multiple choice
  1. Apache Tomcat

  2. Apache Web server

  3. Sun servlet processor

  4. None of the above is correct

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

Apache Tomcat is the servlet container developed jointly by Apache Foundation and Sun Microsystems (now Oracle). It implements Java servlet and JSP specifications. The Apache Web server (option B) serves static content and is not a servlet processor, and there is no official 'Sun servlet processor' product.

Multiple choice
  1. A Java application

  2. A Java applet

  3. A Java servlet

  4. None of the above is correct

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

Java servlets run on the web server and respond to HTTP requests. They are the server-side counterpart to applets. Option A is incorrect because standalone Java applications aren't invoked via HTTP, and B is wrong because applets run client-side in browsers, not on servers.

Multiple choice
  1. There are no public instance variables.

  2. All persistent values are accessed using getxxx and setxxx methods.

  3. It may have many constructors as necessary.

  4. All of the above are true of a Java bean.

Reveal answer Fill a bubble to check yourself
C Correct answer
Multiple choice
  1. As a CGI script

  2. As an independent process

  3. By one of Tomcat's threads

  4. None of the above is correct

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

Tomcat executes JSP pages using threads from its thread pool, not as separate processes or CGI scripts. When a JSP is accessed, Tomcat's threads handle the request within the servlet container's process. This threading model is more efficient than spawning new processes for each request (CGI model).

Multiple choice
  1. A Java application

  2. A Java applet

  3. A Java servlet

  4. None of the above is correct

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

A Java applet is a small application designed to run in a web browser. It is sent to the user via HTTP, invoked on the user's computer using the HTTP protocol, and executes as an application within the browser's JVM. A Java application runs standalone, not via HTTP. A Java servlet runs on the server side, not the client side.

Multiple choice
  1. Java virtual machine

  2. Java compiler

  3. Java bytecode

  4. A Web browser

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

To run a compiled Java program, the machine must have the Java Virtual Machine (JVM) loaded and running. The JVM interprets Java bytecode and executes it on the host machine. The Java compiler is only needed during development to compile source code. Java bytecode is what the JVM executes, not what runs the program. A web browser is not required unless it's an applet.

Multiple choice
  1. Both Type 1 and Type 2

  2. Both Type 1 and Type 3

  3. Both Type 3 and Type 4

  4. Type 4 only

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

JDBC driver Type 3 and Type 4 are pure Java drivers that can be used in either applet or servlet code. Type 3 is a net-protocol driver that converts JDBC calls to a database-independent protocol, while Type 4 is a native-protocol pure Java driver. Type 1 (JDBC-ODBC bridge) and Type 2 (native API partly Java) require native libraries and are platform-dependent, making them unsuitable for applets.

Multiple choice
  1. Java virtual machine

  2. Java compiler

  3. Java bytecode

  4. A Web browser

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

To run a compiled Java program, the machine must have the Java Virtual Machine (JVM) loaded and running. The JVM interprets Java bytecode and executes it on the host machine. The Java compiler is only needed during development to compile source code. Java bytecode is what the JVM executes, not what runs the program. A web browser is not required unless it's an applet.

Multiple choice
  1. Both Type 1 and Type 2

  2. Both Type 1 and Type 3

  3. Both Type 3 and Type 4

  4. Type 4 only

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

JDBC driver Type 3 and Type 4 are pure Java drivers that can be used in either applet or servlet code. Type 3 is a net-protocol driver that converts JDBC calls to a database-independent protocol, while Type 4 is a native-protocol pure Java driver. Type 1 (JDBC-ODBC bridge) and Type 2 (native API partly Java) require native libraries and are platform-dependent, making them unsuitable for applets.

Multiple choice
  1. A Java application

  2. A Java applet

  3. A Java servlet

  4. None of the above is correct

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

A Java applet is a small application designed to run in a web browser. It is sent to the user via HTTP, invoked on the user's computer using the HTTP protocol, and executes as an application within the browser's JVM. A Java application runs standalone, not via HTTP. A Java servlet runs on the server side, not the client side.

Multiple choice
  1. Apache Tomcat

  2. Apache Web server

  3. Sun servlet processor

  4. None of the above is correct

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

Apache Tomcat is the servlet processor developed jointly by the Apache Foundation and Sun Microsystems. Tomcat is an open-source web server and servlet container that implements Java Servlet and JavaServer Pages (JSP) technologies. The Apache Web server serves static content but doesn't process servlets. There is no 'Sun servlet processor' as a separate product.

Multiple choice
  1. VBScript only

  2. Jscript only

  3. Java only

  4. All of the above are supported

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

Java Server Pages (JSP) supports Java only for scripting and programming. JSP technology allows embedding Java code in HTML pages using scriptlets, expressions, and declarations. VBScript and JScript are Microsoft technologies used in Active Server Pages (ASP), not JSP. JSP was specifically designed to work with Java, not multiple languages.