In java thread can be created by?
A.Extending a thread class
B.Implementing a runnable interface
C.either extending a thread class or implementing a runnable interface
D.by extending a thread class and implementing a runnable interface
When a class extends a thread class, it should override which method to invoke the execution of a thread?
A.run()
B.start()
C.join()
D.runnable()
Which of the following constructor is valid?
A.Thread(Runnable threadOb, int priority)
B.Thread(Runnable threadOb, String threadName)
C.Thread(String threadName, int priority)
D.None of these
Which cannot directly cause a thread to stop executing?
A.Calling the SetPriority() method on a Thread object.
B.Calling read() method on an InputStream object.
C.Calling notify() method on an object.
D.Calling the wait() method on an object.
Which of the following will directly stop the execution of a Thread?
A.notify()
B.notifyall()
C.wait()
D.exits synchronized code
Which function of pre defined class Thread is used to check whether current thread being checked is still running?
A. isAlive()
B.Alive()
C.isRunning()
D.Join()
What notifyAll() method will do?
A.Wakes up one threads that are waiting on this object's monitor
B.Wakes up all threads that are not waiting on this object's monitor
C.Wakes up all threads that are waiting on this object's monitor
D.None of the above
Assume the following method is properly synchronized and called from a thread A on an object B: wait(2000); After calling this method, when will the thread A become a candidate to get another turn at the CPU?
A.After thread A is notified, or after two seconds.
B.Two seconds after thread A is notified.
C.After the lock on B is released, or after two seconds.
D.Two seconds after lock B is released.
Which keyword when applied on a method indicates that only one thread should execute a method at a time
A.volatile
B.native
C.synchronized
D.join
Which class or interface defines the wait(), notify(),and notifyAll() methods?
A.Object
B.Class
C.Runnable
D.Thread