| OCR |
GCSE (9-1) Computer Science
Mark Scheme
J277/02: String Manipulation & ASCII
|
| Question | Answer | Marks | Guidance |
|---|---|---|---|
| 1 |
(a) D (1) (65 + 3 = 68, which is 'D') (b) 2 (1) (ASCII for 'c' is 2 higher than 'a') (c) 2 (1) (The character '2', not the number. ASCII 50 represents the digit '2') |
3 |
Examiner's Note: GHOST TOPIC. Students often panic when they see ASC/CHR. They need to know that characters are stored as integers and can be mathematically manipulated.
|
| 2a | Comparison is case-sensitive. "start" is not equal to "START". | 1 | |
| 2b |
if command.upper() == "START":OR if command.lower() == "start":
|
1 |
Examiner's Note: GHOST TOPIC. Robust programs must handle case. Students often forget
.upper() requires (). |
| 3 |
Row 1: 'R' | "R-" | True Row 2: 'O' | "R-O-" | True Row 3: 'B' | "R-O-B-" | True Row 4: [Empty] | [Empty] | False Output: R-O-B- |
4 |
1 mark for correct letter extraction.
1 mark for correct concatenation with hyphen.
1 mark for correct loop termination.
1 mark for final output.
|
| 4 |
function getInitials(name)
|
6 |
1 mark for return, 1 mark for upper case handling.
Examiner's Note: GHOST TOPIC. High tariff because it combines substring, indexing, and case conversion.
|
| 5 |
Why: String methods return a new string; they do not change the original variable unless re-assigned (1). Correction: name = name.upper() (1).
|
2 |
A very common error in coding tasks.
|
| 6 |
|
3 |
Must cast length (integer) to string before concatenating.
|
| 7 |
|
3 |
Space counts as a character for length (16).
|
| 8 |
pw = input(...)
|
4 |
Must use
.length for comparison.Must ask for input inside loop to avoid infinite loop.
|
| 9 |
|
3 |