Multithreading Basics Self Test With Answers


1) Which of the following terms is used almost exclusively to describe
     processes with processes?

a) multiprogramming
b) time sharing
c) multitasking
d) multithreading                                                      ( d )

2)  Regarding preemptive multithreading which of the following statements is least
correct?
a) threads with higher priority preempt threads with lower priority
b) the preemptive model affords some predictability with respect to which
    processes will be run
c) java's preemptive model is uneffected by the underlying system's thread model.
d) If all threads are given equal priority values they will behave more or less like
    a time-sliced system.                                           ( c )

// Comment: The multithreading model that Java uses is influenced by the model that
// is used by the underlying system.

3) Which of the following is least correct in describe the different states threads
can assume?
a) Running
b) Blocked
c) Ready
d) Dead                                                                 ( b )

// Comment: Blocked is just one of several forms of Wait States

4) Which of the following variations that result in the creation of wait states is a
method but is not defined in the Thread class.
a) yield( )
b) wait( )
c) block
d) sleep( )                                                              ( b )

// wait( ) is defined in Object

5) In comparing an thread instance of a Java multithreaded environment to a virtual
computer system, calling the start( ) method can be thought of as corresponding to
which of the following?

a) a Virtual Machine
b) main( ) method
c) Power On
d)  a CPU                                                             ( c )

6) Consider the two approaches to obtaining Thread behaviour. When the
Runnable interface is implemented which of the following is not correct?

a) The Thread class constructor targets the Runnable object.
b) Both the Thread object and Runnable object are instantiated.
c) The Runnable object will supply a definition for the run( ) method.
d) The start( ) method is called on the Runnable object.        ( d )

Comment: The start( ) method is called on the Thread object.