Programming

Cards (56)

  • Data type
    A data type is defined by:
    • the values it can take
    • the operations which can be performed on it
    It is sometimes possible to store one piece of data using different data types.
  • Integer
    A whole number, positive or negative, including zero
  • Real/float

    A positive or negative number which can have a fractional part.
  • Boolean
    A value which is either true or false
  • Character
    A single number, letter or symbol
  • String
    A collection of characters
  • Date/time
    A way of storing a point in time, many different formats are used
  • Pointer/reference
    A way of storing memory addresses
  • Records
    A collection of fields, each of which could have a different data type
  • Arrays
    A finite, indexed set of related elements each of which has the same data type
  • User-defined data types
    • Derived from existing data types
    • Ensures that a solution is as memory efficient as possible
  • Variable declaration
    Creating a variable for the first time, giving it a name and sometimes a data type
  • Constant declaration
    Creating a constant for the first time, giving it a name and sometimes a data type
  • Assignment
    Giving a constant or variable a value
  • Iteration
    Repeating an instruction
  • Selection
    Comparing values and choosing an action based on those values
  • Subroutine
    A named block of code containing a set of instructions designed to perform a frequently used operation.
  • Definite iteration

    The number of repetitions required is known before the loop starts
  • Indefinite iteration
    The number of repetitions required is not known before the loop starts
  • Nested structures
    Selection structures and iteration structures can be nested:
    • One structure is placed within another
    • This can easily be identified by different levels of indentation in code
    • Indentation makes the code easier for humans to understand
  • Meaningful identifier names
    Constants, variables and subroutines should be given sensible and meaningful identifier names
    • This makes it easier for others to understand what the purpose of the named object is
  • Addition
    Adding together two numbers
  • Subtraction
    Taking one number away from another
  • Multiplication
    Multiplying two numbers together
  • Real/float division

    Dividing one number by another
  • Integer division
    The same as real/float division, but just the whole number part is given
  • Modulo
    Returns the remainder of an integer division
  • Exponentiation
    Raising one value to the power of another
  • Rounding
    Limiting the degree of accuracy of a number
  • Truncation
    Removing the decimal part of a number, never rounding up
  • Equal to
    e.g., 12 = 12
  • Not equal to
    e.g., 16 <> 413, 16 != 413
  • Less than
    e.g., 75 < 422
  • Greater than
    e.g., 19 > 18
  • Less than or equal to
    e.g., 6 <= 22, 95 <= 95
  • Greater than or equal to
    e.g., 20 >= 126, 44 >= 44
  • Boolean operations: NOT
    The opposite of a Boolean value e.g., NOT 1 = 0
  • Boolean operations: AND
    The product of two Boolean values e.g., 1 AND 1 = 1, 0 AND 1 = 0
  • Boolean operations: OR
    The sum of two Boolean values e.g., 1 OR 0 = 1, 1 OR 1 = 1, 0 OR 0 = 0
  • Boolean operations: XOR
    True if strictly one of two values is true e.g., 1 XOR 1 = 0, 1 XOR 0 = 1