Back to 课程

Computer Science GCES OCR

0% Complete
0/0 Steps
  1. Cpu Architecture Performance And Embedded Systems Ocr
    5 主题
  2. Primary And Secondary Storage Ocr
    6 主题
  3. Data Storage And Compression Ocr
    12 主题
  4. Networks And Topologies Ocr
    6 主题
  5. Wired And Wireless Networks Protocols And Layers Ocr
    6 主题
  6. Identifying And Preventing Threats To Computer Systems And Networks Ocr
    2 主题
  7. Operating Systems And Utility Software Ocr
    2 主题
  8. Ethical Legal Cultural And Environmental Impact Ocr
    2 主题
  9. Computational Thinking Searching And Sorting Algorithms Ocr
    3 主题
  10. Designing Creating And Refining Algorithms Ocr
    5 主题
  11. Programming Fundamentals And Data Types Ocr
    5 主题
  12. Additional Programming Techniques Ocr
    7 主题
  13. Defensive Design And Testing Ocr
    6 主题
  14. Boolean Logic Diagrams Ocr
    2 主题
  15. Programming Languages And Integrated Development Environments Ides Ocr
    3 主题
  16. The Exam Papers Ocr
    2 主题
  17. Structuring Your Responses Ocr
    3 主题
课 Progress
0% Complete

Exam code:J277

How do I answer an OCR GCSE (9-1) Computer Science trace table question?

What is a trace table?

  • Trace tables are used to follow the values of variables as a program runs

  • These questions test your ability to simulate code line by line and accurately record outputs

Examiner Tips and Tricks

  • You must read the code carefully and simulate it exactly as a computer would

  • Use a pencil and annotate each step

  • The most common mistake is skipping or misreading a line

What you need to know

  • You may be asked to complete a trace table, explain a trace table, or spot errors in output

  • These questions are normally worth 3–6 marks

  • Most commonly appear in questions involving iteration, selection, and arrays/lists

  • In most cases, the structure of the table is provided, your task is to complete the missing values

Command words to look out for

Command word

What it means

Complete

Fill in the table with correct values

State

Give the value/output/result (usually a single word or number)

Explain

Say why something happens or changes in the program

Identify

Spot where something goes wrong or doesn’t match expectations

How to tackle a trace table question

Follow these steps to answer trace table questions accurately:

  1. Read the code carefully

    Understand what each line does

    Look out for loops, IF statements, and variable changes

  2. Use the trace table provided
    Use the headings and row count to guide how many iterations or steps are needed

  3. Work line by line
    Simulate the program in your head or on paper

    Update each variable after every change

  4. Watch out for variable resets
    Variables declared inside loops often reset every time, don’t carry the wrong value across iterations

  5. Show the final output clearly
    If you’re asked for the output, make sure it’s written exactly as it would appear on screen

Worked example

Question

This algorithm calculates the number of points a student gets for the distance they throw in the javelin:

01 javelinThrow = input("Enter distance")
02 yearGroup = input("Enter year group")
03 if javelinThrow >= 20.0 then
04 score = 3
05 elseif javelinThrow >= 10.0 then
06 score = 2
07 else
08 score = 1
09 endif
10 if yearGroup != 11 then
11 score = score * 2
12 endif
13 print("The score is", score)

Complete the trace table for the algorithm when a student in year 10 throws a distance of 14.3

You may not need to use all the rows in the table

Line number

javelinThrow

yearGroup

score

Output

  1. Read the code carefully

  • Line 1: It asks you to type in the javelin distance and stores it in a variable called javelinThrow

  • Line 2: It asks for your year group (like “10” or “11”) and stores it in yearGroup

  • Lines 3–9: It decides how many points to give you:

    • If your throw was 20 metres or more, you get 3 points

    • If your throw was 10 metres or more, you get 2 points

    • If your throw was less than 10 metres, you get 1 point

  • Lines 10–12: It checks if you are not in Year 11:

    • If you’re not in Year 11, your score is doubled

    • If you are in Year 11, your score stays the same

  • Line 13: It prints your final score

  1. Use the trace table provided

  • The trace table contains six blank lines which give you an indication of how many times a change/output is required

  • If you get to the end and you have only completed 2/3 lines, check again, something is probably wrong

  1. Work line by line

01 javelinThrow = input("Enter distance")

14.3

02 yearGroup = input("Enter year group")

10

03 if javelinThrow >= 20.0 then

No

04 score = 3
05 elseif javelinThrow >= 10.0 then

Yes

06 score = 2

score = 2

  1. Watch out for variable resets

  • This program contains no loops

  1. Show the final output clearly

13 print("The score is", score)

The score is 4

Final answer

Table with columns: Line number, javelinThrow, yearGroup, score, Output. Data includes scores of 2, 4, and a message "The score is 4".

Responses

您的邮箱地址不会被公开。 必填项已用 * 标注