This set of JUnit Multiple Choice Questions & Answers (MCQs) focuses on “Mocking an HTTP Connection”.
1. The __________ test relies exclusively on the external system interface to verify its correctness.
a) White Box
b) Unit
c) Black Box
d) Loss
View Answer
Explanation: Black box tests have no knowledge of the internals of the code.
2. In black box testing, all that is needed to know in order to test the system properly is the system’s ______________
a) Functional specification
b) Modularity
c) Redundancy
d) Class definition
View Answer
Explanation: The function specification tells the output and input and not the internals.
3. White box testing is also known as ______________
a) Black box testing
b) Sand box testing
c) Closed testing
d) Glass box testing
View Answer
Explanation: White box requires the internals to be known just as a glass box shows what is inside.
4. White box testing provides better test _________ than black box testing.
a) Result
b) Coverage
c) Mechanism
d) Acceptance
View Answer
Explanation: White box tests cover the internal working of the code leading to greater coverage of the system.
5. ________ tests are more difficult to write and run.
a) White Box
b) Unit
c) Black Box
d) Loss
View Answer
Explanation: Black box tests are difficult to write because they usually deal with a graphical front end.
6. Black box tests can bring more ________ than white box tests.
a) Value
b) Coverage
c) Mechanism
d) Acceptance
View Answer
Explanation: Since black box tests just check the external characteristics including input and output, they bring more value.
7. Using ____________ testing, tests can be created that cover the public API of an application.
a) White Box
b) Unit
c) Black Box
d) Loss
View Answer
Explanation: As the documentation is used as the guide, black box tests are written.
8. Higher test coverage is achieved by white box tests because of ____________
a) Access to more methods
b) Better documentation
c) Faster tests
d) More accepted tests
View Answer
Explanation: Since white box tests have knowledge of the implementation, they have access to more methods.
9. ____________ tests can control both the inputs to each method and the behaviour of secondary objects.
a) White Box
b) Unit
c) Black Box
d) Loss
View Answer
Explanation: Secondary objects like mock objects and stubs are controlled by white box tests.
10. White box unit tests can be written against ____________ package-private, and public methods.
a) Static
b) Private
c) Protected
d) Void
View Answer
Explanation: As white box unit tests cover protected methods too, they give more test coverage.
Sanfoundry Global Education & Learning Series – JUnit.
To practice all areas of Junit, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check JUnit Books
- Practice Programming MCQs
- Apply for Computer Science Internship
- Check Programming Books