Java MCQs with answers Page - 5

Here, you will find a collection of MCQ questions on Java. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 828.03K Points
Coach

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

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

A

Admin • 828.03K Points
Coach

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

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

A

Admin • 828.03K Points
Coach

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

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

A

Admin • 828.03K Points
Coach

Q. What temporarily redirects response to the browser?

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

A

Admin • 828.03K Points
Coach

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

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

A

Admin • 828.03K Points
Coach

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

A

Admin • 828.03K Points
Coach

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]);

A

Admin • 828.03K Points
Coach

Q. Who is considered as the creator of JAVA ?

  • (A) Dennis Richie
  • (B) Ken Thompson
  • (C) James Gosling
  • (D) Bjarne Stroupstrup

A

Admin • 828.03K Points
Coach

Q. Which of the following statements about the Java language is true?

  • (A) Java supports only Procedural Oriented Programming approach
  • (B) Both Procedural and Object Oriented Programming are supported in Java
  • (C) Java supports only Object Oriented Programming approach
  • (D) None of the Above

A

Admin • 828.03K Points
Coach

Q. JRE stands for

  • (A) Java Realtime Environment
  • (B) Java Rapid Enterprise
  • (C) Java Runtime Environment
  • (D) None of the above

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ