Mark Scheme: J277/02 Computational Thinking, Algorithms and Programming (Version G)

QAnswer/Indicative ContentMarks
1(a) Inputs: Item prices, number of items. (2)
Processes: Addition of prices, calculating tax (if applicable). (2)
Outputs: Total cost, receipt/list of items. (1)
5
1(b) Structure Diagram: Top level: Smart Home System. (1) Second level: Heating, Security, Lighting modules. (3) Connection lines drawn correctly. (1) 5
2(a) Logic Diagram: AND gate for A and B. (1) NOT gate for C. (1) OR gate combining output of AND and NOT gates. (3) Correct input/output labeling. 5
2(b) Truth Table (Result Column): 1, 0, 1, 0, 1, 0, 1, 1. (5 marks for all correct, minus marks for errors) 5
3(a) Difference: Linear search checks each item sequentially (1). Binary search repeatedly divides the list in half (1).
Condition: The list must be sorted (1). Efficiency comparison (1). Scaling comparison (1).
5
3(b) Bubble Sort: Compare adjacent elements (1). If out of order, swap them (1). Repeat for the whole list (1). Repeat passes until no swaps are made (2). 5
3(c) Binary Search for 18:
1. Middle is 15 (Index 4). 18 > 15, search right. (3)
2. Sublist [18, 22, 25, 30]. Middle is 22 or 25. (3)
3. Compare 18 with 22. 18 < 22, search left. (2)
4. Item found at index 5. (2)
10
4(a) Sequence: Steps in order. (1) Example: x=5, y=10. (2)
Selection: Decision making. (1) Example: IF x > 5 THEN... (2)
Iteration: Loops. (1) Example: WHILE x < 10... (3)
10
4(b) Identification: The condition `x > 50` excludes exactly 50. (5)
Refined Code: `if x >= 50:` or `if x > 49:`. (5)
10
5(a) Casting: Changing the data type of a variable (1).
Necessity: Input usually defaults to String (1), but Age needs to be an Integer (1) to perform arithmetic/comparisons (2).
5
5(b) Price: Real/Float (1). Initial: Character (1). Light: Boolean (1). Students: Integer (1). Address: String (1). 5
6(a) Validation: Ensures input is sensible/within range (1). Prevents program crashing (1).
Authentication: Confirms user identity (1). Prevents unauthorized access (2).
5
6(b) Purpose: To find and fix errors/ensure requirements are met. (1)
Iterative: During development (1), testing individual modules (1).
Final: When code is finished (1), testing the whole system together (1).
5