Computer science

Subdecks (1)

Cards (46)

  • Variable
    • Space in memory large enough to hold a single piece of data
    • Each variable has a name and data type – name chosen by programmer
    • Should not be reserved keywords, begin with letter, no spaces, differs from programming language
  • Data type

    Kind of data that can be stored in the variable – yes/no, true false, letters, numbersautomatically decided in python and java script
  • Constants
    Similar to variable – difference is that once it has been given a value it can not be changed – value cant change
  • Assignment
    Storing a value, placing a value into the variable or constant
  • Variable more commonly used – constants better because it cant be accidentally changed – VAT, pi would be constants since their value doesn't change
  • Sequence
    When an instruction is executed once, never any variation – used when programmer wants the same results each time – basic operations performed on a calculator
  • Selection
    Execution can follow two or more paths – e.g. adult, child, time of day, size of group – spotted by keywords – if, else, select, case, selection box
  • Iteration
    Block of code can run more then once, rather then pasting multiple times – code is placed in loop, loops programmed repeatedly, less prone to mistakes – told to loop a fixed number of times, loops until particular task is done – search for item until it is found or until it is tired – keywords: for, while, loop, until
  • Arithmetic operation

    Both the input and outputs are numbers
  • Logical operation
    The output is either true or false
  • You need to be able to predict outcome
  • Arithmetic operations

    • + - add
    • - subtract
    • * multiplication
    • / divide
    • () exponents : 2^3
  • Variables can be assigned as the result of an arithmetic operation
  • Div
    Integer division – disregards remainder
  • MOD
    Retains only the remainder
  • Logical expressions
    • = equal to
    • < less than
    • > greater than
    • <= less than or equal to
    • >= greater than or equal to
    • != and not equal to
  • AND
    Must both be true in order for the whole connected expression to be true
  • OR
    If the first, second or both expressions are the whole combined expression is true
  • NOT
    Simply makes that expression the opposite of what it was before
  • Algorithm
    Set of instructions that a computer follows in order to complete a task or solve a problem
  • Common features of algorithms

    • Variable
    • Conditionals
    • Repetition
    • Data structure
    • Subprograms
  • Integer
    Store whole number – positive, negative, 0
  • Real data type

    Stores numbers that can be fractions
  • Boolean data types

    Only true of false, can contain no other values, useful for determining whether a loop should execute one more time if a password was correctly entered
  • Character data type

    Can contain a single character – letter, one digit number, symbol – good for abbreviations
  • String data type
    Can store sequence of individual characters – stores names and description, combinations of letters and numbers (postcodes), barcodes, no mathematical executions on the data
  • Casting
    Take data from a variable, change data type and place it into a different variable
  • String
    Sequence of characters – names, addresses, post codes, etc
  • String operation

    Any process on string – calculating the string length, breaking string into pieces
  • Length
    Used to find how many characters are in a string
  • Index within a string

    Tell you the position of each character
  • Substring
    Part of a larger string
  • Array
    Can only store data of a single data type
  • Records
    Can store multiple pieces of data belonging to different data types
  • Field
    Each item in a record
  • Database
    Structured means of storing data within a computer system
  • Main advantage of a database – can look at the data in a range of different ways
  • Table
    In a database, fields across the top, records down the rows
  • Primary key
    Special field that uniquely identifies each record
  • Open
    File must be opened before data can be read from or written to