Filters
Question type

Study Flashcards

An ExecutorService object is created by calling a static method of which class?


A) Executor.
B) Executors.
C) ExecutorService.
D) Thread.

E) A) and C)
F) A) and D)

Correct Answer

verifed

verified

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.


A) Thread.
B) Runner.
C) Runnable.
D) None of the above.

E) B) and D)
F) None of the above

Correct Answer

verifed

verified

Which one of the following statements is true with regard to a producer/consumer relationship with one producer and one consumer?


A) A producer can never produce faster than the consumer is consuming.
B) A consumer can never consume faster than the producer is producing.
C) A producer can produce more items than a consumer consumes.
D) A consumer can consume more items than a producer produces.

E) All of the above
F) C) and D)

Correct Answer

verifed

verified

The BlockingQueue interface declares which two methods for blocked adding and blocked removing of elements from a circular buffer?


A) put and take.
B) add and remove.
C) push and pop.
D) place and get.

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

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.


A) consumer,producer.
B) producer,consumer.
C) outputter,inputter.
D) None of the above.

E) B) and D)
F) All of the above

Correct Answer

verifed

verified

B

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.


A) notifyThread,notifyAllThreads.
B) wakeUpThread,wakeUpAllThreads.
C) notify,notifyAll.
D) None of the above.

E) A) and C)
F) B) and C)

Correct Answer

verifed

verified

This class is used to help implement mutual exclusion.


A) MutEx.
B) Condition.
C) Lock.
D) Signal.

E) C) and D)
F) B) and C)

Correct Answer

verifed

verified

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.


A) waitForOtherThreads.
B) stop.
C) waitForCondition.
D) wait.

E) B) and C)
F) None of the above

Correct Answer

verifed

verified

When using Java's built-in monitors,every object has a(n) ________ or a(n) ________ that the monitor ensures is held by a maximum of only one thread at any time.


A) monitor lock,intrinsic lock.
B) built-in lock,free lock.
C) mutual exlcusion lock,synchronization lock.
D) None of the above.

E) A) and D)
F) B) and D)

Correct Answer

verifed

verified

If a thread calls __________,then every thread waiting for the object becomes eligible to acquire the lock.


A) signalEach.
B) signalAll.
C) signal.
D) signalMethods.

E) B) and D)
F) None of the above

Correct Answer

verifed

verified

You can simulate atomicity by ensuring that ________.


A) at least one thread carries out its operations on an object at a time.
B) two threads carry out their operations on an object in parallel.
C) only one thread carries out its operations on an object at a time.
D) None of the above.

E) All of the above
F) None of the above

Correct Answer

verifed

verified

A new thread begins its life cycle by transitioning to the __________ state.


A) runnable.
B) waiting.
C) terminated.
D) new.

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

With timeslicing,each thread is given a limited amount of time,called a __________,to execute on a processor.


A) Quantum.
B) Processor burst.
C) Time allocation.
D) Scheduling interval.

E) B) and C)
F) None of the above

Correct Answer

verifed

verified

In a producer/consumer relationship with a single cell of shared memory,which of the following is true?


A) The consumer must run first.
B) The producer must run first.
C) The producer must run first or the consumer will have to wait.
D) The consumer must run first or the producer will have to wait.

E) All of the above
F) B) and C)

Correct Answer

verifed

verified

Interface ExecutorService provides the ________ method,which returns control to its caller either when all tasks executing in the ExecutorService complete or when the specified timeout elapses.


A) waitForTermination.
B) wait.
C) awaitTermination.
D) None of the above.

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

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.


A) synchronized.
B) shared.
C) thread.
D) writeable.

E) A) and C)
F) B) and C)

Correct Answer

verifed

verified

The Callable interface declares this method.


A) get.
B) call.
C) run.
D) execute.

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

B

Which of the following is not true of ExecutorService?


A) It is a subinterface of Executor.
B) It is an object that can be run in a separate thread.
C) It declares method shutdown.
D) It manages a group of threads.

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

The main method executes in the ________ thread of execution.


A) starting
B) main
C) local
D) None of the above.

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

B

In a producer/consumer relationship,when a consumer finds the buffer empty or finds that the previous data has already been read,the consumer should call __________.


A) lock.
B) signal.
C) sleep.
D) await.

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

Showing 1 - 20 of 25

Related Exams

Show Answer