wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

mutithreading MCQ'S in java

Total questions: 20

Worksheet time: 19mins

Name
Class
Date
1.

Q) Number of threads in below java program is

public class ThreadExtended extends Thread {


public void run() {

System.out.println("\nThread is running now\n");

}


public static void main(String[] args) {


ThreadExtended threadE = new ThreadExtended();


threadE.start();

}

}

a)

0

b)

1

c)

2

d)

3

2.

The life cycle of a thread in java is controlled by

a)

JRE

b)

JDK

c)

JVM

d)

None

3.

Thread is _____________process that can run independently

a)

heavyweight

b)

lightweight

c)

compaction

d)

compression

4.

Choose THREE(3) benefits of multithreaded processing

a)

scalability

b)

resource sharing

c)

privacy

d)

responsiveness

5.

Execution of a java thread begins on which method call?

a)

Run ()

b)

Start ()

c)

Execute ()

d)

Launch ()

6.

___________distributing task across multiple computing cores

a)

data parallelism

b)

implicit threading

c)

task parallelism

d)

identifying task

7.
Which of these is not a Thread state?
a)
New
b)
Runnable
c)
sleep
d)
terminated
8.

Q) Min and Max priority of a thread in Java multithreading are

a)

1, 10

b)

0,10

c)

0,255

d)

1,256

9.

Q) Which method is used to check if a thread is running?

a)

isAlive()

b)

run ()

c)

alive ()

d)

keepAlive()

10.

Q) Execution of a java thread begins on which method call?

a)

Start ()

b)

Run ()

c)

Execute ()

d)

Launch ()

11.

Q) Number of threads in below java program is

public class ThreadExtended extends Thread {


public void run() {

System.out.println("\nThread is running now\n");

}


public static void main(String[] args) {


ThreadExtended threadE = new ThreadExtended();


threadE.start();

}

}

a)

0

b)

1

c)

2

d)

3

12.

Q) What is maximum thread priority in Java

a)

10

b)

12

c)

5

d)

8

13.

Which statements is/are correct

a)

On calling Thread start ( ) method a new thread is created

b)

Thread start( ) method call run( ) method internally

c)

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

d)

both a & b

14.

In JAVA multi threading, a thread can be created by_______

a)

Extending class

b)

Implementing Runnable Interface

c)

both

d)

none

15.

Thread priority in Java is?

a)

Integer

b)

Float

c)

Double

d)

Long

16.

Which method is used to get current running thread object?

a)

runningThread()

b)

currentThread()

c)

runnableThread()

d)

None

17.

The life cycle of a thread in java is controlled by

a)

JRE

b)

JDK

c)

JVM

d)

None

18.

Which will contain the body of the thread in Java?

a)

Start()

b)

Run()

c)

Main()

d)

Execute()

19.

Which method is used to make main thread to wait for all child threads

a)

Join ()

b)

Sleep ()

c)

Wait ()

d)

Stop ()

20.

How many ways a thread can be created in Java multithreading?

a)

1

b)

2

c)

5

d)

10