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.

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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
advertisement
advertisement

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.

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.
advertisement

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.

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
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.