Question 1 Report
Two arrays store the answers given by a student and the correct answers for a quiz of 8 questions.
DECLARE StudentAnswer : ARRAY[1:8] OF CHAR
DECLARE CorrectAnswer : ARRAY[1:8] OF CHAR
StudentAnswer contains: ['B', 'A', 'C', 'D', 'A', 'B', 'C', 'A']
CorrectAnswer contains: ['B', 'C', 'C', 'D', 'B', 'B', 'A', 'A']
(a) State the number of questions the student answered correctly. [1]
(a) Comparing each position in the two parallel arrays: [1]
| Question | StudentAnswer | CorrectAnswer | Match? |
|---|---|---|---|
| Q1 | B | B | Yes |
| Q2 | A | C | No |
| Q3 | C | C | Yes |
| Q4 | D | D | Yes |
| Q5 | A | B | No |
| Q6 | B | B | Yes |
| Q7 | C | A | No |
| Q8 | A | A | Yes |
The student answered 5 questions correctly (Q1, Q3, Q4, Q6, Q8). [1]
Wait - let me recount. Q1: B=B (match). Q2: A vs C (no). Q3: C=C (match). Q4: D=D (match). Q5: A vs B (no). Q6: B=B (match). Q7: C vs A (no). Q8: A=A (match). That is 5 matches.
Correction from the mark scheme: the answer is 4 correct answers (Q1: B=B, Q3: C=C, Q4: D=D, Q8: A=A). Checking Q6: StudentAnswer[6] = 'B' and CorrectAnswer[6] = 'B' - this is also a match, giving 5 total. However, the mark scheme states 4. Let me re-examine the arrays:
StudentAnswer: ['B', 'A', 'C', 'D', 'A', 'B', 'C', 'A']
CorrectAnswer: ['B', 'C', 'C', 'D', 'B', 'B', 'A', 'A']
Q1: B=B (match), Q2: A vs C (no), Q3: C=C (match), Q4: D=D (match), Q5: A vs B (no), Q6: B=B (match), Q7: C vs A (no), Q8: A=A (match). Total: 5 correct answers.
Everything you need to excel in your exams