levo

Computational Thinking

Logic errors, test data and efficiency

  • 3 things to know
  • Paper 1
Start revising · £5/month

Overview

Syntax, logic and runtime errors, finding and fixing logic errors in algorithms, normal, boundary and erroneous test data, and judging efficiency by compares, passes and memory.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What are normal, boundary and erroneous test data?

Key term

A program accepts ages from 11 to 16. Give one normal, one boundary and one erroneous test value.

Key term

What is a syntax error?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is a syntax error?

    Model answer

    A syntax error breaks the grammar rules of the programming language. The code cannot be translated and run until the error is fixed.

  2. 2

    What is a logic error?

    Model answer

    A logic error lets the program run but makes it produce the wrong result. The instructions are valid but do not do what was intended.

  3. 3

    Define a runtime error.

    Model answer

    A runtime error happens while the program is running and makes it crash. A division by zero is a common cause.

  4. 4

    Why is a logic error harder to find than a syntax error?

    Model answer

    The translator reports a syntax error with its line number. A logic error gives no message, so it only shows when the output is checked against the expected result.

  5. 5

    An algorithm should find the largest of a list of positive numbers. The algorithm sets largest to 0 and, for each number, replaces largest if number < largest. Identify and correct the error.

    Model answer

    The comparison is the wrong way round, so largest never changes from 0. The condition should be number > largest.

  6. 6

    An algorithm should add up the ten items of an array indexed 0 to 9, but its loop runs from index 1 to 9. What is wrong?

    Model answer

    The item at index 0 is never added, so the total is too small. The loop should start at index 0.

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Computational Thinking
Data
Computers
Networks

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

The check is 45 + 27 = 72.
denarybinaryhexadecimal

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

A kibibyte (KiB) is 1,024 bytes. The figure 1,024 is 2¹⁰.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Computational Thinking, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.