JSP homework Help at TutorEye
Flower

Are you a university or school looking for an online tutoring partnership ? Talk to Us

JSP: 

 

JSP stands for Jakarta Server Pages and it is a collection of technologies that facilitates the developers in creating dynamically generated web pages that are based on HTML, XML, SOAP, etc. It is quite similar to Serverlet Technology and is sometimes thought of as its extension because it provides more functionality. 

 

JSP Sample Questions:

 

 

Question 1: Which of the following attribute of the page directive should be used to generate a pdf page?

 

A) typePDF

B) contentType

C) contentPDF

D) None of these

 

Answer: contentType

Explanation: Following is the correct way to generate a pdf by using contentType attribute of page directive:
<%page contentType="application/pdf">

 

Get the full solution!

 

 

Question 2: Mandatory attributes in <jsp:setProperty /> tag are?

 

A) type, id

B) name, property

C) name, id

D) None of these


Answer: name, property

Explanation: Property of bean is set by setProperty action. Before the action, the bean must be previously defined.

 

Get the full solution!

 

 

Question 3: Which of the following is the correct way to pass the information from JSP to included JSP?

 

A) <%jsp:param>

B) <%jsp:import>

C) <%jsp:page>

D) None of these


Answer: <%jsp:param>

Explanation: The correct way to pass the information from JSP to included JSP is by using the <%jsp:param> tag.

 

Get the full solution!


 

Question 4: Which of the following is the valid difference between Servlets and JSP? 

 

A) Compilation

B) Syntax

C) Translation

D) Both B and C


Answer: Syntax 

Explanation: JSP is quite similar to Serverlet Technology and is sometimes thought of as its extension because it provides more functionality. Compilation and Translation are the same whereas they are different in syntax.

 

Get the full solution!


 

Question 5: Which of the following in JSP is not a directive?

 

A) page 

B) userBean

C) include

D) export

 

Answer: export

Explanation: page, userBean and include are valid JSP directives whereas export is not a valid JSP directive.

 

Get the full solution!


 

Question 6: Which of the following interfaces does the javax.servlet.jsp package contains?

 

A) HttpJspPage

B) JspWriter

C) PageContext

D) All of these 


Answer: HttpJspPage

Explanation: The javax.servlet.jsp package contains the following interfaces:
HttpJspPage
JspPage

 

Get the full solution!


 

Question 7: Which of the following is not a valid class that javax.servlet.jsp package contains?

 

A) JspFactory

B) JspWriter

C) ErrorData

D) None of these

 

Answer: None of these

Explanation: The javax.servlet.jsp package contains the following classes:
JspFactory
JspWriter
ErrorData
JspContext
JspEngineInfo
PageContext

 

Get the full solution!


 

Question 8: Which of the following is the correct number of jsp implicit objects?

 

A) 7

B) 8

C) 9

D) 10

 

Answer: 9

Explanation: Following are the jsp implicit objects:
request
out
response
application
config
session
page
pageContext
exception

 

 

Get the full solution!

 


Question 9: Which of the following tag can be used for executing the java source code in JSP?

 

A) Expression tag

B) Scriptlet tag

C) Declaration Tag

D) None of these


Answer: Scriptlet tag

Explanation: Following are the uses of the above following tags:
Expression tag: writing user’s content on the client-side.
Scriptlet tag: executing the java source code.
Declaration Tag: declare fields and methods

 

Get the full solution!


 

Question 10: How many ways are there to handle exceptions in JSP?

 

A) 1

B) 2

C) 4

D) None of these

 

Answer: 2

Explanation: There are following two ways to handle exceptions in JSP:
errorPage: it is used to site which page to be shown when the exception has occurred.
isErrorPage: it is used to mark the pages as an error page where the exceptions are displayed. 

 

Get the full solution!

 

 

 

Computer Science Question Answers Pages


 

We Are Different from Others!

Help with JSP