Programming  Java  Threads

1. Two threads cannot simultaneously enter into the methods of the same object if the methods are

static synchronized private package

Share this QA

2. While using threads which of the following is incorrect?

You invoke the Run method You implement Runnable interface You extend from Thread class You call the start method

Share this QA

3. What is the name of the method used to schedule a thread for execution?

init() start() run() resume()

Share this QA

4. What is the default priority of a thread in Java?

10 5 3 1

Share this QA

5. A thread becomes not runnable when

its sleep method is invoked the program terminates a network connection is established an event occurs

Share this QA

6. What is the default priority of a newly created thread?


Share this QA

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?
while the current thread does not hold the lock of the object

The code will fail to compile Nothing special will happen An IllegalMonitorStateException will be thrown if the wait() method is called, The thread will be blocked until it gains the lock of the object

Share this QA

8. Which one of the following is a static member of Thread ?

currentThread() join() getName() interrupt()

Share this QA

9. Select the valid thread state transition?

ready to running ready to waiting waiting to running running to ready

Share this QA

10. What is dead thread in java ?

A thread that is waiting for I/O operation A thread completed its run method A thread is in sleep None of these

Share this QA


*Click on the QNo to display a Question.

Total Ans