WorksheetsMultithreading
Total questions: 20
Worksheet time: 13mins
1. The capability to control the access of multiple threads to any shared resource is called_____________
Synchronization
Multitasking
multithreading
None
Why to use synchronization?
Avoiding thread interference
Avoiding consistency problem
Both
None
_______________ and __________________ are the types of synchronization.
Process synchronization and thread synchronization
multitasking and multithreading
Interthread communication and mutual exclusion
None
How many Types of synchronization approaches are there under mutual exclusion?
3
4
2
0
What are the approaches under mutual exclusion?
Synchronized method
Synchronized block
Static synchronization
All the above
Choose the correct syntax for synchronized method.
a. synchronized returntype methodname(.....)
a. returntype methodname(.....)
c. synchronized methodname(.....)
d. None
Identify the correct mutual exclusion approach:
synchronized(this)
{
….
….
}
Synchronized method
Synchronized block
Static Synchronization
None
Identify the correct mutual exclusion approach:
synchronized static returntype method(parameters)
{
}
synchronized method
synchronized block
static synchronization
None
__________________________ is a mechanism in which a thread is paused running in its critical section and another thread is allowed to enter (or lock) in the same critical section to be executed.It
Inter thread communication
Co-operation
option 1 or option 2
None
_____________tells calling thread to give up monitor and go to sleep until some other thread enters the same monitor and call notify.
wait()
notify()
notifyAll()
start()
______________wakes up a thread that called wait() on same object.
start()
run()
notify()
sleep()
_________wakes up all the threads that called wait() on same object.
notify()
notifyAll()
wait()
sleep()
Which is the static method?
wait()
sleep()
Both
None
wait(), notify() and notifyAll() belongs to which class?
Thread
Object
FileInputStream
Exception
_________thread in java is a service provider thread that provides services to the user thread.
Producer thread
Consumer thread
Daemon thread
None
Daemon thread is a _________priority thread.
low
high
Normal
None
wait() releases the lock on the shared resource.
True
False
_______________is the return type of isDaemon()
String
int
boolean
float
sleep() method belongs to which class?
Object
Thread
Exception
InputStream
We should notify the sleep() method to wake up.
True
False
