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 - Which of the following is not a valid attribute of a page directives?

A - language

B - extend

C - export

D - import

Answer : C

Explaination

export is not a valid attribute of a page directive.

Q 3 - Which is the methods of generated Servlet?

A - jspInit()

B - _jspService()

C - jspDestroy()

D - All of the above

Answer : D

Explaination

All of the above methods get generated in generated servlet.

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

Answer : C

Explaination

You call request.getParameterValues() method to get the value of a form parameter if the parameter appears more than once and returns multiple values.

Answer : C

Explaination

The import attribute serves the same function as, and behaves like, the Java import statement. The value for the import option is the name of the package you want to import.

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.

Q 8 - Which of the following step is taken by JSP container during Compilation phase?

A - Parsing the JSP.

B - Turning the JSP into a servlet.

C - Compiling the servlet.

D - All of the above.

Answer : C

Explaination

The compilation process involves three steps: a) Parsing the JSP, b) Turning the JSP into a servlet, c) Compiling the servlet.

Q 9 - Can you make use of a ServletOutputStream object from within a JSP page?

A - true

B - false

Answer : B

Explaination

No. You are supposed to make use of only a JSPWriter object (given to you in the form of the implicit object out) for replying to clients.

Answer : B

Explaination

The <c:set > tag is JSTL-friendly version of the setProperty action. The tag is helpful because it evaluates an expression and uses the results to set a value of a JavaBean or a java.util.Map object.

jsp_questions_answers.htm
Advertisements