programming concepts

Cards (19)

  • Programming construct
    A building block of code, they are sequence, selection and iteration
  • Sequence
    A programming construct where instructions follow, one after the other
  • Selection
    A programming construct where the code makes a decision, and takes one of several branches, usually coded with IF-THEN-ELSE
  • Iteration
    A code construct where the instructions repeat. Can be definite/count-controlled or indefinite/condition-controlled.
  • Nesting
    Coding a second programming construct inside the first. You can do this with selection and iteration
  • Definite
    The type of iteration that repeats instructions a set number of times, also called "count-controlled". Uses a FOR loop in most high-level languages
  • Indefinite
    The type of iteration that repeats instructions a until a condition is met, also called "condition-controlled". Uses WHILE or REPEAT... UNTIL in high-level languages
  • WHILE
    This statement starts a condition-controlled loop with the condition at the start, so the loop will only begin if the condition is true
  • REPEAT
    A statement that starts a condition-controlled loop with the condition at the end in an UNTIL statement, it will run once even if the condition is false
  • Subroutine
    A small set of instructions that completes a specific task, sometimes called a subprogram. It can be a function or procedure
  • Procedure
    A subroutine which does not return a value. For example it might redraw the screen or write a record to a file
  • Function
    A subroutine which returns a value. It might return a random dice roll, calculate a ticket price or determine your exam grade
  • Variable
    A named memory location holding a single value that can change during the program, e.g. name, age, x, y
  • Constant
    It cannot change. A named memory location for something that stays the same. Examples are PI, Number_of_Levels, MAXHEALTH
  • Identifier
    The name we give to variables, constants and subroutines, it should be meaningful
  • Meaningful
    All identifiers should be this, it means they are readable and reflect the values they represent. MAXLIVES, player1_score and get_health are all OK, but m, p1 and h are not
  • Input
    Any data that is received into a program while it is running, we can use USERINPUT for this in AQA pseudo-code
  • Output
    Information that is produced by a program and made available for us to see or hear, we use OUTPUT in AQA pseudo-code
  • Assignment
    A statement that assigns a value to a variable. The right side of the equals sign can be any expression. These are valid:health100fare ← 5 + 0.5 * milesdiscounttime < 8 AND band=="Senior"