Question 1 Report
The table below shows results from testing a program that checks visitor pass codes at a community workshop. A pass code must contain six characters and begin with the word WK. The programmer has opened the test file in an editor because some outputs are erroneous. The program accepts a code when both rules are true.
| Test number | Pass code input | Program display |
|---|---|---|
| 1 | WK3814 | accepted |
| 2 | WK72 | accepted |
| 3 | AB3814 | rejected |
| 4 | WK0000 | accepted |
The condition currently used in the program is:IF LEFT(code, 2) = "WK" OR LENGTH(code) = 6 THEN
(a) Identify the test number that shows an error in the program output. [1]
(b) Give two further pass-code inputs that should be used to test the program, including one boundary example. [2]
(c) Complete the corrected Boolean operator needed between the two tests in the condition. [1]
(d) State the correct display for test number 2 after the code has been corrected. [1]
(e) Write a suitable name for the file that could store the test data, including a file extension. [1]
(a) The erroneous result is the row with input WK72, identified as test number 2. [1] It begins with WK but has only four characters, so it must not be accepted.
(b) Suitable additional tests include WK123, a five-character code beginning WK [1], and WK12345, a seven-character code beginning WK. [1] These test values immediately below and above the required length of six.
(c) The corrected operator is AND. [1] Both rules must be true: the code must begin with WK and have length 6.
(d) After correction, test number 2 should display rejected. [1]
(e) A suitable test-data filename is passTests.csv. [1] The filename is meaningful and .csv is a valid file extension.
Everything you need to excel in your exams