Home / Programming Questions / JAVA MCQs / Page 6

JAVA MCQs with answers Page - 6

Dear candidates you will find MCQ questions of JAVA here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

Q. What are the components of a marker interface?

(A) Fields, no methods
(B) No fields, No methods
(C) No fields, only methods
(D) Fields and methods

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

(A) taglib directive
(B) page directive
(C) command directive
(D) include directive

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

(A) Expression
(B) Declaration
(C) Scriptlet
(D) Comment

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

(A) False
(B) True
(C) ---
(D) ---

Q. What temporarily redirects response to the browser?

(A) response.setRedirect(URL)
(B) <%@directive%>
(C) response.sendRedirect(URL)
(D) None of these

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

(A) sessionAttribute
(B) HttpSession
(C) pageContext
(D) sessionContext

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

(A) javax.servlet.jsp.JspWriter
(B) javax.servlet.jsp.SessionPrinter
(C) javax.servlet.jsp.SessionWriter
(D) javax.servlet.jsp.PrintWriter

Q. Consider the following code snippet.
The code is equivalent to which code?

Code:
for(var n in m)
   console.log(m[n]);
(A) for (var i = 1;i < a.length;i++) console.log(a[i]);
(B) for (var i = 0;i < a.length;i++) console.log(a[i]);
(C) for (int i = 0;i < a.length;i++) console.log(a[i]);
(D) for (var i = 0;i <= a.length;i++) console.log(a[i]);

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.