WorksheetsJava Multithreading_Wrapperclass
Total questions: 15
Worksheet time: 11mins
What will happen if two thread of the same priority are called to be processed simultaneously?
Anyone will be executed first lexographically
Both of them will be executed simultaneously
None of them will be executed
It is dependent on the operating system
What is the priority of the thread in the following Java Program?
class multithreaded_programing
{
public static void main(String args[])
{
Thread t = Thread.currentThread(); System.out.println(t);
} }
4
5
0
1
Deadlock is a situation when thread is waiting for other thread to release acquired object.
True
False
Which of these keywords are used to implement synchronization?
synchronize
syn
synch
synchronized
Which of these method is used to tell the calling thread to give up a monitor and go to sleep until some other thread enters the same monitor?
wait()
notify()
notifyAll()
sleep()
What is synchronization in reference to a thread?
It’s a process of handling situations when two or more threads need access to a shared resource
It’s a process by which many thread are able to access same shared resource simultaneously
It’s a process by which a method is able to access many different threads simultaneously
It’s a method that allow too many threads to access any information the require
Which method must be defined by a class implementing the java.lang.Runnable interface?
public void start()
public void run()
void run()
None of these
How many ways a thread can be created in Java multithreading?
1
2
5
10
The life cycle of a thread in java is controlled by
JRE
JDK
JVM
None
Which method is used to get current running thread object?
runningThread()
currentThread()
runnableThread()
None
Synchronized static methods acquire lock on
Class
Object
Interface
None
Thread priority in Java is?
Integer
Float
Double
Long
Wrapper classes are found in _____ package
java.lang
java.util
java.io
java.net
Which of these is a wrapper for data type int?
Integer
Long
Byte
Double
Which of these is a super class of wrappers Long, Character & Integer?
Long
Digits
Float
Number
