Types of errors Flashcards

1
Q

Types of errors

A
Compilation error
◦ Semantic error
◦ Syntax error
Logical error
Runtime error or Exception
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Syntax error

A
  • An error which occurs when programmers violate the rules of writing the statements of the programming
    language.
  • It is caught by the compiler.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Semantic error

A
  • Caught by the compiler during the time of compilation
  • Occurs when:
    ◦ Using the ++ or – operator with a Boolean
    variable

◦ Declaring a variable twice using the same data type
or different data type.

◦ Type incompatibility

◦ Using a non-initialized variable in the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Logical error

A

Occurs due to mistakes in programming logic

The programmer has to trace this type of
error.

When the program does not give the
expected output, then it is said to have a
logical error.

Can be the hardest errors to find. You need
to spend time going through your code
looking for a precise reason for the error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Runtime error or exception

A
  • This occurs during the execution of the
    program and it causes the program to end
    abruptly.
  • The programmer has to anticipate these types
    of errors while writing the program.
  • Occurs when
    ◦ a numeric literal or variable is divided by zero
    ◦ when the user inputs a string or a character, where
    a number is expected.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly