21.) In a JSP page, how can you access information from an HTTP request?
A) By using the <request> object.
B) By using the <httpRequest> object.
C) By using the <HttpServletRequest> object.
D) By using the <get> object.
22.) What is the primary purpose of the <session> object in JSP?
A) To include external JavaScript files.
B) To maintain client-side cookies.
C) To manage user sessions and store session attributes.
D) To handle error messages.
23.) Which object in JSP is used to represent the current HTTP request?
A) <request>
B) <httpRequest>
C) <HttpServletRequest>
D) <get>
24.) In a JSP page, how can you access session attributes?
A) By using the <session> object.
B) By using the <getSession> method.
C) By using the <getSessionAttribute> method.
D) By using the <getAttribute> method.
25.) What is the purpose of the <%@ isErrorPage=”true” %> directive in JSP?
A) To define custom tags.
B) To include external resources.
C) To specify that the page is an error page for exception handling.
D) To create session objects.
26.) How can you handle exceptions in a JSP error page?
A) By using the <try> and <catch> elements.
B) By wrapping code in <exception> tags.
C) By using the <%@ page errorPage=”error.jsp” %> directive.
D) By using the <throw> statement.
27.) What is the purpose of deploying a JSP web application as a WAR file?
A) To compress HTML files.
B) To secure server resources.
C) To package web resources for deployment to a web server.
D) To configure custom tags.
28.) Which directory is commonly used to store JSP files within a web application?
A) /WEB-INF/lib
B) /WEB-INF/classes
C) /META-INF
D) /WEB-INF/views
29.) How does JSP relate to servlets in a web application?
A) JSP is used for business logic, while servlets handle presentation.
B) JSP and servlets are two separate technologies that cannot be used together.
C) JSP and servlets often work together, with servlets handling the business logic and JSP handling the presentation.
D) JSP is an alternative to servlets for handling all aspects of web applications.
30.) Which of the following is a true statement about JSP and servlets?
A) JSP is faster than servlets for processing HTTP requests.
B) JSP and servlets serve the same purpose and are interchangeable.
C) JSP is primarily used for handling HTTP POST requests.
D) JSP is a technology for creating dynamic web pages, while servlets are Java classes that handle HTTP requests.