Online GK Series

This site is dedicated to the aspirants of competitive exams SSC, UPSC, Railways, Postal Assistants, Bank, GATE and NET

One Year MBA At Rs.7500/- Only Apply Now

Questions Answers on Multithreading in Java - Multiple Choice Quiz

6 What is the default priority of a newly created thread?
D None of these

Answer: Option [B]

Normal priority i.e. 5

7 What will be the result of invoking the wait() method on an object without ensuring that the current thread holds the lock of the object?
A The code will fail to compile
B Nothing special will happen
C An IllegalMonitorStateException will be thrown if the wait() method is called, while the current thread does not hold the lock of the object
D The thread will be blocked until it gains the lock of the object

Answer: Option [C]
8 Which one of the following is a static member of Thread ?
A currentThread()
B join()
C getName()
D interrupt()

Answer: Option [A]

CurrentThread is static member method. It returns currently running thread.

9 Select the valid thread state transition?
A ready to running
B ready to waiting
C waiting to running
D running to ready

Answer: Option [A]

6 states of a new thread are new, runnable, timed waiting, waiting, blocked, terminated. A thread is run from the ready state when scheduler selects and goes to the running state.

10 What is dead thread in java ?
A A thread that is waiting for I/O operation
B A thread completed its run method
C A thread is in sleep
D None of these

Answer: Option [B]

A dead or terminated thread has completed its run() method. It can never be restarted.


Useful Computer Science EBooks