You are on page 1of 6

JSP MOCK TEST

http://www.tutorialspoint.com Copyright © tutorialspoint.com

This section presents you various set of Mock Tests related to JSP Framework. You can download
these sample mock tests at your local machine and solve offline at your convenience. Every mock
test is supplied with a mock test key to let you verify the final score and grade yourself.

JSP MOCK TEST II

Q 1 - Which of the following attributes are mandatory in <jsp:getProperty /> tag?

A - name, property

B - type, id

C - name, type

D - id, property

Q 2 - Which of the following attributes are mandatory in <jsp:setProperty /> tag?

A - name, property

B - type, id

C - name, type

D - id, property

Q 3 - Which of the following attributes are mandatory in <jsp:useBean /> tag?

A - id, type

B - id, class

C - type, class

D - type,property

Q 4 - Which of the following are the valid scopes in JSP?

A - request, page, session, application

B - request, page, session, global


C - response, page, session, application

D - request, page, context, application

Q 5 - Which of the following is true about request scope?

A - Object created with request scope are accessible only from the page in which they are
created.

B - Object created with request scope are accessible only from the pages which are in same
session.

C - Object created with request scope are accessible only from the pages which are processing
the same request.

D - Object created with request scope are accessible only from the pages which reside in same
application.

Q 6 - Which of the following is true about page scope?

A - Object created with request scope are accessible only from the page in which they are
created.

B - Object created with request scope are accessible only from the pages which are in same
session.

C - Object created with request scope are accessible only from the pages which are processing
the same request.

D - Object created with request scope are accessible only from the pages which reside in same
application.

Q 7 - Which of the following is true about session scope?

A - Object created with request scope are accessible only from the page in which they are
created.

B - Object created with request scope are accessible only from the pages which are in same
session.

C - Object created with request scope are accessible only from the pages which are processing
the same request.

D - Object created with request scope are accessible only from the pages which reside in same
application.

Q 8 - Which of the following is true about application scope?

A - Object created with request scope are accessible only from the page in which they are
created.

B - Object created with request scope are accessible only from the pages which are in same
session.

C - Object created with request scope are accessible only from the pages which are processing
the same request.

D - Object created with request scope are accessible only from the pages which reside in same
application.
Q 9 - Which of the following is true about language attribute?

A - The language attribute indicates the programming language used in scripting the servlet.

B - The language attribute indicates the programming language used in scripting the html page.

C - The language attribute indicates the programming language used in scripting the JSP page.

D - None of the above.

Q 10 - Which of the following attribute is used to have uncaught run-time exceptions


automatically forwarded to an error processing page?

A - error

B - errorPage

C - exception

D - exceptionPage

Q 11 - Which of the following attribute is used to mark a page as error processing


page?

A - isErrorPage

B - errorPage

C - exception

D - exceptionPage

Q 12 - Which of the following attributes are used in <jsp:include /> tag?

A - id, type

B - page, flush

C - type, class

D - type,page

Q 13 - Which of the following is not a jsp directive?

A - include

B - page

C - scriptlet

D - useBean

Q 14 - Which of the following is an implicit object?

A - pageContext

B - servletContext
C - httpContext

D - sessionContext

Q 15 - isErrorPage is by default true.

A - True

B - False

Q 16 - out is instance of which class?

A - javax.servlet.jsp.JspWriter

B - javax.servlet.jsp.PringWriter

C - javax.servlet.Writer

D - javax.servlet.jsp.Writer

Q 17 - application is instance of which class?

A - javax.servlet.ServletContext

B - javax.servlet.HttpContext

C - javax.servlet.Context

D - javax.servlet.Application

Q 18 - config is instance of which class?

A - javax.servlet.ServletContext

B - javax.servlet.ServletConfig

C - javax.servlet.Context

D - javax.servlet.Application

Q 19 - pageContext is instance of which class?

A - javax.servlet.ServletContext

B - javax.servlet.ServletConfig

C - javax.servlet.jsp.PageContext

D - javax.servlet.Application

Q 20 - Which of the following method can be used to read a form parameter in JSP?

A - request.getParameter

B - response.getParameter
C - request.getValue

D - response.getValue

Q 21 - Which of the following method can be used to read a multiple values with same
name, for example check box selections?

A - request.getParameter

B - response.getParameter

C - request.getParameterValues

D - response.getParameterValues

Q 22 - Which of the following method can be used to read parameters names?

A - request.getParameter

B - response.getParameter

C - request.getParameterNames

D - response.getParameterNames

Q 23 - Which of the following method can be used to read binary data stream coming
from the client?

A - request.getInputStream

B - response.getInputStream

C - request.getInputStreamData

D - response.getInputStreamData

Q 24 - What is true about filters?

A - JSP Filters are used to intercept requests from a client before they access a resource at back
end.

B - JSP Filters are used to manipulate responses from server before they are sent back to the
client.

C - Both of the above.

D - None of the above.

Q 25 - Where filters are defined?

A - Filters are defined in the deployment descriptor file web.xml.

B - Filters are defined in the jsp pages.

C - Both of the above.

D - None of the above.


ANSWER SHEET

Question Number Answer Key

1 A

2 A

3 B

4 A

5 C

6 A

7 B

8 D

9 C

10 B

11 A

12 B

13 C

14 A

15 B

16 A

17 A

18 B

19 C

20 A

21 C

22 C

23 A

24 C

25 A

Loading [MathJax]/jax/output/HTML-CSS/jax.js

You might also like