Computing Paper 2

Cards (48)

  • How can algorithms be represented?
    Via pseudocode or flowcharts
  • What is abstraction and decomposition?
    Abstraction removes unnecessary detail from a problem.
    Decomposition breaks a problem into sub-problems that each represent a specific task
  • What does this symbol represent in a flowchart?
    Start/End
  • What does this symbol represent in a flowchart?
    Process
  • What does this symbol represent in a flowchart?
    Choice
  • What does this symbol represent in a flowchart?
    Input/Output
  • What does this symbol represent in a flowchart?
    Subprogram
  • What does this symbol represent in a flowchart?
    Direction of flow
  • What are tracetables?
    A table that shows how value changes when an algorithm is carried out. They go through each line of code and only add to a column when that column's value changes. Gaps are fine.
  • How does a linear search work?
    Compares each item one by one until target is found.
    Pros: No need for list to be in order
    Cons: Can be slow as each item may need to be checked
  • How does a binary search work?

    • Compares middle item to its target
    • Discards the half of the list which the target cannot be in
    • Finds next middle item and repeats until target is found
    Pros: Halves search space, making it more time efficient than linear search
    Cons: Array must be sorted first
  • How does a bubble sort work?
    • Look at first two items in list, if they're in right order you don't have to do anything. If they're in the wrong order, swap them
    • Move onto next pair of items until you get to end of list - this is called one pass
    • Repeat steps until no more swaps in a pass
    Pros: Simple algorithm and does not use much memory
    Cons: Inefficient way to sort a list and does not cope well with a large list of items
  • How does a merge sort work?
    • Divides list into two parts continuously until each item has 1 item
    • Then combines the two lists at a time, keeping items in order
    Pros: More efficient and quicker than bubble sort for large lists and has a consistent running time
    Cons: Slow for small lists and uses more memory
  • How does a insertion sort work?
    • Starts with one item in the "sorted" part and moves items one by one from the "unsorted" part to the "sorted" part
    Pros: Copes very well with small lists and is very quick to add and check items in an ordered list
    Cons: Does not cope well with large lists
  • What data types are there?

    Integer - A whole number
    Real/Float - A number with a fractional part
    Boolean - True or false
    Character - A letter, number or symbol
    String - A group of characters
  • What arithmetic operators are there?
    Multiplication - *
    Exponentiation - ^
    Division - /
    Quotient - DIV (cuts of decimal)
    Modulus - MOD (shows remainder only)
  • What comparison operators are there?
    Equal to: ==
    Not equal to: !=
    Greater than: >
    Less than: <
    Greater than or equal to: >=
    Less than or equal to: <=
  • What boolean operators are there?
    NOT - opposite
    AND - both sides needed
    OR - Only one side needed
  • What is a variable and a constant?
    Variable - identifiers that hold a value that can be changed (variable = "value1")
    Constant - identifiers that hold a value that cannot be changed (const PI = 3.142)
  • What is selection?
    Where IF statements are always checked
    • ELSE IFs or ELIFs are only checked if previous conditions were false
    • ELSEs have no conditions and only run if all previous conditions were false
    • SWITCH statements are useful where a variable determines the selection
  • What is iteration?
    Count-controlled loops
    • FOR loops repeat a set number of times
    For example:
    For i in range(5)
  • What are condition-controlled loops?
    Where loops are repeated until a condition is broken.
    • WHILE loops repeat until a condition is broken
    • DO UNTIL loops repeat until a condition is met
  • What is a data structure?
    Organised collections of items.
    An array is an example
  • What is an array?
    A data structure that contains items of the same data type and is of a fixed length
    • Assume the index starts at 0 unless told otherwise
  • What is SQL?
    Structured Query Language, used to search and retrieve data
    SELECT Field(s)
    FROM Table
    WHERE Condition
  • What are 2D arrays?
    Data structure that represents fields and records
  • How do we read & write a file?
    • Before reading or writing to an external file we need to open it.
    textFile = open ("client_data.txt")
    textFile.writeLine ("AJ, 24, London")
    while NOT textFile.endOfline()
    print(myFile.readLine() )
    endwhile

    textFile.close()
    • and when your done, you need to close it
  • What are sub programs?
    Named out line of blocks of code that you must call to execute them.
  • How can we make a code more maintable?
    • Built from many sub programs
    • Consistent in indentation
    • Consistent in naming conventions
    • Uses comments to explain code (#)
  • What is the point of robust programs?
    It makes it so your program won't crash, won't have errors and will be reliable.
  • What is the point of defensive design aims?
    To make programs robust because users can't be trusted so anticipate misuse.
  • What are the two types of testing?
    Iterative:
    Testing of modules throughout development. Any issues found will be fixed and the module should be retested
    Terminal:
    Testing of the whole program at the end of development
  • What are the two types of errors?
    Syntax - not following rules of the language so code won't run
    Logic error - code runs but not as you intended
  • What is validation?
    Enforcing a rule around user input
  • What is authentication?
    Checking the identity of a user through password checks etc
  • How can we test data for robustness?
    Normal - typical user inputs
    Boundary - on the edge of being allowed
    Invalid/Erroneous - completely wrong
  • What is this logic gate?
    NOT
    • Reverse logic state e.g. if input is true, output will be false
  • What is this logic gate?
    AND
    • If both inputs are true, then the output is true
  • What logic gate is this?
    OR gate
    • If both inputs are false, output is false otherwise outputs are true
  • What are truth tables?
    Logical tables showing all possible inputs of and associated outputs for each input