Java interview questions part 2

Java interview questions part 2

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

Total Questions: 20

1. What is used to get class name in reflection?

Correct Answer is : getClass().getName()

2. How method can be invoked on unknown object?

Correct Answer is : obj.getClass().getMethod()

3. How to get the class object of associated class using Reflection?

Correct Answer is : Class.forName(“className”)

4. What does Class.forName(“myreflection.Foo”).getInstance() return?

Correct Answer is : Foo object

5. What does foo.getClass().getMethod(“doSomething”, null) return?

Correct Answer is : Method is returned and we can call the method as method.invoke(foo,null);

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 of the following is used for session migration?

Correct Answer is : Persisting the session in database

17. Which of the below is not a session tracking method?

Correct Answer is : History

18. Which of the following is stored at client side?

Correct Answer is : Cookies

19. Which of the following leads to high network traffic?

Correct Answer is : URL rewriting

20. Which of the following is not true about session?

Correct Answer is : Default timeout value for session variable is 20 minutes

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon