Identify Errors in Algorithms Flashcards

Card 1 of 4

All 4 cards in this deck

What is a logic error?

An error where the program runs but does not do what is expected, e.g. it gives an incorrect or unexpected output.

Give two examples of syntax errors in code.

Misspelling a statement/keyword and a missing bracket, or a string with an opening quotation mark but no closing one.
Also: using a reserved keyword as a variable name (e.g. for = 3), spaces in a variable name.

Give two examples of logic errors in code.

Using the wrong logical/Boolean operator and creating an infinite loop.
Also: brackets in the wrong place in a calculation, or a loop that runs the wrong number of times.

True or false? A program containing a syntax error will still run but give the wrong answer.

False. A program will not run with a syntax error; it is a logic error that runs but gives incorrect results.