Omar misunderstood the late-penalty rule and wrote if (daysLate >= 7) return 0;. A student 7 days late then received 0. Which term describes the wrong line of code?
Q2
What is a test oracle?
Q3
Dijkstra said testing "can show the presence of bugs, but never their absence". What is the practical consequence?
Q4
Which is the healthy shape of an automated test suite according to the test pyramid?
Q5
A post title must have 5 to 100 characters. Which set is the best equivalence-partitioning representatives set?
Q6
For the same rule (5–100 characters), which lengths does boundary value analysis add?
Q7
A group-size rule: "a study group has 2 to 6 members". A test suite checks sizes 1, 2, 6 and 7. Which fault could it miss?
Q8
When is a decision table the most useful test-design technique?
Q9
Using the decision table in this chapter: a student who is not the author and not a TA opens a hidden post. What must happen?
Q10
A post can be DRAFT, PUBLISHED, HIDDEN or DELETED. Which test is an important invalid-transition test?
Q11
For the badge(posts, endorsed) method in this chapter, the only test is badge(12, true). What are the statement and branch coverage?
Q12
A module has 100% branch coverage. What can we conclude?
Q13
In assertEquals(26, result); which argument is the expected value in JUnit?
Q14
How do you test in JUnit 5 that a method throws IllegalArgumentException for a negative score?
Q15
A test checks "Deadline reminder is sent 24 hours before" by reading the real system clock. It passes in the morning and fails at night. Which FIRST property is violated?
Q16
testB passes only if testA ran first, because testA inserts a student into a static list. Which property is violated, and what is the fix?
Q17
To test the answer cache without calling the real AI provider, the team uses an object that answers with fixed strings and counts how many times it was called. This double is best described as…
Q18
What is the main risk of over-mocking?
Q19
In TDD, why must the new test be seen failing before writing the code?
Q20
What is the correct order of the TDD cycle?
Q21
An AI generated this test. What is its problem?
@Test
void testScore() {
int r = LatePenalty.scoreAfterLatePenalty(85, 7);
assertEquals(LatePenalty.scoreAfterLatePenalty(85, 7), r);
}
Q22
Which AI-generated test is weakest?
Q23
You want to know quickly whether an AI-generated test suite is strong. What is a good check?
Q24
Which level of testing checks that StudyBuddy's PostService and the real MySQL database work together correctly?
Q25
A test for the reminder feature needs "now" to be 9 October 23:59. What is the best approach?
Q26
Which is the best way to combine TDD with an AI coding assistant?
Q27Short answer
Design test cases for this rule using equivalence partitioning and boundary value analysis: "A study group has between 2 and 6 members, and each member must be at least 16 years old." List partitions (valid and invalid) for both inputs and at least 8 test cases with expected results.
Q28Short answer
Explain why 100% branch coverage does not prove a method correct. Give two concrete examples.
Q29Short answer
Draw the state-transition model for a StudyBuddy post (states DRAFT, PUBLISHED, HIDDEN, DELETED; events publish, hide, restore, delete) and list tests that cover every valid transition plus two invalid ones.
Q30Short answer
Explain the difference between a stub, a fake and a mock, with one StudyBuddy example each, and say when a fake is better than a mock.