Servlets - Java (MCQ) questions and answers

Dear Readers, Welcome to Servlets multiple choice questions and answers with explanation. These objective type Servlets questions are very important for campus placement test and job interviews. Specially developed for the Networking freshers and professionals, these model questions are asked in the online technical test and interview of many IT companies.

1)    Connection Pooling Class manages no of user requests for connections to improve the performance.
- Published on 19 Oct 15

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


2)   Which object of HttpSession can be used to view and manipulate information about a session?
- Published on 19 Oct 15

a. session identifier
b. creation time
c. last accessed time
d. All mentioned above
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
No explanation is available for this question!


3)   Using mail API we cannot send mail from a servlet.
- Published on 22 Jul 15

a. True
b. False
Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


4)   Which class provides stream to read binary data such as image etc. from the request object?
- Published on 22 Jul 15

a. ServltInputStream
b. ServletOutputStream
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: ServltInputStream

Explanation:
No explanation is available for this question!


5)   The sendRedirect() method of HttpServletResponse interface can be used to redirect response to another resource, it may be servlet, jsp or html file.
- Published on 22 Jul 15

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


6)   Which of these ways used to communicate from an applet to servlet?
- Published on 22 Jul 15

a. RMI Communication
b. HTTP Communication
c. Socket Communication
d. All mentioned above
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
No explanation is available for this question!


7)   Which methods are used to bind the objects on HttpSession instance and get the objects?
- Published on 22 Jul 15

a. setAttribute
b. getAttribute
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
No explanation is available for this question!


8)   Which type of ServletEngine is a server that includes built-in support for servlets?
- Published on 21 Jul 15

a. Add-on ServletEngine
b. Embedded ServletEngine
c. Standalone ServletEngine
d. None of the above
Answer  Explanation 

ANSWER: Standalone ServletEngine

Explanation:
No explanation is available for this question!


9)   What type of servlets use these methods doGet(), doPost(),doHead, doDelete(), doTrace()?

- Published on 21 Jul 15

a. Genereic Servlets
b. HttpServlets
c. All of the above
d. None of the above
Answer  Explanation 

ANSWER: HttpServlets

Explanation:
No explanation is available for this question!


10)   Which cookie it is valid for single session only and it is removed each time when the user closes the browser?
- Published on 20 Jul 15

a. Persistent cookie
b. Non-persistent cookie
c. All the above
d. None of the above
Answer  Explanation 

ANSWER: Non-persistent cookie

Explanation:
No explanation is available for this question!


1 2 3