Computer science

Cards (100)

  • Compiler
    Translates the whole program into machine code at once before the program is run.

    1. Code executes quickly (as already translated).
    2. Slower to find errors (as all code must be translated).
  • Interpreter
    Translates source code into machine code, line by line when the program is run.

    1. Code can run on different platforms/devices (as it's translated on the platform running the program).
    2. Source code needs to be provided (so competitors could steal your source code ideas).
  • Assembler
    Translates assembly language source code to machine code.

    1. Code can run very quickly and use less memory (as programmer chooses the machine code instructions).
    2. Uses easier to understand assembly language instead of machine code binary values (so programs can be developed more quickly and with fewer errors).
  • Translator
    A program that translates high-level or assembly language source code into runnable machine code.
  • Source code
    The high-level or assembly language program instructions the programmers type into the development environment text editor..
  • Machine code
    The low-level set of instructions built into a CPU, e.g. add, compare, branch or move. Each instruction is represented by a unique binary code, e.g. 0100101.
  • Assembly language
    A low-level programming language that uses short easier to understand mnemonics, like ADD, SUB or MOV, to represent machine code instructions. Each mnemonic translates directly to a machine code instruction.
  • Mnemonics
    Short combinations of letters used in assembly language to help programmer understand what machine code instruction do, e.g. MOV for move or CMP for compare.
  • Low level languages
    Are programming languages that use binary values (machine code) or short easier to understand mnemonics (assembly language) in programs.

    Low-level programs can:
    1. run more quickly,
    2. use less memory,
    3. control hardware more easily.
  • High level languages
    Are programming languages which use more English-like statements that are generally easier for humans to understand.
  • Integer data type (int)
    Any whole number, e.g. 10.
  • Real data type (float)

    Any number with a decimal point or fraction, e.g. 3.14
  • Boolean data type (bool)
    Any true or false value, e.g. day == "Tuesday" will be True if the day contains Tuesday or False if it does not. You can also set a variable directly to True or False.
  • Character data type (str)

    Any letter, number or symbol, e.g. "H".
  • String data type (str)

    A sequence of characters, e.g. "Hello".
  • Variable
    A named reference to memory location containing a value that can be used repeatedly throughout a program. Variable names should be meaningful, i.e. describe the values they contain.
  • Constant
    A named reference to a memory location containing a value that can be used repeatedly throughout a program but cannot be changed.

    Constants make a program:
    1. easier to understand (as descriptive names are used instead of just values, e.g. PI instead of 3.14),
    2. easier to update (as the constant only need to be edited in one place, where it is defined).
  • Arithmetic Operators
    Perform mathematical calculations such as:

    1. addition, e.g. 3 + 2
    2. subtraction, e.g. 3 - 2
    3. multiplication, e.g. 3 * 2
    4. float division, e.g. 3 / 2
    5. integer division, e.g. 3 // 2 (returns an integer)
    6. exponentiation, e.g. 3 ** 2 (raise 1st number to power of 2nd)
    7. modulus, e.g. 3 % 2 (remainder after dividing 1st number by 2nd)

    Results are usually assigned to variables, e.g. result = 3 + 2.
  • Relational Operators
    Used to compare two values and return true or false depending on the result. Operators can check if:

    1. left and right values are equal, e.g. value == 3
    2. left value is less than right, e.g. value < 3
    3. left value is greater than right, e.g. value > 3
    3. left value is less than or equal to right, e.g. value <= 3
    4. left value is greater than or equal to right, e.g. value >= 3

    Usually used in selection or condition controlled loop statements, e.g. if value == 3, or while value == 3.
  • Logical Operators
    Used to combine two or more conditions that are made using relational operators to create a more complex condition, e.g. day == "Sat" or day == "Sun" will be true if day equals Sat or Sun. The logical operators are:

    1. and (true if all the joined conditions are true)
    2. or (true if any of the joined conditions are true)
    3. not (true if the condition that follows is not true)
  • Input
    Data that is entered into a computer system and assigned to a variable and processed in a program. Use the input/output symbol in a flowchart. Use the input command in Python.
  • Output
    Data that is outputted by a program in a computer system. Use the input/output symbol in a flowchart. Use the print command in Python.
  • Presence check - input validation
    A type of validation check that checks to see that the user has entered something when asked to do so by the program.
  • Length check - input validation
    A type of validation check that checks to see that the user has entered the right number of characters when asked to do so by the program.
  • Range check - input validation
    A type of validation check that checks to see that the user has entered a value within the correct range of values when asked to do so by the program.
  • Lookup check - input validation
    A type of validation check that checks to see that the user has entered a value from an acceptable list of values when asked to do so by the program.
  • von Neuman stored program concept
    A modern computer architecture in which program instructions are stored in main memory and fetched decoded & executed one at a time by the CPU.
  • Bus
    The copper tracks (wires) on the motherboard on which addresses, instructions and data, control signals and electrical power move from component to component.
  • Address bus
    The bus that transmits the memory location of instructions or data from the CPU to main memory.
  • Data bus
    The bus that transmits fetched instructions from memory or data to and from the memory.
  • Control bus
    The bus that transmits memory read and write and other CPU control signals.
  • Main memory
    1. Can be directly accessed by CPU using address & data bus.
    2. Contains the start-up (bootloader) program that loads and runs the operating system and any application programs the computer is running and data to go with those programs.
    3. Consists of RAM or ROM and is temporary if RAM.
  • RAM
    1. Short for random access memory.
    2. Holds the instructions and data for programs running on or waiting to be run by the CPU.
    3. Is volatile (loses its contents when power is removed).
  • ROM
    1. Short for read only memory.
    2. Holds the instructions and data for the bootloader program needed to load and run the operating system, or the entire program if the computer is an embedded system.
    3. Is non-volatile (keeps its contents when power is removed).
  • Secondary storage
    1. Permanent (non volatile) storage.
    2. Cannot be directly accessed (needs a controller chip).
    3. Storage can be magnetic, optical or solid-state.
  • Magnetic Storage

    E.g. Hard disk, floppy disk or tape.

    1. Data stored by changing the polarity of magnetisable particles on the surface of a spinning disk or moving tape.2. Contains a read write head that changes the polarity of particles when writing and detects polarities when reading.3. In hard and floppy disk drive, the head is at the end of an arm that moves is over the surface of the disk as it spins.4. Data is stored on the surface in tracks and sectors.
    Pros:proven technology and lowest cost per MB.Cons:moving parts can wear out or be damaged by mechanical shock.
  • Optical storage

    E.g. CD, DVD, Blu-ray disks.

    1. Data stored by changing the surface of a disk so it reflects more or less light from a laser shone on it.2. Uses pits and lands (high and low bits) on read only discs (the silver physical discs supplied when purchasing software).3. Uses photo sensitive ink on writable discs (the blue discs used to backup or archive data).4. Contains a head that measures the amount of laser light reflected from the surface of a spinning disc when reading data. In drives that can write data, the head also contain a laser that changes the reflectiveness of the photo sensitive ink.5. Head moves over the surface of the disc as it spins.
    Pros:cheapest storage method and somewhat portable.Cons:slowest storage method and discs can be easily damaged.
  • Solid state storage

    E.g. Solid state drives (SSD), memory cards or USB memory sticks.

    1. Data stored as electrical charge in memory chips.2. Completely electronic with no moving parts.
    Pros:no moving parts, so fast, quiet and robust.Cons:more expensive in large (Terabyte) capacities.
  • CPU
    Short for central processing unit.

    The integrated circuit (hardware) that controls the fetching, decoding and executing of program instructions to process data in the computer system. The "brain" of the computer.

    Contains the control unit, ALU, and registers that include the instruction register and program counter.
  • ALU (Arithmetic Logic Unit)

    The part of the CPU that performs all the arithmetic (addition, subtraction, etc.) and logical (relational, and, or, not, etc.) operations.