GCSE · Computer Science · Eduqas · Spec C500QS

Break point

Your program runs, prints an answer, and the answer is wrong, with no error message. How do you look inside it? Freeze it halfway.

Computer Science · Software development

Freeze it twice and look inside

Two break points, one hidden logic error.

This program should print the average of three test scores. Break points are on line 5 and line 6. The ▶ marks the line the program has reached; at a break point it has not run that line yet. Nothing is run here: every value is the lesson's.

score1 = 12
score2 = 18
score3 = 15
total = score1 + score2 + score3
average = score1 + score2 + score3 / 3
print(average)

Variables

(no variables yet)

Step 1. The run starts at line 1. The break points are on line 5 and line 6, so lines 1 to 4 run straight through without stopping.

Step 1 of 4Called right: 0 of 2

Same code, two runs

Run with no break pointvsRun with a break point on one line

Compare the same program run with and without a break point.

Focus

The program's code

Run with no break point

The code you wrote

Run with a break point on one line

Exactly the same code

The insight

Setting a break point does not change the code. The marker is not a line of the program; it only affects how the program is run while you test it.

Where it comes from

Run with no break point

Nothing is marked

Run with a break point on one line

A marker you set on a line you chose

At the marked line

Run with no break point

The line is carried out and the program keeps going

Run with a break point on one line

Execution pauses before the line is carried out

What you can look at

Run with no break point

What the program shows when it runs

Run with a break point on one line

The program's state at that point, such as variable values

Computer Science · Software development

What does a break point actually do?

A student sets a break point on line 6 of their program and runs it in the development environment. The run reaches line 6.

Which is closest to what you think happens?
How sure are you?

Exam line: A break point pauses the run before the marked line, lets you examine the state, and leaves the code unchanged.

Computer Science · Software development

Which line holds the logic error?

This program should print the total cost of 3 items at £4 each plus £2 delivery, which is £14. It prints 9 and shows no error message. A programmer sets break points before line 3 and before line 6. At the first pause, price holds 4 and quantity holds 3, as expected. At the second pause, total holds 9 but 14 was expected. Which line holds the logic error?

A program with one logic error — which line goes wrong?

Exam line: Read only the lines between the right pause and the wrong one, and ask which could produce the wrong value.

Computer Science · Software development

Explain it in your own words

Explain how a break point can help a programmer to find a logic error in a program. [3 marks]

0 words · your answer stays on this page and is not sent anywhere.

Exam line: Name what the programmer does at the pause, and say what the comparison tells them.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Freeze a running program on a line you choose, then look inside it.

What you need to know

  • A break point is a tool in a development environment (IDE) that helps you test and debug a program.
  • You set it as a marker on a line of code that you choose.
  • Setting a break point doesn't change your code. It only changes how the program runs while you test it.
  • Have a goSam sets a break point on line 4 and announces: “I've added a new line to my program!” Is Sam right?

    No. The program's code is exactly the same as before.

    A break point is a marker, not code. It only affects how the program is run while it is being tested in the development environment.

  • When the running program reaches that line, execution pauses (stops temporarily) before the line is carried out.
  • While it's paused, you can examine the program's current state, such as the values held in variables.
  • Then you continue, and the program runs on until it reaches the next break point or ends.
  • Have a goBreak points sit on lines 3 and 8. The program is paused at line 3 and you press continue. Where does it stop next?

    At the break point on line 8.

    Continuing resumes the run, and it goes on until the next break point, or until the program ends if there isn't one.

  • You can set several break points in one program, to check its state at different stages.
  • Check that state against what you expected, and you narrow down where a logic error is.
  • Have a goAt a pause, a variable you expected to hold 20 holds 14. Has the logic error already happened, or not yet?

    Already. The value is wrong at this point.

    A wrong value at the pause means something went wrong in the lines that ran before it, so that is where you look, not at the lines still to come.

The big picture

A break point is a marker you set on a line of code in a development environment. When the running program reaches that line it pauses before the line is carried out, so you can examine the values it holds, then continue. Compare what you see with what you expected and you can narrow down where a logic error is, without changing the code.

Key points

1A break point pauses the run before the marked line is carried out. It does not end the program.
2While paused you examine the state, such as variable values. You look; the code stays unchanged.
3Continue, and the program runs to the next break point or to the end.
4A value that is wrong at a pause means the logic error has already happened. Right values suggest it comes later.
5Several break points let you check the program at different stages.

Worked example

Problem

A program should print the cost of 6 pens at £2 each, plus £3 postage, minus a £4 discount: £11. It prints 7 and shows no error message. Line 1: pens = 6. Line 2: price = 2. Line 3: cost = pens + price. Line 4: cost = cost + 3. Line 5: discount = 4. Line 6: cost = cost - discount. Line 7: print(cost). Use break points to find the faulty line.

⚠ Watch out

Thinking a break point stops the program for good, or fixes the code. It pauses the run before the marked line, you examine the state, and the code is untouched.

🧠

Memory hook

A break point is a pause button, not a stop button: freeze, look, carry on.

✓

Check yourself

A program is paused at a break point on line 6. Has line 6 been carried out yet? What could you look at now, and what would you compare it with?

Flashcards

(11)
What is a break point?
A tool in a development environment (IDE) for testing and debugging programs.
How do you set a break point?
You put a marker on a line of code that you choose.
What happens when the running program reaches a line with a break point?
Execution pauses (stops temporarily) before that line is carried out.
Does the pause come before or after the marked line is carried out?
Before. At the pause, the marked line has not been carried out yet.
Does a break point end the program?
No. It is a temporary pause, and the program can carry on afterwards.
What can you examine while the program is paused?
The program's current state, such as the values held in variables at that point.
What happens when you continue from a break point?
The program runs on until it reaches the next break point or ends.
Why set several break points in one program?
To check the program's state at different stages of its execution.
Does setting a break point change the program's code?
No. It only affects how the program is run while it is being tested.
How does a break point help find a logic error?
It lets you check the program is behaving as expected at a specific point, narrowing down where the error is so it can be located and fixed.
A variable is already wrong when the program pauses. Where do you look?
At the lines that ran before the pause, because the error has already happened.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More Eduqas GCSE Computer Science topics

See the full Eduqas Computer Science curriculum →

How this lesson was checked. This Eduqas GCSE Computer Science (specification C500QS)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 16 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.