levo

Computational Thinking

Logic errors, test data and efficiency

  • 3 things to know
  • Paper 1

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.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Computational Thinking
Data
Computers
Networks

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

The check is 45 + 27 = 72.
denarybinaryhexadecimal

Blank Blitz makes facts automatic

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

AA normal test value is 14.
BA boundary test value is 16.
CAn erroneous test value is 20.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

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 traps are the mistakes students actually make.

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.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

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