JSP Online Quiz


Advertisements


Following quiz provides Multiple Choice Questions (MCQs) related to JSP Fundamentals. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 1 - Which of the following is not a implicit object?

A - request

B - response

C - cookie

D - session

Answer : C

Explaination

There is no cookie object in jsp.

Q 2 - session is instance of which class?

A - Session

B - HttpSession

C - HttpServletSession

D - ServletSession

Answer : B

Explaination

request is object of HttpSession.

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

A - name, property

B - type, id

C - name, type

D - id, property

Answer : A

Explaination

The getProperty action is used to retrieve the value of a given property and converts it to a string, and finally inserts it into the output.

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

A - id, type

B - page, flush

C - type, class

D - type,page

Answer : B

Explaination

<jsp:include /> lets you insert files into the page being generated. The syntax looks like this −

<jsp:include page="relative URL" flush="true" />

Where page is the relative URL of the page to be included. Flush is the boolean attribute the determines whether the included resource has its buffer flushed before it is included.

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

A - request.getParameter()

B - response.getParameter()

C - request.getParameterNames()

D - response.getParameterNames()

Answer : C

Explaination

You call request.getParameterNames() method to get the names of all the parameters passed.

Q 6 - What is default value of autoFlush Attribute?

A - true

B - false

Answer : A

Explaination

A value of true (default) indicates automatic buffer flushing and a value of false throws an exception.

Answer : C

Explaination

The include directive is used to includes a file during the translation phase. This directive tells the container to merge the content of other external files with the current JSP during the translation phase.

Answer : C

Explaination

The destruction phase of the JSP life cycle represents when a JSP is being removed from use by a container.The jspDestroy() method is the JSP equivalent of the destroy method for servlets.

Answer : C

Explaination

The <c:param> tag allows proper URL request parameter to be specified with URL and it does any necessary URL encoding required.


jsp_questions_answers.htm

Advertisements