Top 250+ Solved Java Programming MCQ Questions Answer

From 181 to 195 of 285

Q. Which of the following are true about interfaces.

a. Methods declared in interfaces are implicitly private.

b. Variables declared in interfaces are implicitly public, static, and final.

c. An interface contains any number of method definitions.

d. The keyword implements indicate that an interface inherits from another.

  • b. Variables declared in interfaces are implicitly public, static, and final.

Q. Which of these keywords is used to define interfaces in Java?

a. interface

b. Interface

c. intf

d. implements

  • a. interface

Q. Which exception is thrown by read() method?

a. IOException

b. InterruptedException

c. SystemException

d. SystemInputException

  • a. IOException

Q. Which is the super class of all exception classes

a. Exception

b. Object

c. Error

d. Throwable

  • d. Throwable

Q. Which class is the super class of all classes of the java.lang package?

a. Object

b. System

c. Super

d. Class

  • a. Object

Q. Which of the following exception is raised when a number is divided by zero

a. NumberFormatException

b. ArithmeticException

c. NullPointerException

d. IllegalArgumentException

  • b. ArithmeticException

Q. A single try block must be followed by which of these?

a. finally

b. catch

c. catch or finally

d. None of the mentioned

  • c. catch or finally

Q. Which of these exceptions will occur if we try to access the index of an array beyond its length?

a. ArithmeticException

b. ArrayException

c. ArrayIndexException

d. ArrayIndexOutOfBoundsException

  • d. ArrayIndexOutOfBoundsException

Q. Runnable is a

a. Class

b. Method

c. Variable

d. Interface

  • d. Interface

Q. Thread priority in Java is represented as?

a. int

b. Float

c. double

d. long

  • a. int

Q. Which of these class is used to make a thread?

a. String

b. System

c. Thread

d. Runnable

  • c. Thread

Q. Which of these interface is implemented to create a Thread?

a. Runnable

b. Connections

c. Set

d. MapConnections

  • a. Runnable

Q. Which of these method of Thread class is used to find out the priority given to a thread?

a. get()

b. ThreadPriority()

c. getPriority()

d. getThreadPriority()

  • c. getPriority()

Q. Which of this method of Thread class is used to change the state of a thread to blocked state?

a. sleep()

b. terminate()

c. stop()

d. block()

  • a. sleep()

Q. Which method in Thread class is used to check weather a thread is still running?

a. isAlive()

b. Join()

c. isRunning()

d. Alive()

  • a. isAlive()
Subscribe Now

Get All Updates & News