MCQOPTIONS
Saved Bookmarks
This section includes 12 Mcqs, each offering curated multiple-choice questions to sharpen your Junit knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
________________ initiates an orderly shutdown in which previously submitted tasks are executed. |
| A. | Shutdown |
| B. | invokeAny(Collection<? extends Callable<T>> tasks) |
| C. | invokeAll(Collection<? extends Callable<T>> tasks) |
| D. | invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) |
| Answer» B. invokeAny(Collection<? extends Callable<T>> tasks) | |
| 2. |
InterruptedException is thrown if any task cannot be scheduled for execution. |
| A. | True |
| B. | False |
| Answer» C. | |
| 3. |
_________________INITIATES_AN_ORDERLY_SHUTDOWN_IN_WHICH_PREVIOUSLY_SUBMITTED_TASKS_ARE_EXECUTED.?$ |
| A. | Shutdown |
| B. | invokeAny(Collection<? extends Callable<T>> tasks) |
| C. | invokeAll(Collection<? extends Callable<T>> tasks) |
| D. | invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) |
| Answer» B. invokeAny(Collection<? extends Callable<T>> tasks) | |
| 4. |
InterruptedException is thrown if any task cannot be scheduled for execution? |
| A. | True |
| B. | False |
| Answer» C. | |
| 5. |
NullPointerException is thrown if tasks or any of its elements are null. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 6. |
_____________ exception is thrown while invokeAll() is interrupted while waiting. |
| A. | InterruptedException |
| B. | NullPointerException |
| C. | RejectedExecutionException |
| D. | ArrayIndexOutOfBoundsException |
| Answer» B. NullPointerException | |
| 7. |
______________ executes the given tasks, returning the result of one that has completed successfully. |
| A. | isShutdown |
| B. | invokeAny(Collection<? extends Callable<T>> tasks) |
| C. | invokeAll(Collection<? extends Callable<T>> tasks) |
| D. | invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) |
| Answer» C. invokeAll(Collection<? extends Callable<T>> tasks) | |
| 8. |
_______________ is used for the execution of the given tasks, returning a list of Futures holding their status and results after completion. |
| A. | isShutdown |
| B. | isTerminated |
| C. | invokeAll(Collection<? extends Callable<T>> tasks) |
| D. | invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) |
| Answer» D. invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) | |
| 9. |
_____________ returns true if this executor has been shut down. |
| A. | isShutdown |
| B. | isTerminated |
| C. | submit(Runnable task, T result) |
| D. | invokeAll() |
| Answer» B. isTerminated | |
| 10. |
_____________ returns true if all tasks have completed following shut down. |
| A. | submit(Callable<T> task) |
| B. | isTerminated |
| C. | submit(Runnable task, T result) |
| D. | invokeAll() |
| Answer» C. submit(Runnable task, T result) | |
| 11. |
____________ submits a Runnable task for execution and returns a Future representing that task. |
| A. | submit(Callable<T> task) |
| B. | awaitTermination |
| C. | submit(Runnable task, T result) |
| D. | invokeAll() |
| Answer» D. invokeAll() | |
| 12. |
________ submits a value-returning task for execution and returns a Future representing the pending results of the task. |
| A. | submit(Callable<T> task) |
| B. | awaitTermination |
| C. | submit(Runnable task, T result) |
| D. | invokeAll() |
| Answer» B. awaitTermination | |