JSP Online Quiz


Advertisements


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 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 of the following attributes are mandatory in <jsp:setProperty /> tag?

A - name, property

B - type, id

C - name, type

D - id, property

Answer : A

Explaination

The setProperty action sets the properties of a Bean. The Bean must have been previously defined before this action.

Q 4 - Which of the following is not a jsp directive?

A - include

B - page

C - scriptlet

D - useBean

Answer : C

Explaination

scriptlet is not a jsp directive.

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.

Answer : C

Explaination

The autoFlush attribute specifies whether buffered output should be flushed automatically when the buffer is filled, or whether an exception should be raised to indicate buffer overflow.

Answer : C

Explaination

The isELIgnored option gives you the ability to disable the evaluation of Expression Language (EL) expressions. The default value of the attribute is true, meaning that expressions, ${...}, are evaluated as dictated by the JSP specification. If the attribute is set to false, then expressions are not evaluated but rather treated as static text.

Answer : A

Explaination

When a container loads a JSP it invokes the jspInit() method before servicing any requests.

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