1A new thread begins its life cycle by transitioning to the
1.A new thread begins its life cycle by transitioning to the __________ state.
runnable.
waiting.
terminated.
new.
2: The preferred means of creating multithreaded Java applications is by implementing the ________ interface. An object of a class that implements this interface represents a task to perform.
Thread.
Runner.
Runnable.
None of the above.
3: The main method executes in the ________ thread of execution.
starting
main
local
None of the above.
4: When a __________ method or block is running on an object, the object is locked so no other such method can run on that object at the same time.
synchronized.
shared.
thread.
writeable.
5: In a producer/consumer relationship, the ________ portion of an application generates data and stores it in a shared object, and the ________ portion of an application reads data from the shared object.
consumer, producer.
producer, consumer.
outputter, inputter.
None of the above.
6: In a producer/consumer relationship with a single cell of shared memory, which of the following is true?
The consumer must run first.
The producer must run first.
The producer must run first or the consumer will have to wait.
The consumer must run first or the producer will have to wait.
7: When a thread obtains the monitor lock on an object, then determines that it cannot continue with its task on that object until some condition is satisfied, the thread can call Object method ________; this releases the monitor lock on the object, and transitions the thread waits to the waiting state.
waitForOtherThreads.
stop.
waitForCondition.
wait.
8: When a thread executing a synchronized statement (or method) completes or satisfies the condition on which another thread may be waiting, it can call Object method ________ or ________ to allow a waiting thread or all waiting threads to transition to the runnable state again.
notifyThread, notifyAllThreads.
wakeUpThread, wakeUpAllThreads.
notify, notifyAll.
None of the above.
Solution
1. New
A new thread starts its life cycle in the new state. It continues in this state until the program starts the thread. It is too submitted to as a born thread.
2. Runnable
A runnable object stands for a task that is able to execute along with other tasks
3. Main
Java allocates the name main to the thread that runs the main () method, the preliminary thread. Usually see that name in the exemption in thread main note that the JVM\'s default exception handler produces when the starting thread flings an exception object.

