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.
Q 1 - request is instance of which class?
request is object of HttpServletRequest.
Q 2 - This object can be used to access other implicit objects in JSP.
pageContext can be used to retrieve other implicit objects using its methods like getPage(), getRequest() etc.
Yes, all servlets are required to be mapped/configured in web.xml
Q 4 - Which of the following is an implicit object?
pageContext is an implicit object.
Q 5 - Which of the following method can be used to read a form parameter in JSP?
You call request.getParameter() method to get the value of a form parameter.
A value of true (default) indicates automatic buffer flushing and a value of false throws an exception.
Q 7 - Which of the following is true about include directive?
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 is true about Execution phase in JSP life cycle?
Whenever a browser requests a JSP and the page has been loaded and initialized, the JSP engine invokes the _jspService() method in the JSP.The _jspService() method of a JSP is invoked once per a request and is responsible for generating the response for that request and this method is also responsible for generating responses to all seven of the HTTP methods ie. GET, POST, DELETE etc.
Q 9 - What is difference between <%-- comment --%> and <!-- comment -->?
Q 10 - What is the use of <c:if> tag?
The <c:if> tag evaluates an expression and displays its body content only if the expression evaluates to true.