1) Which of the following statements is not correct?
a) Threads allow several concurrent activities to occur by spawning
new processes.
b) A system thread is a schedulable sub-process.
c) Each operating system's thread implementation is different.
d) Java supplies a generic thread model that is portable across operating
systems
a)
// Comment: The process term is at the multitasking
layer of the operating system.
// Threads allow several concurrent events to
occur inside one of these processes.
2) Consider two threads. One is generating a number that will be used
by the
second thread. The first thread will block
until the second thread which is
generating the number notifiies it that the
number is ready. Which of the
following best describes the thread interactions.
a) Unrelated Threads
b) Related but Unsynchronized
c) Related and Synchronized
d) Related, Synchronized and Cooperating
( d )
3) All
the following terms were used to describe the synchronization process.
Which one is an abreviation for two other words?
a) monitor
b) semaphore
c) mutex
d) lock
( c )
4) [True or False] Concurrent reentrant
code maintains concurrency by
not using variables that are defined locally. [True]
5) Which of the following statements is not correct?
a) The synchronized keyword can be applied to
a block of code
b) a synchronized section cannot be put inside
a non-synchronized method
c) In a synchronized block the object that supplies
the monitor is placed
in round brackets between the synchonized keyword
and the block that
is being synchronized.
d) The synchronized keyword effectively makes
a section of code atomic.
( b )
// Comment: There is no problem with doing this
and in fact this can make
// code more efficient by reducing the amount
of code that is synchronized
6) Which of the following is not an Object class method used by synhronized
threads to communicate.
a) wait( )
b) waitAll( )
c) notify( )
d) notifyAll( )
( b )