JUnit Questions and Answers – Unit Testing with Mock Objects

This set of JUnit Multiple Choice Questions & Answers (MCQs) focuses on “Unit Testing with Mock Objects”.

1. __________ is an error condition hiding another error condition.
a) Fault Masking
b) Error Hiding
c) Redundant Masking
d) Fault Gaping
View Answer

Answer: a
Explanation: Fault Masking is a type of redundancy analysis.

2. To get an expected test outcome a standard procedure is followed which is referred as ___________
a) Testing Mechanism
b) Testing Type
c) Test Cast
d) Test Scope
View Answer

Answer: b
Explanation: Testing types include Unit testing, API testing among others.

3. The test instantiates ___________ and calls methods on these _________
a) Objects
b) Classes
c) Services
d) Subsystems
View Answer

Answer: a
Explanation: The test class has to be instantiated and objects are created.
advertisement
advertisement

4. The test runs while a ___________ or EJB container hosts the application.
a) Objects
b) Classes
c) Servlet
d) Subsystems
View Answer

Answer: c
Explanation: The servlet attaches to any other external resource or device.

5. A layered application may have a front end to handle the presentation and a ______________ to execute the business logic.
a) Objects
b) Classes
c) Servlet
d) Back end
View Answer

Answer: d
Explanation: The front end is responsible for the presentation while the back end defines the logic.

6. ______________ tests examine the code at the boundary of its public API.
a) Unit
b) Integration
c) Functional
d) Loss
View Answer

Answer: c
Explanation: This corresponds to testing application use cases.

7. Developers often combine functional tests with __________ tests.
a) Unit
b) Integration
c) Stress
d) Loss
View Answer

Answer: b
Explanation: Functional tests are so designed so as to combine with integration tests easily.
advertisement

8. Layering provides __________ and the ability to access the back end with several different front ends.
a) Flexibility
b) Redundancy
c) Authorization
d) Simplicity
View Answer

Answer: a
Explanation: Layering allows to separate the logic from the presentation.

9. ____________ tests examine whether the application can process a large number of requests test types within a given period.
a) Unit
b) Integration
c) Stress
d) Acceptance
View Answer

Answer: c
Explanation: Stress tests should automatically sends preprogramed requests and tracks how quickly the application responds.
advertisement

10. The stress test environment should be as close as possible to the __________ environment.
a) Design
b) Review
c) Test
d) Production
View Answer

Answer: d
Explanation: Otherwise, the results will not be accurate or useful.

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

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.