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 - jspInit() method of HttpJspPage class can be overridden.

A - True

B - False

Answer : A

Explaination

Yes, jspInit() method can be overridden.

Q 2 - If a jsp is to generate a xml page, what attribute of page directive it should use?

A - contentXML

B - generateXML

C - typeXML

D - contentType

Answer : D

Explaination

<%page contentType="text/xml">

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.

Answer : C

Explaination

The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The pageContext object is used to represent the entire JSP page.

Answer : A

Explaination

If the attribute is set to false, then expressions are not evaluated but rather treated as static text.

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 : A

Explaination

JSTL, JavaServer Pages Standard Tag Library is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications.

Answer : A

Explaination

JavaBeans and taglib fundamentals were introduced for reusability. But following are the major differences between them −

  • Taglibs are for generating presentation elements while JavaBeans are good for storing information and state.

  • Use custom tags to implement actions and JavaBeans to present information.

jsp_questions_answers.htm
Advertisements