Top 250+ Solved Java Programming MCQ Questions Answer
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.
Q. Which of these keywords is used to define interfaces in Java?
a. interface
b. Interface
c. intf
d. implements
Q. Which exception is thrown by read() method?
a. IOException
b. InterruptedException
c. SystemException
d. SystemInputException
Q. Which class is the super class of all classes of the java.lang package?
a. Object
b. System
c. Super
d. Class
Q. Which of the following exception is raised when a number is divided by zero
a. NumberFormatException
b. ArithmeticException
c. NullPointerException
d. IllegalArgumentException
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
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
Q. Which of these interface is implemented to create a Thread?
a. Runnable
b. Connections
c. Set
d. MapConnections
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()
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()
Q. Which method in Thread class is used to check weather a thread is still running?
a. isAlive()
b. Join()
c. isRunning()
d. Alive()