Java MCQs with answers Page - 29

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 • 832.27K Points
Coach

Q. Interfaces helps in which type of inheritance

  • (A) Multiple inheritance
  • (B) Multilevel inheritance
  • (C) Hierarchical inheritance
  • (D) None of above

A

Admin • 832.27K Points
Coach

Q. Which of these values is returned by read () method is end of file (EOF) is encountered?

  • (A) 0
  • (B) 1
  • (C) -1
  • (D) Null

A

Admin • 832.27K Points
Coach

Q. Which of these exception is thrown by close () and read () methods?

  • (A) IOException
  • (B) FileException
  • (C) FileNotFoundException
  • (D) FileInputOutputException

A

Admin • 832.27K Points
Coach

Q. Which exception is thrown by the read ( ) method of input stream class?

  • (A) Exception
  • (B) ClassNotFoundException
  • (C) read Exception
  • (D) IOException

A

Admin • 832.27K Points
Coach

Q. What garbage collection in the context of java?

  • (A) The operating system periodically deletes all of the java files available on the system.
  • (B) Any package imported in a program and not used in automatically deleted.
  • (C) When all references to an object are gone, the memory used by the object is automatically reclaim
  • (D) None of the above

A

Admin • 832.27K Points
Coach

Q. In order for a source code file, containing the public class test, to successfully compile, which of the following must be true?

  • (A) It must have a package statement
  • (B) It must be named test.java
  • (C) It must import java.lang
  • (D) It must declare a public class named test.

A

Admin • 832.27K Points
Coach

Q. Which of the following are true about the Error and Exception classes?

  • (A) Both classes extend throwable
  • (B) The error class is final and exception class is not.
  • (C) The Exception class is final and the Error is not.
  • (D) Both classes implement Throwable

A

Admin • 832.27K Points
Coach

Q. Which of the following are true?

  • (A) The void class extends the class class
  • (B) The float class extends double class
  • (C) The system class extends the runtime class
  • (D) The integer class extends the number class

A

Admin • 832.27K Points
Coach

Q. How do you create a Reader object from an InputStream object?

  • (A) Use the static createReader() method of InputStream class
  • (B) Use the static createReader() method of Reader class
  • (C) Create an InputStreamReader object passing the InputStream object and an argument to the InputStreamReader constructor.
  • (D) Create an OutputStreamReader object, passing the InputStream object as an argument to the OutputStreamReader constructor.

A

Admin • 832.27K Points
Coach

Q. Which of the following is true?

  • (A) The event inheritance model has replaced the event delegation model
  • (B) The event inheritance model is more efficient than event delegation model
  • (C) The event delegation model uses event listeners to define the methods of event handling classes.
  • (D) The event delegation model uses the handleEvent() method to support event handling.

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