GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

2. Structure of procedural programs

deepi1k73 Computing A levels Englisch

2. Structure of procedural programs

Inhalt der Mindmap

2. Structure of procedural programs

  1. define terms

    • statement- a single instruction- arithmetic or logical
    • subroutine- a block of code separate from the main program but can be called by the main program
    • procedure- a subroutine that executes the lines in there are then gives back control to the main, does not necessarily return a value
    • function- a type of subroutine that returns a value after a caluclation
    • parameter- data that is passed to a subroutine (and used by it) from the main program
    • sequence-when instructions are followed one after the other
    • selection- when the computer makes a decision as to which instruction to do, can be IF statement or a SWITCH CASE
    • iteration- instructions repeated over and over again- loop, can be FOR, WHILE, DO-WHILE
    • control structure- a block of code that tells wich order to do the instructions (loop or selection)
  2. 3 basic constructs

    • sequence
      • commands go one after the other
      • follow each other in exectution
    • iteration
      • loops
      • statements executed repeatedly
      • 3 types
        • FOR
          • Count-controlled loop
        • WHILE
          • Condition-controlled loop
          • only happens when condition is fullfilled
        • WHILE UNTIL
          • Condition-controlled loop
          • runs once then checks condition
    • selection
      • decision
      • program can choose which statement to execute depending on user entry
      • Two types
        • IF- uses a condition or expression that gives a value
        • SWITCH CASE- uses variable to decide the answer
  3. nested and iteration statements

    • When one statement is put inside the other
    • indent one statement inside the other
    • can nest both loop and if statements
  4. subroutines

    • a small piece of code that is separate from the main program but is called from the main program, can be two types:
      • Procedure- does the instructions then gives control back to the main program
      • Function- same as procedure but returns an answer
    • advantages
      • Can call the subroutine makes time- does not make the program any longer
      • program easier to understand and maintain- less clutter
      • Easy to test- only need to test the subroutine
      • Can reuse the subroutine over and over again
      • if there is an error only need to change in one place
    • parameters- data passed from the main program and then used by the subroutine
    • scope- how long a variable can be used for
    • variables: Local- can only be used in the subroutine, Global- can be used anywhere in the whole program
  5. recursive vs. iterations

    • a subroutine that calls itself
    • needs a stopping condition to stop it or will carry on forever...
    • To solve:
    • difference between iteration and recursion
      • iteration:
        • loop repeats instructions
        • includes a tracking variable so ends
        • uses less memory as there is only 1 function so 1 set of variable
        • More complex
        • count variable needs to be initialised before the loop starts
      • recursion:
        • uses a loop too
        • uses less code
        • runs slowly
        • may run out of memory so the computer could crash
        • hard to trace
        • Need a stopping condition or never stops

Bilder und Dateien der Mindmap

  • 2. Structure of procedural programs
  • 2. Structure of procedural programs
  • 2. Structure of procedural programs
  • 2. Structure of procedural programs
  • 2. Structure of procedural programs
  • 2. Structure of procedural programs
  • 2. Structure of procedural programs

Informationen

Beschreibung
A levels Computing Mindmap am 2. Structure of procedural programs, erstellt von deepi1k73 am 23/03/2014.
Erstellt von
deepi1k73
Aufrufe
14
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck