wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Thread 2

Total questions: 7

Worksheet time: 6mins

Name
Class
Date
1.

What method in thread class do you call to make the current thread cease executing for a specified amount of time?

a)

sleep()

b)

pause()

c)

stop()

d)

wait()

2.

How many threads does a process contains?

a)

1

b)

2

c)

multiple

d)

none

3.

Which of these is not a thread state?

a)

new

b)

runnable

c)

sleep

d)

terminated

4.

Which statements is/are correct

a)

On calling Thread start () method a new thread get created.

b)

Thread start () method call run () method internally

c)

Thread run () method can also be called directly to create thread.

d)

All correct

5.

Which thread will be executed first if two threads have same priority

a)

They will fall in starvation and none will be executed.

b)

Both will be executed simultaneously

c)

It depends upon operating system

d)

They will be executed on first come first serve basis

6.

Which method is used to create a daemon thread?

a)

setDaemon(boolean value)

b)

setThread(boolean value)

c)

createDaemon(boolean value)

d)

makeDeamon(boolean value)

7.

What is difference between starting thread with run() and start() method?

a)

There is no difference

b)

when you call start() method, main thread internally calls run() to start the newly created thread.

c)

run() calls start() method internally

d)

None of the above