Java MCQs with answers Page - 15

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

Q. Which of these class is used to read and write bytes in a file?

  • (A) FileReader
  • (B) FileWriter
  • (C) FileInputStream
  • (D) InputStreamReader

A

Admin • 833.24K Points
Coach

Q. Which of the interface contains all the methods used for handling thread related operations in Java?

  • (A) Runnable interface
  • (B) Math interface
  • (C) System interface
  • (D) ThreadHandling interface

A

Admin • 833.24K Points
Coach

Q. Which of these exceptions will be thrown if we use null reference for an arithmetic operation?

  • (A) ArithmeticException
  • (B) NullPointerException
  • (C) IllegalAccessException
  • (D) IllegalOperationException

A

Admin • 833.24K Points
Coach

Q. Which of these methods of a Thread class is used to suspend a thread for a period of time?

  • (A) sleep()
  • (B) terminate()
  • (C) suspend()
  • (D) stop()

A

Admin • 833.24K Points
Coach

Q. Which of this method of class String is used to obtain a length of String object?

  • (A) get()
  • (B) Sizeof()
  • (C) lengthof()
  • (D) length()

A

Admin • 833.24K Points
Coach

Q. Which of these packages contains the exception Stack Overflow in Java?

  • (A) java.lang
  • (B) java.util
  • (C) java.io
  • (D) java.system

A

Admin • 833.24K Points
Coach

Q. Which of these operators is used to allocate memory for an object?

  • (A) malloc
  • (B) alloc
  • (C) new
  • (D) give

A

Admin • 833.24K Points
Coach

Q. How to copy contents of array?

  • (A) System.arrayCopy()
  • (B) Array.copy()
  • (C) Arrays.copy()
  • (D) Collection.copy()

A

Admin • 833.24K Points
Coach

Q. which of the following can be operands of arithmetic operators?

  • (A) Numeric
  • (B) Boolean
  • (C) Characters
  • (D) Both Numeric & Characters

A

Admin • 833.24K Points
Coach

Q. Which of these can not be used for a variable name in Java?

  • (A) identifier
  • (B) keyword
  • (C) identifier & keyword
  • (D) none of the mentioned