Text version of this lesson
Work out what a conditional guarantees and what it leaves open.
Key takeaway: "If A then B" does not mean that B guarantees A.
Question 1
Rule: "If a card has a star, it is blue." Which conclusion is certainly right?
Options
- If a card is blue, it has a star.
- A card with a star must be blue.
- Every card that is not blue has a star.
- All the cards are blue.
Show answer and explanation
Answer: A card with a star must be blue.
Why: Right. The rule guarantees the colour of a starred card.
Hint: Which way does the arrow run?
Question 2
"If it rains, the street gets wet. The street is wet. So it rained." What can we say about this conclusion?
Options
- Always correct.
- Necessarily wrong.
- Possible, but not forced.
- Only correct in winter.
Show answer and explanation
Answer: Possible, but not forced.
Why: Yes. It may have rained, but a sprinkler or a street cleaner could have wet it just as well.
Hint: Is there another reason the street could be wet?
Question 3
Rule: "If a user confirms their email, the account is activated." The account is not active. Which conclusion is forced?
Options
- The user did not confirm their email.
- The user mistyped their email.
- The user forgot their password.
- The user never logged in.
Show answer and explanation
Answer: The user did not confirm their email.
Why: Right. This is the contrapositive: a confirmed email forces an active account, so no active account means no confirmed email.
Hint: Look at the rule in reverse.
Question 4
If the project passes tests, the release is ready. If the release is ready, a demo goes to the client. The project passed. What follows?
Options
- A demo goes to the client.
- The client will certainly watch the demo.
- The project has no bugs at all.
- The client will pay for the project.
Show answer and explanation
Answer: A demo goes to the client.
Why: Nicely done. That is the chain: passing tests gives the release, and the release gives the demo.
Hint: Where does the first rule take you?
Question 5
The policy says: "If the item is returned within 30 days, the money is refunded." Which claim does the policy not support?
Options
- An item returned within 30 days is refunded.
- An item returned after 30 days is not refunded.
- Returning within 30 days is a sufficient condition for a refund.
- The policy is about a return window.
Show answer and explanation
Answer: An item returned after 30 days is not refunded.
Why: Right. The policy says nothing about what happens after day 30. Maybe a refund, maybe not — the text does not settle it.
Hint: What does the policy say about day 31 and later?
Question 6
When does this function return `true`?
Options
- Only when isVerified is true.
- Only when hasDraft is true.
- When both are true.
- When at least one is true.
Show answer and explanation
Answer: When both are true.
Why: Right. `&&` is AND: publishing needs both the verification and the draft.
Hint: Recall what `&&` means.