CS FundamentalsHardTCS NQT · Infosys interview pattern
In a unit test, the real payment gateway is replaced by an object that records calls so that the test can assert “charge() was called exactly once with ₹500”. What kind of test double is this?
- A. Mock
- B. Stub
- C. Dummy
- D. Fake
Correct answer: A. Mock
A mock verifies interactions — which calls were made and with what arguments. A stub only returns canned answers, a dummy is passed around but never used, and a fake is a working lightweight implementation (such as an in-memory database).
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Using a three-point PERT estimate, a task has optimistic time 4 days, most likely 6 days and pessimistic 14 days. What is the expected…
- An application is modified so that it keeps working after the company moves it to a new operating system version and a new database…
- Counts for a system: 10 external inputs, 8 external outputs, 6 external inquiries, 4 internal logical files and 2 external interface…
- What is the minimum number of test cases needed to achieve MC/DC (modified condition/decision coverage) for the decision if (A && B)?
- A method in class Invoice spends most of its code reading fields of a Customer object (name, address, discount tier) and barely uses…
- Tasks and durations (days): A 3; B 4 (after A); C 2 (after A); D 5 (after B and C); E 1 (after C). What is the total slack (float) of task…