| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Choose the statement that best describes the relationship between JSP and servlets:

Correct Answer is : JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage.

2. What is a benefit of using JavaBeans to separate business logic from presentation markup within the JSP environment ?

Correct Answer is : It provides the developer with full access to the Java 2 Platform Enterprise Edition (J2EE), which is unavailable from outside the JavaBean environment.

3. Why use RequestDispatcher to forward a request to another resource, instead of using a sendRedirect ?

Correct Answer is : The RequestDispatcher does not require a round trip to the client, and thus is more efficient and allows the server to maintain request state.

4. What alternatives exist to embedding Java code directly within the HTML markup of your JSP page ?

Correct Answer is : Moving the code into JavaBeans and servlets.

5. What type of scriptlet code is better-suited to being factored forward into a servlet ?

Correct Answer is : Code that deals with logic that is common across requests.

6. Which one of the following is correct for directive in JSP?

Correct Answer is : <%@directive%>

7. Which of the following action variable is used to include a file in JSP?

Correct Answer is : jsp:include

8. Which attribute uniquely identification element?

Correct Answer is : ID

9. “out” is implicit object of which class?

Correct Answer is : javax.servlet.jsp.JspWriter

10. Which object stores references to the request and response objects?

Correct Answer is : pageContext

11. What temporarily redirects response to the browser?

Correct Answer is : response.sendRedirect(URL)

12. Which tag is used to set a value of a JavaBean?

Correct Answer is :

13. Can and <%–comment–%> be used alternatively in JSP?

Correct Answer is : FALSE

14. Java code is embedded under which tag in JSP?

Correct Answer is : Scriptlet

15. Which of the following is not a directive in JSP?

Correct Answer is : command directive

16. Which page directive should be used in JSP to generate a PDF page?

Correct Answer is : contentType

17. Which tag should be used to pass information from JSP to included JSP?

Correct Answer is : Using <%jsp:page> tag

18. Application is instance of which class?

Correct Answer is : javax.servlet.ServletContext

19. _jspService() method of HttpJspPage class should not be overridden.

Correct Answer is : TRUE

20. Which option is true about session scope?

Correct Answer is : Objects are accessible only from the pages which are in same session