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 - Which of the following is not a implicit object?

A - request

B - response

C - cookie

D - session

Answer : C

Explaination

There is no cookie object in jsp.

Q 2 - What is default value of isThreadSafe?

A - True

B - False

Answer : A

Explaination

The isThreadSafe option marks a page as being thread-safe. By default, it is true and all JSPs are considered thread-safe.

Q 3 - All servlet classes are required to be mapped and configured in web.xml.

A - True

B - False

Answer : A

Explaination

Yes, all servlets are required to be mapped/configured in web.xml

Q 4 - Which of the following attribute is used to have uncaught run-time exceptions automatically forwarded to an error processing page?

A - error

B - errorPage

C - exception

D - exceptionPage

Answer : B

Explaination

<%@ page errorPage="error.jsp" %>

It will redirect the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing.

Q 5 - Which of the following method can be used to read binary data stream coming from the client?

A - request.getInputStream()

B - response.getInputStream()

C - request.getInputStreamData()

D - response.getInputStreamData()

Answer : A

Explaination

You call request.getInputStream() method to read binary data stream coming from the client for example, image file uploaded.

Q 6 - What is default value of autoFlush Attribute?

A - true

B - false

Answer : A

Explaination

A value of true (default) indicates automatic buffer flushing and a value of false throws an exception.

Q 7 - What is the default value of isELIgnored attribute?

A - true

B - false

Answer : A

Explaination

The default value of isELIgnored attribute is true, meaning that expressions, ${...}, are evaluated as dictated by the JSP specification.

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

Using <%jsp:param> tag you can pass information from JSP to included JSP.

Answer : C

Explaination

The <c:param> tag allows proper URL request parameter to be specified with URL and it does any necessary URL encoding required.

jsp_questions_answers.htm
Advertisements