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.
Q 1 - What is the correct signature of jspDestroy() method of HttpJspPage class?
A - void jspDestroy(HTTPRequest request, HTTPResponse response)
B - void jspDestroy(HTTPRequest request, HTTPResponse response) throws ServletException, IOException
Answer : C
Explaination
Correct Signature is
void jspDestroy()
Answer : A
Explaination
If you set the isThreadSafe option to false, the JSP engine makes sure that only one thread at a time is executing your JSP.
Q 3 - Which of the following is true about request scope?
A - Object created with request scope are accessible only from the page in which they are created.
B - Object created with request scope are accessible only from the pages which are in same session.
Answer : C
Explaination
Object created with request scope are accessible only from the pages which are processing the same request. Object data is available to another page in case of forward.
Answer : B
Explaination
isErrorPage is required to be set true, it is false by default.
Q 5 - Which of the following method can be used to read a multiple values with same name, for example check box selections?
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.
Q 6 - What are cookies?
Answer : A
Explaination
Cookies are text files stored on the client computer and they are kept for various information tracking purpose.
Q 7 - Which of the following is true about isThreadSafe Attribute?
A - The isThreadSafe option marks a page as being thread-safe.
Answer : D
Explaination
The isThreadSafe option marks a page as being thread-safe. By default, all JSPs are considered thread-safe. If you set the isThreadSafe option to false, the JSP engine makes sure that only one thread at a time is executing your JSP.
Q 8 - Which of the following is true about <jsp:getProperty> action?
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.
Q 9 - What is Localization?
A - Localization refers to creating local content on a website.
B - Localization refers to adding locale related information to a website.
Answer : C
Explaination
Localization means adding resources to a web site to adapt it to a particular geographical or cultural region for example Hindi translation to a web site.
Q 10 - Which of the following is true about <c:url> tag
A - The <c:url> tag formats a URL into a string and stores it into a variable.
B - The <c:url> tag automatically performs URL rewriting when necessary.
Answer : C
Explaination
The <c:url> tag formats a URL into a string and stores it into a variable. This tag automatically performs URL rewriting when necessary.