Double entry check

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Double entry check

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What is a double entry check?
A Entering the same data twice and comparing the two entries
B Checking that the data is in the allowed range
2. A user sets a new password and must type it in again to confirm. Which check is this?
A Double entry check
B Presence check
3. The two password entries are 'Sunset9' and 'Sunest9'. What should the program do?
A Accept the first entry and ignore the second
B Ask the user to enter the password again
4. When does a double entry check accept the data?
A When both entries are exactly the same
B When the second entry is longer than the first
5. A user types 'Pasword1' by mistake both times. What happens in a double entry check?
A The entries match, so the mistake is always caught
B The entries match, so the mistake is not caught

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1INPUT Password1 INPUT Password2 AOUTPUT "Passwords differ, try again"
2IF Password1 <> Password2 THEN BChecks whether the two entries are different, which shows that a mistake was made.
3The entries must match, so the program accepts the data only when both entries are equal. CUNTIL Password1 = Password2
4When the two entries differ, the program asks the user to enter the data again. DThe data is entered only once, so there is nothing to compare. This is not a double entry check.
5INPUT Password OUTPUT "Password accepted" EMatching entries do not prove the data is correct. The same mistake made twice is not caught.
6Password1 = "cat12", Password2 = "cat12" Output: "Both entries are correct" FThe same data is entered twice so that the two entries can be compared later.

Definitions

double entry check

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
INPUT Password1 INPUT Password2 IF Password1 _ Password2 THEN
2.
WHILE Password1 __ Password2 DO INPUT Password2 ENDWHILE
3.
REPEAT INPUT Password2 _____ Password1 = Password2
4.
IF Password1 <> Password2 THEN ______ "Passwords do not match" ENDIF
5.
Password1 ← "pasword" Password2 ← "pasword" Match ← Password1 = _________

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A INPUT Pass1
B INPUT Pass2
C IF Pass1 <> Pass2 THEN
D OUTPUT "Accepted"
E ENDIF
Question 2
A INPUT Email1
B INPUT Email1
C IF Email1 <> Email2 THEN
D OUTPUT "Do not match"
E ENDIF
Question 3
A DECLARE Pass1 : STRING
B DECLARE Pass2 : INTEGER
C INPUT Pass1
D INPUT Pass2
E IF Pass1 <> Pass2 THEN
F OUTPUT "Enter again"
Question 4
A OUTPUT Pass1
B REPEAT
C INPUT Pass2
D UNTIL Pass1 = Pass2
Question 5
A INPUT Pass1
B INPUT Pass2
C WHILE Pass1 <> Pass2 DO
D OUTPUT Pass2
E ENDWHILE

Answer Key

Double entry check
Section A: Quick Questions
Q1
A — Entering the same data twice and comparing the two entries
Q2
A — Double entry check
Q3
B — Ask the user to enter the password again
Q4
A — When both entries are exactly the same
Q5
B — The entries match, so the mistake is not caught
Section B: Match the Pairs
Q1
INPUT Password1 INPUT Password2 → The same data is entered twice so that the two entries can be compared later.
Q2
IF Password1 <> Password2 THEN → Checks whether the two entries are different, which shows that a mistake was made.
Q3
The entries must match, so the program accepts the data only when both entries are equal. → UNTIL Password1 = Password2
Q4
When the two entries differ, the program asks the user to enter the data again. → OUTPUT "Passwords differ, try again"
Q5
INPUT Password OUTPUT "Password accepted" → The data is entered only once, so there is nothing to compare. This is not a double entry check.
Q6
Password1 = "cat12", Password2 = "cat12" Output: "Both entries are correct" → Matching entries do not prove the data is correct. The same mistake made twice is not caught.
Section C: Definitions
Q1
double entry check — Data is entered twice and the two entries are compared. Any difference shows a mistake, so the user must enter it again. It misses the same mistake made twice.
Section D: Fill in the Blanks
Q1
INPUT Password1 INPUT Password2 IF Password1 = Password2 THEN
Q2
WHILE Password1 <> Password2 DO INPUT Password2 ENDWHILE
Q3
REPEAT INPUT Password2 UNTIL Password1 = Password2
Q4
IF Password1 <> Password2 THEN OUTPUT "Passwords do not match" ENDIF
Q5
Password1 ← "pasword" Password2 ← "pasword" Match ← Password1 = Password2
Section E: Spot the Error
Q1
C — The password should only be accepted when the two entries match. <> means 'not equal', so the program accepts it when they differ. It should be IF Pass1 = Pass2 THEN.
Q2
B — The second entry overwrites the first entry because it is read into Email1 again. Email2 never gets a value, so the two entries cannot be compared. It should be INPUT Email2.
Q3
B — Both entries are passwords, so both must be the same data type to be compared. A password is text, so Pass2 should be declared as STRING, not INTEGER.
Q4
A — The first entry must be read from the user with INPUT. OUTPUT only displays Pass1, so there is no first entry to compare with the second. It should be INPUT Pass1.
Q5
D — When the entries differ, the user must be asked to enter the data again. OUTPUT Pass2 does not change Pass2, so the loop never ends. It should be INPUT Pass2.