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

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.

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

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.

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