| OCR |
GCSE (9-1) Computer Science
Mark Scheme
J277/02: Data Types & Casting
|
| Question | Answer | Marks | Guidance |
|---|---|---|---|
| 1a | 9 | 1 |
Examiner's Note: GHOST TOPIC. Students routinely write '10'. Zero marks for '10'. They must understand that
int() floors the value. |
| 1b | Casting to an integer truncates (removes) the decimal part; it does not round up. | 1 | |
| 2 |
Row 1 Values:
|
4 |
Examiner's Note: GHOST TOPIC. This relies on 2.2.3 (string/char manipulation) and explicitly uses the ASC/CHR commands listed in the specification.
|
| 3 |
|
3 |
Part 3 is the discriminator.
int(4.8) becomes 4. float(4) becomes 4.0. |
| 4a |
Explanation that a non-empty string (even "False") is "truthy" in many languages/Python, so bool("False") becomes True.OR: It casts the presence of text, not the meaning of the text. |
2 |
Examiner's Note: GHOST TOPIC. Explicit boolean casting is rare in exams but critical for "Robust Programs".
|
| 4b |
if userInput == "False": isValid = False(or similar logic). |
2 | |
| 5 |
num = random(65, 90)
|
3 |
1 mark for random range.
1 mark for CHR cast. 1 mark for print. |
| 6a | Line 03 | 1 | |
| 6b |
print("You are " + str(ageMonths) + " months old.")
|
2 |
Must cast
ageMonths to String.1 mark for str(), 1 mark for correct syntax. |
| 7 |
|
3 |
int is not accepted for the first gap because the prompt specified "decimal number". |
| 8 | 102 | 2 |
Concatenation, not addition. 1 mark for 102. 0 marks for 12.
|
| 9 | It removes the fractional part of the number (precision), making the data less accurate. | 2 |
Must refer to "loss of precision" or "decimal part removed".
|