JUnit Questions and Answers – Creating HTML Reports

«
»

This set of JUnit Multiple Choice Questions & Answers (MCQs) focuses on “Creating HTML Reports”.

1. The Executor implementations provided implement ____________ which is a more extensive interface.
a) ExecutorService
b) ThreadPoolExecutor
c) ArrayDeque
d) SerialExecutor
View Answer

Answer: a
Explanation: The ExecutorService interface is extended and implemented by the Executor implementations.
advertisement

2. The __________ command executes the given command at some time in the future.
a) Execution()
b) execute(Runnable command)
c) scheduleNext()
d) poll()
View Answer

Answer: b
Explanation: The command may execute in a new thread, in a pooled thread, or in the calling thread.

3. The _____________ exception can be thrown by the execute(Runnable command) function.
a) Arithmetic
b) ArrayIndexOutOfBounds
c) StringIndexOutOfBounds
d) RejectedExecutionException
View Answer

Answer: d
Explanation: RejectedExecutionException is thrown if the task cannot be accepted for execution.

4. Other than RejectedExecutionException, the execute(Runnable command) function can also throw which exception?
a) Arithmetic
b) ArrayIndexOutOfBounds
c) StringIndexOutOfBounds
d) NullPointerException
View Answer

Answer: d
Explanation: This exception is thrown if the command passed as argument is null.
advertisement

5. ______________ runs all commands that are currently pending.
a) runUntilIdle
b) runPendingCommands
c) execute
d) isIdle
View Answer

Answer: b
Explanation: If those commands also schedule commands for execution, the scheduled commands will not be executed.

6. ____________ runs executed commands until there are no commands pending execution.
a) runUntilIdle
b) runPendingCommands
c) execute
d) isIdle
View Answer

Answer: a
Explanation: runUntilIdle does not tick time forward but just runs executed commands.

7. ____________ returns whether this executor is idle.
a) runUntilIdle
b) runPendingCommands
c) execute
d) isIdle
View Answer

Answer: d
Explanation: isIdle() function checks that there are no pending background tasks waiting to be run.
advertisement

8. ____________ runs time forwards by a given duration, executing any commands scheduled for execution during that time period.
a) runUntilIdle
b) runPendingCommands
c) tick
d) isIdle
View Answer

Answer: c
Explanation: The tick() command also runs any background tasks spawned by the scheduled tasks.

9. When a call to tick returns, the executor will be idle.
a) True
b) False
View Answer

Answer: a
Explanation: Since the spawned background tasks are run the executor remains idle.

10. ________________ blocks until all tasks have completed execution after a shutdown request, or the timeout occurs.
a) awaitTermination
b) runPendingCommands
c) tick
d) isIdle
View Answer

Answer: a
Explanation: awaitTermination returns true if this executor terminated and false if the timeout elapsed before termination.
advertisement

Sanfoundry Global Education & Learning Series – JUnit.
To practice all areas of Junit, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn