wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Lab10

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

When main() method in a Java program creates 3 threads, how many threads are in execution?

a)

0

b)

2

c)

4

d)

3

2.

The order of execution if threads is managed by:

a)

Java Compiler

b)

Default Scheduler

c)

Thread Manager

d)

Thread Scheduler

3.

A Thread can be created by

a)

Extending "Thread" Class

b)

Extending "Runnable" Class

c)

Implementing "Runnable" Interface

d)

Extending "Object" Class

4.

The start() method of an thread object will change the thread from _______ state to _______ state.

a)

Ready to Active

b)

Born to Ready

c)

Ready to Wait

d)

Active to Ready

5.

The constant value assigned to MAX_PRIORITY is

a)

1

b)

10

c)

5

d)

20

6.

The default priority for all child threads is:

a)

5

b)

10

c)

Inherited by Parent thread

d)

No priority

7.

The different ways to handle exceptions is by using:

a)

try & catch block and ExceptionHandler()

b)

throws and finally()

c)

try & catch and throws

d)

finally() and finalize()

8.

_________ is usually used to handle user defined exceptions

a)

ExceptionHandler()

b)

UserException()

c)

throw

d)

finalize()

9.

Adapter class forces the child class to implement all the methods from the interface.

a)

True

b)

False

10.

What is the output?

a)

Thread starts

b)

Thread starts, Thread is active

c)

Thread is active

d)

Compile error