Previous QuizPrev Quiz
Multithreading
Next QuizNext Quiz

Big Java Binder Early Objects

Computing

Quiz 21 :
Multithreading

Quiz 21 :
Multithreading

Showing 1 - 20 of 82
Next Quiz
arrow
Given a single CPU and four threads, how many of the threads can execute in parallel?
Free
Multiple Choice
Answer:

Answer:

A

arrow
Given a two-CPU machine and four threads, how many of the threads can execute in parallel?
Free
Multiple Choice
Answer:

Answer:

B

arrow
The Runnable interface includes which method(s)? I public void run(Runnable runnable) II public void run() III public void start()
Free
Multiple Choice
Answer:

Answer:

B

arrow
Which method(s) are part of the Thread class? I public void run(Runnable runnable) II public void start(Runnable runnable) III public void start()
Multiple Choice
Answer:
arrow
Which of the following class declarations could run in a thread? I public interface MyRunnable extends Runnable { . . . } II public class MyRunnable extends Runnable { . . . } III public class MyRunnable implements Runnable { . . . }
Multiple Choice
Answer:
arrow
Which of the following does not create an object that can run in a thread, assuming the following MyRunnable class declaration? public class MyRunnable implements Runnable { . . . } I Runnable runnable = new Runnable(); II Runnable runnable = new MyRunnable(); III MyRunnable runnable = new MyRunnable();
Multiple Choice
Answer:
arrow
In which method are the tasks that are performed by a thread coded?
Multiple Choice
Answer:
arrow
Which method do you call to make a thread ineligible to run on the CPU for a set number of milliseconds?
Multiple Choice
Answer:
arrow
Which exception must be caught or declared when calling the sleep method?
Multiple Choice
Answer:
arrow
Which constructor can be used to create a new thread associated with a Runnable object?
Multiple Choice
Answer:
arrow
For threads of equal priority, which is guaranteed by the thread scheduler that is part of the Java Virtual Machine? I All will get time on the CPU II All will get exactly equal time on the CPU III The order threads run in the CPU will always be the same
Multiple Choice
Answer:
arrow
If you do not use the Runnable interface, then what is necessary to create a new thread? I Implement the Threadable interface II Extend the Thread class and add a run() method to it III Add a run method to any class
Multiple Choice
Answer:
arrow
Suppose run1 and run2 are objects of the class MyRunnable, which implements the Runnable interface. What is the result of the following calls? run1.run(); Run2.run();
Multiple Choice
Answer:
arrow
When a sleeping thread is interrupted, an InterruptedException is generated. Where do you catch that exception?
Multiple Choice
Answer:
arrow
The Runnable interface has a single method called ____________.
Multiple Choice
Answer:
arrow
The _____________ interface is designed to encapsulate the concept of a sequence of statements that can run in parallel with other tasks, without equating it with the concept of a thread, a potentially expensive resource that is managed by the operating system.
Multiple Choice
Answer:
arrow
The ________ method stops the current thread for a given number of milliseconds.
Multiple Choice
Answer:
arrow
When a thread is interrupted, the most common response is to terminate the ____________ method.
Multiple Choice
Answer:
arrow
When a sleeping thread is interrupted, a(n) ____________________ is generated.
Multiple Choice
Answer:
arrow
To start a thread, you should first construct an object from a class that implements the ____________ interface.
Multiple Choice
Answer:
Showing 1 - 20 of 82
Next Quiz