Identify Syntax & Logic Errors in Testing Flashcards

Card 1 of 5

All 5 cards in this deck

What is a syntax error?

An error that breaks the grammatical rules of the programming language, so the program cannot be run or translated.

What is a logic error?

An error that lets the program run but produces unexpected or incorrect output.

Give one example of a syntax error in code.

A misspelled keyword or a missing bracket/quotation mark, e.g. prnt("Hello").

Give one example of a logic error in code.

Using the wrong operator, e.g. total = a - b when the total should be a + b, or < where <= is needed.

Why can't a translator detect a logic error?

Code with a logic error still obeys the language's rules, so it translates and runs. Logic errors are found by testing or a trace table instead.