JUnit Questions and Answers – Refactoring with Mock Objects

This set of JUnit Question Bank focuses on “Refactoring with Mock Objects”.

1. A profiler can look for _________ in an application.
a) Bottlenecks
b) Redundancies
c) Nodes
d) States
View Answer

Answer: a
Explanation: The developer tries to optimize the bottlenecks.

2. ___________ tests are a superset of all other tests.
a) Unit
b) Integration
c) Loss
d) Acceptance
View Answer

Answer: d
Explanation: Acceptance tests contains characteristics of other tests.

3. A ___________ is a test that exercises code by focusing on a single method.
a) Logic unit test
b) Integration unit test
c) Functional unit test
d) Acceptance unit test
View Answer

Answer: a
Explanation: Logic unit tests are a type of unit test that focuses on a single method.
advertisement
advertisement

4. In logic unit test, the boundaries of a given test can be controlled by using __________
a) Objects
b) Mock objects
c) Controllers
d) Modules
View Answer

Answer: b
Explanation: Mock objects help perform specific tests by narrowing down to a specific task.

5. A ________________is a test that focuses on the interaction between components in their real environment.
a) Logic unit test
b) Integration unit test
c) Functional unit test
d) Acceptance unit test
View Answer

Answer: b
Explanation: Integration unit testing is a type of unit testing which tests components in their real environment.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Code that accesses a database has tests that effectively _________ the database.
a) Ignore
b) Delete
c) Call
d) Define
View Answer

Answer: c
Explanation: As a part of integration unit testing, the test has to call the database to test its components.

7. A _______________ is a test that extends the boundaries of integration unit testing to confirm a stimulus response.
a) Logic unit test
b) Integration unit test
c) Functional unit test
d) Acceptance unit test
View Answer

Answer: c
Explanation: Afunctional unit test is a type of unit test which extends the boundaries of integration tests.
advertisement

8. _____________ more dependent on an external environment than pure unit tests are.
a) Logic unit test
b) Integration unit test
c) Functional unit test
d) Acceptance unit test
View Answer

Answer: c
Explanation: Functional Unit tests are not pure unit tests nor pure functional tests.

9. __________ are put in scope because they’re often useful as part of the battery of tests run in development.
a) Logic unit test
b) Integration unit test
c) Functional unit test
d) Acceptance unit test
View Answer

Answer: c
Explanation: Functional unit tests are more dependent on an external environment than pure unit tests are.
advertisement

10. Functional Unit tests don’t test a complete ____________ as expected by pure functional tests.
a) Workflow
b) Object
c) Class
d) Functions
View Answer

Answer: a
Explanation: Functional Unit tests are not complete functional tests and hence, cannot test the complete workflow of the code.

Sanfoundry Global Education & Learning Series – JUnit.
To practice JUnit Question Bank, 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.