This set of JUnit Questions and Answers for Campus Interviews focuses on “The Mock Objects Solution”.
1. Using old tests to guard against new changes is a form of ______________
a) Unit Testing
b) Integration Testing
c) Regression Testing
d) Loss Testing
View Answer
Explanation: The best way to ensure that regression testing takes place is to automate the test suites.
2. A ________ is a piece of code that’s inserted at runtime in place of the real code.
a) Stub
b) Mock Object
c) Packet
d) Jammer
View Answer
Explanation: Stubs are used in order to isolate the caller from the real implementation.
3. The intent of using stubs is to replace a _________ behaviour with a simpler one.
a) Unique
b) Complex
c) Redundant
d) Anomalous
View Answer
Explanation: Stubs allow independent testing of some part of the real code.
4. Stubs usually provide high _____________ in the tested system.
a) Mocking
b) Security
c) Confidence
d) Modularity
View Answer
Explanation: With stubs, the objects under test aren’t getting modified.
5. Stubs don’t lend themselves well to ____________ unit testing.
a) Fine-grained
b) Coarse-grained
c) Redundant
d) Functional
View Answer
Explanation: In general, stubs are better adapted for replacing coarse-grained portions of code.
6. A build or developer usually executes tests involving stubs in their _________ environment.
a) Dead
b) Running
c) Production
d) Fake
View Answer
Explanation: Executing in the running environment provides additional confidence.
7. An implementation that returns a hardcoded value for purposes of testing is known as a __________
a) Stub
b) Mock Object
c) Packet
d) Jammer
View Answer
Explanation: A stub implementation can be created dynamically using lambdas.
8. _____________ is a software testing technique that is useful to help in the generation of test data.
a) Symbolic Execution
b) Stubs
c) Active testing
d) All-pairs testing
View Answer
Explanation: Symbolic Execution is used in proving the program quality.
9. The ______________ identifies the decision points and the assignments associated with each flow.
a) Decision Table
b) Flowgraph
c) Testing Design
d) Audit
View Answer
Explanation: Traversing the flow graph from an entry point is used to produce a list of assignment statements and branch predicates.
10. Symbolic execution is not able to proceed if the number of iterations in the loop is known.
a) True
b) False
View Answer
Explanation: Symbolic execution can also not be used with arrays.
Sanfoundry Global Education & Learning Series – JUnit.
To practice all areas of JUnit for Campus Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Buy JUnit Books
- Apply for JUnit Internship
- Practice Programming MCQs
- Buy Programming Books
- Apply for Information Technology Internship