A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

1. Request is instance of which class?
a. Request
b. HttpRequest
c. HttpServletRequest
d. ServletRequest
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).HttpServletRequest

2. 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.
c. Object created with request scope are accessible only from the pages which are processing the same request.
d. Object created with request scope are accessible only from the pages which reside in same application.
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).Object created with request scope are accessible only from the pages which are processing the same request.

3. Which of the following is true about language attribute?
a. The language attribute indicates the programming language used in scripting the servlet.
b. The language attribute indicates the programming language used in scripting the html page.
c. The language attribute indicates the programming language used in scripting the JSP page.
d. None of the above.
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).None of the above.

4. Where filters are defined?
a. Filters are defined in the deployment descriptor file web.xml.
b. Filters are defined in the jsp pages.
c. Both of the above.
d. None of the above.
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).Filters are defined in the deployment descriptor file web.xml.

5. Which of the following is true about isThreadSafe Attribute?
a. The isThreadSafe option marks a page as being thread-safe.
b. If you set the isThreadSafe option to false, the JSP engine makes sure that only one thread at a time is executing your JSP.
c. By default, all JSPs are considered thread-safe.
d. All of the above.
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).All of the above.

6. Which of the following depicts correct order of phases in JSP life cycle?
a. Compilation, Initialization, Execution, Cleanup
b. Initialization, Compilation, Cleanup, Execution
c. Initialization, Cleanup, Compilation, Execution
d. Cleanup, Compilation, Initialization, Execution
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).Compilation, Initialization, Execution, Cleanup

7. Which of the following is true about response.sendRedirect(url)?
a. The sendRedirect sends HTTP temporary redirect response to the browser.
b. Request data gets lost in case of sendRedirect.
c. Both of the above.
d. None of the above.
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).Both of the above.

8. What is the use of c:set tag?
a. It can save values to database.
b. It evaluates an expression and uses the results to set a value of a JavaBean.
c. It can be used to iterate list of elements.
d. None of the above.
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).It evaluates an expression and uses the results to set a value of a JavaBean.

9. If a jsp is to generate a pdf page, what attribute of page directive it should use?
a. contentType
b. generatePdf
c. typePDF
d. contentPDF
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).contentType

10. 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
c. void jspDestroy()
d. void jspDestroy() throws ServletException, IOException
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).void jspDestroy()

Page 1 of 5