R4RIN
Articles
Java 8
MCQS
jUnit MCQ Quiz Hub
Junit Mcq Question Set 4
Choose a topic to test your knowledge and improve your jUnit skills
1. The __________ command executes the given command at some time in the future.
Execution()
execute(Runnable command)
scheduleNext()
poll()
2. The _______ exception can be thrown by the execute(Runnable command) function.
Arithmetic
ArrayIndexOutOfBounds
StringIndexOutOfBounds
RejectedExecutionException
3. Other than RejectedExecutionException, the execute(Runnable command) function can also throw which exception?
Arithmetic
ArrayIndexOutOfBounds
StringIndexOutOfBounds
NullPointerException
4. _______ runs all commands that are currently pending.
runUntilIdle
runPendingCommands
execute
isIdle
5. _____ runs executed commands until there are no commands pending execution.
runUntilIdle
runPendingCommands
execute
isIdle
6. __________ returns whether this executor is idle.
runUntilIdle
runPendingCommands
execute
isIdle
7. _______ runs time forwards by a given duration, executing any commands scheduled for execution during that time period.
runUntilIdle
runPendingCommands
tick
isIdle
8. When a call to tick returns, the executor will be idle.
True
False
all of the above
none of the above
9. _________ blocks until all tasks have completed execution after a shutdown request, or the timeout occurs.
awaitTermination
runPendingCommands
tick
isIdle
10. ____ submits a value-returning task for execution and returns a Future representing the pending results of the task.
submit(Callable<T> task)
awaitTermination
submit(Runnable task, T result)
invokeAll()
11. _______ submits a Runnable task for execution and returns a Future representing that task.
submit(Callable<T> task)
awaitTermination
submit(Runnable task, T result)
invokeAll()
12. _______ returns true if all tasks have completed following shut down.
submit(Callable<T> task)
isTerminated
submit(Runnable task, T result)
invokeAll()
13. ________ returns true if this executor has been shut down.
isShutdown
isTerminated
submit(Runnable task, T result)
invokeAll()
14. _________ is used for the execution of the given tasks, returning a list of Futures holding their status and results after completion.
isShutdown
isTerminated
invokeAll(Collection<? extends Callable<T>> tasks)
invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
15. _______ executes the given tasks, returning the result of one that has completed successfully.
isShutdown
invokeAny(Collection<? extends Callable<T>> tasks)
invokeAll(Collection<? extends Callable<T>> tasks)
invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
16. _______ exception is thrown while invokeAll() is interrupted while waiting.
InterruptedException
NullPointerException
RejectedExecutionException
ArrayIndexOutOfBoundsException
17. NullPointerException is thrown if tasks or any of its elements are null.
True
False
all of the above
none of the above
18. InterruptedException is thrown if any task cannot be scheduled for execution.
True
False
all of the above
none of the above
19. _______ initiates an orderly shutdown in which previously submitted tasks are executed.
Shutdown
invokeAny(Collection<? extends Callable<T>> tasks)
invokeAll(Collection<? extends Callable<T>> tasks)
invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
20. Mutation testing is a form of ________
Black Box Testing
Redundancy
White Box Testing
Loss Testing
Submit