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 - request is instance of which class?

A - Request

B - HttpRequest

C - HttpServletRequest

D - ServletRequest

Answer : C

Explaination

request is object of HttpServletRequest.

Q 2 - Which of the following is not a directive?

A - include

B - page

C - export

D - useBean

Answer : C

Explaination

export is not 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 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.

Answer : A

Explaination

The info attribute lets you provide a description of the JSP.

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