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 security
  1. Reflected Cross Site Scripting

  2. Improper Error Handling

  3. Directory Listing

  4. Phishing

  5. Option 1 AND Option 2 AND Option 4

  6. Option 1 AND Option 2

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

Printing unvalidated user input directly to the response output stream enables Reflected Cross-Site Scripting (XSS). Phishing is also possible through URL manipulation, and improper error handling could occur if exceptions are unhandled.

Multiple choice technology security
  1. URL Tampering

  2. Brute Forcing

  3. Race Condition

  4. HTML Injection

  5. XSS

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

The code accepts a userID parameter directly from the request without validating whether the current user has permission to access that specific user's information. This allows any user to input any userID and view that user's details.

Multiple choice technology security
  1. SQL Injection

  2. Cross Site Scripting

  3. Broken Access Control

  4. Improper Resource Initialization

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

Access control is implemented only on the client-side using JavaScript and conditional rendering. An attacker can bypass this by directly calling /DeleteUsersAction URL or modifying the client-side code. Authorization must always be validated server-side.

Multiple choice technology security
  1. Information Disclosure

  2. Cross Site Scripting

  3. Usage of Risky Encryption

  4. All of the above

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

The code uses Base64 encoding to obfuscate a redirect path. Base64 is a reversible encoding scheme, not encryption, representing a risky and weak attempt at securing sensitive parameters.

Multiple choice technology security
  1. a

  2. b

  3. c

  4. a AND b

  5. a AND b AND c

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

Option A handles all exceptions via Throwable to redirect to error.jsp. Option B catches HTTP 500 errors to redirect to the same page. Both are valid error-page configurations in web.xml. Option C is invalid because an error-page must specify either exception-type or error-code.

Multiple choice technology security
  1. a

  2. b

  3. c

  4. a AND b

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

Session timeout is configured in web.xml within the session-config element. This is the standard deployment descriptor for Java web applications. Server.xml is for server-wide global settings, not application-specific session configuration.

Multiple choice technology security
  1. 3600 is beyond the limit

  2. It is not recommended as it is using Persistent Cookies

  3. It leads to Cookie Poisoning Attack

  4. Option 1 AND Option 2

  5. Option 2 AND Option 3

  6. Option 1 AND Option 2 AND Option 3

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

Using unvalidated user input directly in a cookie value enables cookie manipulation attacks. Setting MaxAge to 3600 seconds creates a persistent cookie stored across sessions, which amplifies the attack surface compared to session cookies.

Multiple choice technology security
  1. a

  2. b

  3. c

  4. d

  5. Option 1 AND Option 2

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

HTTP PUT and DELETE can be disabled via web.xml configuration as shown in option A. Option B is also true as many servers disable them by default for security. E combines both correct statements.

Multiple choice technology security
  1. Subject.doAs()

  2. AccessController.checkPermission()

  3. SecurityManager.checkAccess()

  4. None of the above

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

Subject.doAs() is the correct API that associates a Subject with the current thread of execution in Java authentication and authorization. It executes an action as that Subject. AccessController.checkPermission() checks permissions but doesn't associate subjects with threads. SecurityManager.checkAccess() checks thread access control, not subject association.

Multiple choice technology security
  1. Server.xml

  2. config.xml

  3. web.xml

  4. application.properties

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

In J2EE web applications, the web.xml deployment descriptor file defines application-wide configurations including error pages. You specify error pages using elements that map exception types or HTTP error codes to custom display pages. Server.xml (A) is for server-level configuration in Tomcat, config.xml (B) is not a standard J2EE config file, and application.properties (D) is typically used for application-specific settings, not servlet container configurations.

Multiple choice technology security
  1. Milliseconds

  2. Seconds

  3. Minutes

  4. Hours

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

The element in web.xml specifies session timeout in MINUTES, not smaller time units. This is defined in the servlet specification - the value represents the integer number of minutes before an inactive session is invalidated. Using milliseconds (A) or seconds (B) would make timeouts impractically large, and hours (D) is not the standard unit defined in the spec.

Multiple choice technology web technology
  1. HttpSession

  2. ServletRequest

  3. ServletResponse

  4. ServletContext

  5. ServletConfig

  6. SessionConfig

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

HttpSession, ServletRequest, and ServletContext all define getAttribute() and setAttribute() methods to manage attributes within their respective scopes. ServletConfig only supports getInitParameter() and does not have attribute methods.

Multiple choice technology web technology
  1. HttpSessionEvent

  2. ServletRequestEvent

  3. HttpSessionBindingEvent

  4. HttpSessionAttributeEvent

  5. ServletContextAttributeEvent

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

In J2EE 1.4 API, HttpSessionBindingEvent exists for session attribute binding/unbinding, but HttpSessionAttributeEvent does not exist. HttpSessionEvent, ServletRequestEvent, and ServletContextAttributeEvent are all valid listener event types in the specification.