250+ TOP MCQs on Unit Testing with Mock Objects and Answers

JUnit Multiple Choice Questions & Answers (MCQs) 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
Answer: a
Clarification: 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
Answer: b
Clarification: 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
Answer: a
Clarification: 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
Answer: c
Clarification: 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
Answer: d
Clarification: 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
Answer: c
Clarification: This corresponds to testing application use cases.

7. Developers often combine functional tests with __________ tests.
a) Unit
b) Integration
c) Stress
d) Loss
Answer: b
Clarification: Functional tests are so designed so as to combine with integration tests easily.

8. Layering provides __________ and the ability to access the back end with several different front ends.
a) Flexibility
b) Redundancy
c) Authorization
d) Simplicity
Answer: a
Clarification: 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
Answer: c
Clarification: 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
Answer: d
Clarification: Otherwise, the results will not be accurate or useful.

Leave a Reply

Your email address will not be published. Required fields are marked *