wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

quiz on jsp

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is the syntax for accessing a bean property in JSP EL?

a)

D. .

b)

C. ()

c)

B. []

d)

A. {}

2.

What is the purpose of Custom Tags in JSP?

a)

D. To handle HTTP requests

b)

C. To simplify JSP development by creating custom tags

c)

B. To create dynamic web pages

d)

A. To confuse developers

3.

What is the purpose of the application object in JSP?

a)

D. Handles JSP container behavior

b)

C. Provides access to ServletContext for the generated Servlet

c)

A. Represents the entire JSP page

d)

B. Manages HTTP session attributes

4.

What is the main advantage of using JSP over Servlets?

a)

C. Easy for web designers and no need to recompile for changes

b)

B. Dependence on web configuration

c)

A. Longer development time

d)

D. Mapping to web.xml is necessary

5.

Why use RequestDispatcher to forward a request to another resource, instead of using a sendRedirect?

a)

Redirects are no longer supported in the current servlet API.

b)

Redirects are not a cross-platform portable mechanism

c)

The RequestDispatcher does not require a round trip to the client, and thus is more efficient and allows the server to maintain request state

d)

The RequestDispatcher does not use the reflection API.

6.

Which is not a directive?

a)

include

b)

page

c)

useBean

d)

export

7.

<c:set> belongs to which category of JSP elements?

a)

JSP standard action

b)

JSP directive

c)

JSP standard Tag Library action

d)

Java Bean

8.

Which of the following tags are used for forwarding the request and response to another resource?

a)

<jsp:include>

b)

<jsp:forward>

c)

<% @ include%>

d)

<% @ forward%>

9.

Which jsp code is equivalent to the below given code:


public String getServletInfo() {

return "Happy Learning JSPs";

}

a)

<%@ page info="Happy Learning JSPs" %>

b)

<%@ page servlet-info="Happy Learning JSPs" %>

c)

<%@ page information="Happy Learning JSPs" %>

d)

<%@ page servlet-information="Happy Learning JSPs" %>

10.

Exception implicit object is recognized by setting which of the following attribute?

a)

errorPage=true

b)

errorPage=false

c)

isErrorPage=true

d)

isErrorPage=false

11.

Which of the following are Page directive attributes?

a)

import

b)

extends

c)

pageEncoding

d)

prefix

12.

Predict the output: Provided uname text field with the value "Harry"


<html>

<body>

<%= "Welcome "+request.getParameter("uname") %>

</body>

</html>

a)

Welcome Harry

b)

Harry

c)

500 Internal Server Error : Null Pointer Exception

d)

JSP Translation Error: request not declared

13.
<%@ inlcude > directive uses which attribute to include Page2.jsp?
a)
page="Page.jsp"
b)
file="Page.jsp"
c)
forward="Page.jsp"
d)
all of the above
14.
Which is of the following are valid expression tag for the given variables a and b?
a)
<%=a+b %>
b)
<%=a+b; %>
c)
<%!a+b %>
d)
<%!a+b; %>
15.
Which of the following is used to declare instance variable through JSP Page?
a)
<% int iVar=0; %>
b)
<%! int iVar=0; %>
c)
<%! int iVar=0 %>
d)
<%= int iVar=0; %>