Programming  Java  Threads

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

static synchronized private package

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

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

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

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

10 5 3 1

5. A thread becomes not runnable when

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

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

MIN_PRIORITY NORM_PRIORITY MAX_PRIORITY None of these

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

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

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

9. Select the valid thread state transition?

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

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

 

*Click on the QNo to display a Question.

Total Ans

 

 

';
Aptitude Coaching - Free Live Session !!