ProgrammingSequence, selection, iteration, procedures, functions, modules, parameters, compilers, interpreters

Syllabus Detail

  • Errors: syntax, run-time, logical, 11 ATAR, 12 GEN, 12 ATAR

Background

  • Errors and mistakes often occur in programming
  • When staring at a computer screen for hours on end, errors and mishaps are more than likely to appear throughout a development process
  • Programming faults exist as syntax, run-time and logical errors

 

Syntax Errors

  • Syntax errors (or semantic errors) can be seen as the spelling errors of programming
  • They occur when the compiler or interpreter is unable to make sense of a word or character
  • Syntax errors can occur commonly as small mistakes; such as missing semi-colons to end a line, are often hard to pick up without running the program
  • Generally they are easy to fix. Just find the typo and fix it.
  • Example:
    • System.otu.println("Hello, world!");
    • In the above example, the word "out" is misspelled
    • This would result in an error as the compiler or interpreter would not be able to make sense of the line 

Run-Time Errors

  • Run-time errors are errors that happen at run-time. ie when the program is running.
  • The program was made correctly, it compiled correctly, but it can't follow the instructions
  • Example 1; a user enters the number 0 which is unexpected. eg while x >1 AND <100 ...will cause a run-time error
  • Example 2; print(Name). This will crash at run-time if the variable Name is not defined...will cause a run-time error
  • Good programmers will write programs that have expected error handling. But sometimes they just happen when we are developing programs.
  • Examples HERE

 

Logical Errors (modified 15 Sep 2017)

  • Logical errors (or logic errors) occur when a program produces incorrect or unexpected results due to poor logical processing
  • Unlike a syntax error or runtime error, the program does not end abruptly or abort
  • These are caused by programmers' mistakes within the source code
  • Common examples include using incorrect operators
  • Examples HERE at the University of Waterloo
  • Example HERE at wikipedia

 

Further Research

  • Visual Basic Error Types by Microsoft here
  • Types of Error by California State University here

 

Worksheet and Practice (yet to be added)

Found an error or have an enhancement? Please let us know via this contact form