Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Multithreading

Total questions: 20

Worksheet time: 13mins

Name
Class
Date
1.

1. The capability to control the access of multiple threads to any shared resource is called_____________

a)

Synchronization

b)

Multitasking

c)

multithreading

d)

None

2.

Why to use synchronization?

a)

Avoiding thread interference

b)

Avoiding consistency problem

c)

Both

d)

None

3.

_______________ and __________________ are the types of synchronization.

a)

Process synchronization and thread synchronization

b)

multitasking and multithreading

c)

Interthread communication and mutual exclusion

d)

None

4.

How many Types of synchronization approaches are there under mutual exclusion?

a)

3

b)

4

c)

2

d)

0

5.

What are the approaches under mutual exclusion?

a)

Synchronized method

b)

Synchronized block

c)

Static synchronization

d)

All the above

6.

Choose the correct syntax for synchronized method.

a)

a. synchronized returntype methodname(.....)

b)

a. returntype methodname(.....)

c)

c. synchronized methodname(.....)

d)

d. None

7.

Identify the correct mutual exclusion approach:

synchronized(this)

{

….

….

}

a)

Synchronized method

b)

Synchronized block

c)

Static Synchronization

d)

None

8.

Identify the correct mutual exclusion approach:

synchronized static returntype method(parameters)

{

}

a)

synchronized method

b)

synchronized block

c)

static synchronization

d)

None

9.

__________________________ 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

a)

Inter thread communication

b)

Co-operation

c)

option 1 or option 2

d)

None

10.

_____________tells calling thread to give up monitor and go to sleep until some other thread enters the same monitor and call notify.

a)

wait()

b)

notify()

c)

notifyAll()

d)

start()

11.

______________wakes up a thread that called wait() on same object.

a)

start()

b)

run()

c)

notify()

d)

sleep()

12.

_________wakes up all the threads that called wait() on same object.

a)

notify()

b)

notifyAll()

c)

wait()

d)

sleep()

13.

Which is the static method?

a)

wait()

b)

sleep()

c)

Both

d)

None

14.

wait(), notify() and notifyAll() belongs to which class?

a)

Thread

b)

Object

c)

FileInputStream

d)

Exception

15.

_________thread in java is a service provider thread that provides services to the user thread.

a)

Producer thread

b)

Consumer thread

c)

Daemon thread

d)

None

16.

Daemon thread is a _________priority thread.

a)

low

b)

high

c)

Normal

d)

None

17.

wait() releases the lock on the shared resource.

a)

True

b)

False

18.

_______________is the return type of isDaemon()

a)

String

b)

int

c)

boolean

d)

float

19.

sleep() method belongs to which class?

a)

Object

b)

Thread

c)

Exception

d)

InputStream

20.

We should notify the sleep() method to wake up.

a)

True

b)

False