JSP Online Quiz



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 - _jspService() method of HttpJspPage class should not be overridden.

A - True

B - False

Answer : A

Explaination

JSP container creates _jspService() methods so it should not be overridden.

Q 2 - if isThreadSafe attribute of page directive is set as true, then generated servlet implements SingleThreadModel interface.

A - True

B - False

Answer : B

Explaination

If isThreadSafe attribute of page directive is set as false, then generated servlet implements SingleThreadModel interface.

Q 3 - All jsp pages are required to be mapped and configured in web.xml.

A - True

B - False

Answer : B

Explaination

No, Jsp pages are not required to be mapped/configured in web.xml

Q 5 - 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()

Answer : A

Explaination

You call request.getParameter() method to get the value of a form parameter.

Answer : C

Explaination

The autoFlush attribute specifies whether buffered output should be flushed automatically when the buffer is filled, or whether an exception should be raised to indicate buffer overflow.

Answer : A

Explaination

The info attribute lets you provide a description of the JSP.

Answer : C

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.

Answer : C

Explaination

sendRedirect sends HTTP temporary redirect response to the browser, and browser creates a new request to go the redirected page.

Answer : C

Explaination

The <c:forEach > tag exists as a good alternative to embedding a Java for, while, or do-while loop via a scriptlet.

jsp_questions_answers.htm
Advertisements