Question: Please help with Java test questions, I will post the rest of the question in separate post. Question 1 Consider the following program: public class

Please help with Java test questions, I will post the rest of the question in separate post.

Question 1

Consider the following program: public class CountDownApp3 { public static void main(String[] args) { Thread t1 = new CountDown(); Thread t2 = new CountDown(); t1.start(); t2.start(); } } Assuming that the CountDown class extends the Thread class, how many threads are used to run this program?

a.

3

b.

2

c.

4

d.

1

Question 2

From which of the following states can a thread not be moved into the Runnable state?

a.

Blocked

b.

New

c.

Waiting

d.

Terminated

Question 3

How long will a thread that executes the following statement sleep? Thread.sleep(50);

a.

none of the above

b.

at most 50 milliseconds

c.

at least 50 milliseconds

d.

exactly 50 milliseconds

Question 4

To acquire a lock on an object, you can call

a.

the notify method

b.

a synchronized method

c.

the lock method

d.

the wait method

Question 5

What Java component controls the execution of threads?

a.

thread scheduler

b.

task controller

c.

run scheduler

d.

execution scheduler

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!