Errors and Bugs(yr 7)

Erros & Bugs
1 / 13
next
Slide 1: Slide
ComputingLower Secondary (Key Stage 3)

This lesson contains 13 slides, with interactive quizzes, text slides and 1 video.

Items in this lesson

Erros & Bugs

Slide 1 - Slide

Do Now - What happens if we have errors in our program when we are writing code?
Do now - When you press RUN on a program, what do you think happens inside the computer?

Slide 2 - Open question

The CPU (the computers brain) reads each instruction line by line, storing and updating variables in memory and waiting for any needed input. It then sends commands to output devices like the screen, any errors/bugs stop the program running or make it behave unexpectedly.

Slide 3 - Slide

Learning Objective: 
To understand how computer systems work (hardware, software, data) and apply this through identifying and fixing debugging errors.

Slide 4 - Slide

Errors
  • When programs are written, it is likely that at least some errors will creep in. Errors in programs are often referred to as bugs

  • It is vital that programs are as free of errors as possible. Errors can cause a program to produce unexpected results, or crash

  • There are two types of error that need to be considered:

  • syntax error
  • logic error

  • Each type of error is different, and each is solved in different ways.






Errors & Bugs

Slide 5 - Slide

What is a bug?
A
An error in an algorithm
B
An error in a program
C
A way of stopping a program that is running
D
An insect in the computer

Slide 6 - Quiz

  • Syntax is the spelling and grammar of a programming language

  • Programming languages have rules for spelling, punctuation and grammar, just like the English language. 

  • In programming, a syntax error occurs when:

  1. There is a spelling mistake
  2. There is a grammatical mistake

  • Syntax errors will cause a program to crash or not run at all. Or the program may run until it encounters a syntax error, then it will stop.

Syntax Errors

Slide 7 - Slide

What is a Syntax error
A
A mistake in the logic of the program
B
A spelling or grammatical mistake in the program
C
A way of stopping a program that is running
D
A type of variable

Slide 8 - Quiz

If a syntax error is present, what will happen when the error is encountered?
A
The program will crash when the error is encountered
B
The program will behave unexpectedly
C
The program will not start
D
Nothing

Slide 9 - Quiz

Logic Errors
  • Logic errors occur when there is a fault in the logic or structure of the program.

  • Logic errors do not usually cause a program to crash. However, logic errors can cause a program to produce unexpected results.

  • A logic error in programming will cause your program to have unexpected results. If we give our instructions in the wrong order, our program will still run but not how we intended it.

  • More than one type of logic error may exist. Parts of the program may:

  1. Be in the wrong sequence
  2. Have the wrong Boolean expression
  3. Be missing altogether

  • Any one or more of these errors may exist in a program, and each will cause the program to behave unexpectedly.

Slide 10 - Slide

Turn and talk
What is the difference between syntax errors and logic errors?

Slide 11 - Slide

Slide 12 - Video

In pairs Complete Levels 1 - 10 of debugging with Scrat
Extensions

Slide 13 - Slide