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

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.

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

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.

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.

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.

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