Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Multithreading_Wrapperclass

Total questions: 15

Worksheet time: 11mins

Name
Class
Date
1.

What will happen if two thread of the same priority are called to be processed simultaneously?

a)

Anyone will be executed first lexographically

b)

Both of them will be executed simultaneously

c)

None of them will be executed

d)

It is dependent on the operating system

2.

What is the priority of the thread in the following Java Program?

class multithreaded_programing

{

public static void main(String args[])

{

Thread t = Thread.currentThread(); System.out.println(t);

} }

a)

4

b)

5

c)

0

d)

1

3.

Deadlock is a situation when thread is waiting for other thread to release acquired object.

a)

True

b)

False

4.

Which of these keywords are used to implement synchronization?

a)

synchronize

b)

syn

c)

synch

d)

synchronized

5.

Which of these method is used to tell the calling thread to give up a monitor and go to sleep until some other thread enters the same monitor?

a)

wait()

b)

notify()

c)

notifyAll()

d)

sleep()

6.

What is synchronization in reference to a thread?

a)

It’s a process of handling situations when two or more threads need access to a shared resource

b)

It’s a process by which many thread are able to access same shared resource simultaneously

c)

It’s a process by which a method is able to access many different threads simultaneously

d)

It’s a method that allow too many threads to access any information the require

7.

Which method must be defined by a class implementing the java.lang.Runnable interface?

a)

public void start()

b)

public void run()

c)

void run()

d)

None of these

8.

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

a)

1

b)

2

c)

5

d)

10

9.

The life cycle of a thread in java is controlled by

a)

JRE

b)

JDK

c)

JVM

d)

None

10.

Which method is used to get current running thread object?

a)

runningThread()

b)

currentThread()

c)

runnableThread()

d)

None

11.

Synchronized static methods acquire lock on

a)

Class

b)

Object

c)

Interface

d)

None

12.

Thread priority in Java is?

a)

Integer

b)

Float

c)

Double

d)

Long

13.

Wrapper classes are found in _____ package

a)

java.lang

b)

java.util

c)

java.io

d)

java.net

14.

Which of these is a wrapper for data type int?

a)

Integer

b)

Long

c)

Byte

d)

Double

15.

Which of these is a super class of wrappers Long, Character & Integer?

a)

Long

b)

Digits

c)

Float

d)

Number