Lesson 66: Check it twice
이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Validation or verification?
- Validation checks that data is sensible: a range check, a length check, a type check (lesson 40).
- Verification checks that data was entered correctly: it is what the user meant to type.
- A password "cat12" can pass validation but still be a typing mistake. Verification catches that.
| Check | How it works |
|---|---|
| double entry | type the data twice; accept it only if both are the same |
| visual check | show the data again; the user looks and confirms it |
English
In the exam
- 0478/21/M/J/25 Q2(b): describe one verification check for a new password. Mark scheme: visual check: look at the data entered and confirm it matches; or double entry check: enter the data twice and only accept identical values.
- 0478/22/M/J/23 Q4(b): (i) a double entry check is used for verification. (ii) Write the code. Mark scheme: iteration; two inputs; check that the two inputs are the same; repeat until they match.
난이도 3/5 · 200코인 + 오늘 첫 완료 시 작은 보너스 추가
A double entry check: the user types a new password twice. The program keeps the first one in first. Finish the part for the second entry: if both are the same, print Password saved and light the green LED (pin 12). If not, print Passwords do not match, light the red LED (pin 13) and ask again with Enter a new password.
출력을 보려면 '실행'을 클릭하세요.
난이도 3/5 · 200코인 + 오늘 첫 완료 시 작은 보너스 추가
A visual check: after the user types a room number, show it back and ask You typed 42. Correct? (Y/N). If the answer is Y, print Saved: and the number. If not, ask for the room number again.
출력을 보려면 '실행'을 클릭하세요.