JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Java interview questions part 2
Java interview questions part 2
Back
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?
A. getClass().getName()
B. getClass().getFields()
C. getClass().getDeclaredFields()
D. new getClass()
Show Correct Answer
Correct Answer is :
getClass().getName()
2. How method can be invoked on unknown object?
A. obj.getClass().getDeclaredMethod()
B. obj.getClass().getDeclaredField()
C. obj.getClass().getMethod()
D. obj.getClass().getObject()
Show Correct Answer
Correct Answer is :
obj.getClass().getMethod()
3. How to get the class object of associated class using Reflection?
A. Class.forName(“className”)
B. Class.name(“className”)
C. className.getClass()
D. className.getClassName()
Show Correct Answer
Correct Answer is :
Class.forName(“className”)
4. What does Class.forName(“myreflection.Foo”).getInstance() return?
A. An array of Foo objects
B. class object of Foo
C. Calls the getInstance() method of Foo class
D. Foo object
Show Correct Answer
Correct Answer is :
Foo object
5. What does foo.getClass().getMethod(“doSomething”, null) return?
A. doSomething method instance
B. Method is returned and we can call the method as method.invoke(foo,null);
C. Class object
D. Exception is thrown
Show Correct Answer
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?
A. <%@directive%>
B. <%!directive%>
C. <%directive%>
D. <%=directive%>
Show Correct Answer
Correct Answer is :
<%@directive%>
7. Which of the following action variable is used to include a file in JSP?
A. jsp:setProperty
B. jsp:getProperty
C. jsp:include
D. jsp:plugin
Show Correct Answer
Correct Answer is :
jsp:include
8. Which attribute uniquely identification element?
A. ID
B. Class
C. Name
D. Scope
Show Correct Answer
Correct Answer is :
ID
9. “out” is implicit object of which class?
A. javax.servlet.jsp.PrintWriter
B. javax.servlet.jsp.SessionWriter
C. javax.servlet.jsp.SessionPrinter
D. javax.servlet.jsp.JspWriter
Show Correct Answer
Correct Answer is :
javax.servlet.jsp.JspWriter
10. Which object stores references to the request and response objects?
A. sessionContext
B. pageContext
C. HttpSession
D. sessionAttribute
Show Correct Answer
Correct Answer is :
pageContext
11. What temporarily redirects response to the browser?
A.
B. <%@directive%>
C. response.sendRedirect(URL)
D. response.setRedirect(URL)
Show Correct Answer
Correct Answer is :
response.sendRedirect(URL)
12. Which tag is used to set a value of a JavaBean?
A.
B.
C.
D.
Show Correct Answer
Correct Answer is :
13. Can and <%–comment–%> be used alternatively in JSP?
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
FALSE
14. Java code is embedded under which tag in JSP?
A. Declaration
B. Scriptlet
C. Expression
D. Comment
Show Correct Answer
Correct Answer is :
Scriptlet
15. Which of the following is not a directive in JSP?
A. page directive
B. include directive
C. taglib directive
D. command directive
Show Correct Answer
Correct Answer is :
command directive
16. Which of the following is used for session migration?
A. Persisting the session in database
B. URL rewriting
C. Create new database connection
D. Kill session from multiple sessions
Show Correct Answer
Correct Answer is :
Persisting the session in database
17. Which of the below is not a session tracking method?
A. URL rewriting
B. History
C. Cookies
D. SSL sessions
Show Correct Answer
Correct Answer is :
History
18. Which of the following is stored at client side?
A. URL rewriting
B. Hidden form fields
C. SSL sessions
D. Cookies
Show Correct Answer
Correct Answer is :
Cookies
19. Which of the following leads to high network traffic?
A. URL rewriting
B. Hidden form fields
C. SSL sessions
D. Cookies
Show Correct Answer
Correct Answer is :
URL rewriting
20. Which of the following is not true about session?
A. All users connect to the same session
B. All users have same session variable
C. Default timeout value for session variable is 20 minutes
D. New session cannot be created for a new user
Show Correct Answer
Correct Answer is :
Default timeout value for session variable is 20 minutes
Similar Interview Questions
Search for latest jobs
Find Jobs