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. 1) ServletContext doesn't have one of these two methods.

  2. 2) String and InputStream

  3. 3) URL and InputStream

  4. 4) URL and StreamReader

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

The ServletContext interface defines getResource(String path), which returns a URL object, and getResourceAsStream(String path), which returns an InputStream object.

Multiple choice technology programming languages
  1. 1) There is no such method.

  2. 2) It has two paramters: request and response

  3. 3) It has one parameter of type String which is the relative URL of the page to include.

  4. 4) This method is appropiate to use within a Tag class.

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

PageContext.include(String relativeUrlPath) includes the specified resource and executes it. Option C correctly identifies this signature with a single String parameter. Option D is also correct because this method is available for use within Tag handler classes. Option B is wrong - there's no two-parameter version with just request and response. The method exists (unlike option A claims).

Multiple choice technology programming languages
  1. 1) yes

  2. 2) no

  3. 3) only the second part of the statement is true.

  4. 3) only the first part of the statement is true.

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

In JSP custom tags, the getParent() method of a Tag handler returns its parent tag. For top-level tags, it returns null, and for nested tags, it returns the innermost enclosing tag handler instance.

Multiple choice technology programming languages
  1. 1) By calling the method with an absolute path as the argument

  2. 2) By enconding the path with HttpServletResponse.endcodeURL method

  3. 3) By enconding the path with HttpServletResponse.endcodeRedirectURL method

  4. 4) If you use sendRedirect the session is lost.

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

To maintain a session during a client-side redirect, you must encode the redirect URL using HttpServletResponse.encodeRedirectURL(String url), which appends the session ID if cookies are disabled. encodeURL is used for normal links.

Multiple choice technology programming languages
  1. 1) It only contains the element role-name (besides element description)

  2. 2) Only the role-name specified in security-role-ref can be used

  3. 3) It is a subelement of web-resource-collection

  4. 4) It is related to authentication

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

The auth-constraint element in web.xml specifies which roles are authorized to access protected resources. It contains role-name elements (plus optional description). Option A is correct. Option B is wrong because auth-constraint uses actual role names, not just those in security-role-ref. Option C is incorrect because auth-constraint is a subelement of security-constraint, not web-resource-collection. Option D is misleading - it's about authorization (who can access), not authentication (verifying identity).

Multiple choice technology web technology
  1. True

  2. False

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

J2EE applications are not limited to web-based applications only. J2EE (Java Enterprise Edition) supports multiple application types including web applications, application clients, Enterprise JavaBeans, and other distributed enterprise components. The statement is false.

Multiple choice technology web technology
  1. True

  2. False

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

JavaBeans are a reusable component model for Java, but they are not specifically J2EE components. JavaBeans can be used in any Java application context. J2EE components include servlets, JSP pages, EJBs, and other enterprise-specific technologies. The statement is false.

Multiple choice technology web technology
  1. True

  2. False

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

An HTML page is not itself a web component. Web components are custom, reusable HTML elements with encapsulated functionality (custom elements, shadow DOM, HTML templates). A regular HTML page may contain web components, but the page itself is a document, not a component.

Multiple choice technology packaged enterprise solutions
  1. The port value can be any number.

  2. For each cluster element the ports begin with 50000+100*instance_number, where instance_number is a two digit number from 00 to 99 specifying the number of central instance and dialog instances.

  3. For each cluster element the ports begin with 50000+instance_number, where instance_number is a two digit number from 00 to 99 specifying the number of central instance and dialog instances.

  4. The port value is a number over 50000

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

SAP AS Java ports are calculated as 50000 + 100*instance_number + port_offset, where the offset (0-99) identifies the service within each cluster element. The 100*instance_number multiplier ensures unique ranges for different instances, and all ports are above 50000. Port values cannot be 'any number' - they must follow this scheme.

Multiple choice technology packaged enterprise solutions
  1. 32NN

  2. 3NN2

  3. NN32

  4. 2NN3

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

The SAP Central Services Instance Enqueue Server uses port format 32NN, where NN is the instance number. For instance 00, this is port 3200. The Enqueue Server handles lock table management for SAP applications. Option B reverses the digits, option C has NN at the start, and option D uses 2 instead of 3.

Multiple choice technology packaged enterprise solutions
  1. 8NN1

  2. 81NN

  3. 82NN

  4. 8NN2

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

The HTTP Message Server port for SAP Central Services at instance number NN is 81NN. For instance 00, this is port 8100. The Message Server handles load balancing and client connection requests. Options A (8NN1), C (82NN), and D (8NN2) have incorrect digit placement.

Multiple choice technology packaged enterprise solutions
  1. 5NN10

  2. 51NN5

  3. 515NN

  4. 5NN15

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

SAP AS Java with Development Infrastructure (DI) type uses port 5NN15 for Design Time Repository (DTR) connections. DTR stores version-controlled development objects. For instance 00, this is port 50015. Options A (5NN10), B (51NN5), and C (515NN) have incorrect digit arrangements.

Multiple choice technology web technology
  1. A browser that uses a plug-in to process user data.

  2. A distributed application where the client program does not process data, but instead passes data for processing to an enterprise bean running on an application server.

  3. An application that cannot be stopped by a firewall.

  4. An application compiled with the -thin option of the javac command.

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

A thin-client application is one where the bulk of the processing occurs on the server. The client is primarily responsible for the user interface and passing data to the server-side components (like enterprise beans) for logic execution.

Multiple choice technology security
  1. Line # 12

  2. Line # 9

  3. Line # 17

  4. Line # 8

  5. Line # 14, 18 & 19

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

The vulnerability is on line 17 where doGet() calls doPost(), which forwards to a JSP page using unvalidated user input from the request. This creates an XSS vulnerability because attacker-controlled input from the original request gets reflected in the JSP output without sanitization. The forward on line 9 itself isn't vulnerable - it's the data flow through line 17.