Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1LENGTH(Password) >= 8 | AFormat: 2 letters then 3 digits -> "AB123" accepted, "1234A" rejected | |
| 2Password <> "" | BThe rejected value is 9 characters, which is longer than the minimum, so it would actually pass. The failing value should be one character too short, such as "abcd123" with 7 characters. | |
| 3Test data for a length check of 8 characters minimum should include a value that is one character too short, which must be rejected. | CA presence check. Test data: an empty string "" is rejected, and any entry such as "abcd1234" is accepted. | |
| 4Test data for a format check should include a value with the wrong pattern, such as a code with letters where digits are needed, which must be rejected. | DThe outcomes are the wrong way round. The empty string should be rejected because nothing was entered, and "abcd1234" should be accepted because data is present. | |
| 5Length check (minimum 8): test data "abcd1234" accepted and "abcd12345" rejected | EA length check for a minimum of 8 characters. Test data: "abcd1234" (8 characters) is accepted and "abcd123" (7 characters) is rejected. | |
| 6Presence check test data: "" accepted, "abcd1234" rejected | FTest value "abcd123" -> LENGTH(Password) = 7 -> Rejected |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
LENGTH(Password) >= 8 — Test data for a check includes values that pass and fail it: for an 8-character minimum, 8 characters is accepted, 7 is rejected, and an empty string fails a presence check.IF LENGTH(Password) >= 8 THEN
OUTPUT "Accepted"
ENDIFIF LENGTH(Password) < 8 THEN
OUTPUT "Too short"
ENDIFIF LENGTH(Password) = 0 THEN
OUTPUT "Please enter a password"
ENDIFPassword ← "abcdefg"
Valid ← LENGTH(Password) >= 8
// Expected result: FALSEIF SUBSTRING(Code, 1, 2) = "AB" THEN
OUTPUT "Format OK"
ENDIF