2.1.2

Cards (9)

  • Input/output
  • Process
  • Decision
  • Sub-program
  • Terminal
  • Syntax error:
    • Getting the "grammar" or rules of the programming language wrong
    • Program will not run
  • Logic error:
    • Produces incorrect / unexpected result / output
    • Program will runs - harder to spot
    • Types of logic error include:
    • Misplaced brackets in calculations
    • Iterations that loop incorrectly
    • Variables in wrong locations
  • Identify one logic error in the program and correct it
    Line 2
    • for scoreCount = 0 to scores.length - 1
    OR
    Line 3
    • total += scores[scoreCount]
  • Trace tables:
    Read the following pseudocode algorithm:
    01 start = 3
    02 do
    03 print(start)
    04 start = start - 1
    05 until start == -1
    06 print("Finished")
    Create a trace table for the algorithm
    A) 01
    B) 3
    C) 03
    D) 3
    E) 04
    F) 2
    G) 03
    H) 2
    I) 04
    J) 1
    K) 03
    L) 1
    M) 04
    N) 0
    O) 03
    P) 0
    Q) 04
    R) -1
    S) 06
    T) Finished