Paper 2 vid

Cards (105)

  • Elements of computational thinking
    A unit that some people skip over when revising, but there will be a few questions from here and there are some good marks to get
  • Thinking abstractly (abstraction)

    Removing unnecessary details and including only the relevant details, identifying what does and doesn't matter to solve the problem
  • Examples of thinking abstractly
    • Symbols on a map showing buildings, roads, etc.
    • Charting where an oyster card is checked in and out of the London Underground
    • Moving nodes on a graph data structure to change the visualization
  • Abstraction in computer science
    Used extensively, e.g. variables, objects, data structures. Helps maximize chances of solving a problem by separating out component parts and deciding which are worth investigating. Makes a problem easier to understand, a system quicker and easier to use, or a problem easier to solve or program. Allows concentrating on one thing at a time in a complex system.
  • Examples of abstraction
    • Subroutines
    • Libraries
  • Thinking ahead
    Planning inputs and outputs, and reusable components
  • Examples of thinking ahead
    • Working out how much paint you need before starting to decorate
    • Getting all the tools ready for a DIY job in advance
    • Getting everything packed in your bag before going to school in the morning
  • Caching
    Storing data or instructions that have been used, temporarily in case they are needed again, to allow for faster use in the future than fetching from slower storage media
  • Caching does not equal cache memory, it is a similar word but being used in a different context
  • Reusable components
    One piece of code that can be used in multiple places and called multiple times, e.g. subprograms, classes, external libraries
  • Thinking procedurally
    Breaking a problem down into smaller sub-problems and determining the order of events
  • Example of thinking procedurally
    • Generating a subject grade requires putting marks into a system before applying a grade boundary before printing results
  • Thinking logically
    Identifying the decision points for branching or iteration, e.g. using flowcharts to design an algorithm
  • Thinking concurrently
    Identifying if parts of the problem can be tackled at the same time
  • Example of thinking concurrently

    • Baking a cake - preparing the icing while the cake sponge bakes in the oven
  • Concurrency speeds up the solution, however it may be difficult to program and not all problems suit concurrency
  • Sequence
    A set of program instructions or statements written one after another, executed one statement at a time in the order written
  • Example of sequence
    • Doing a calculation or accepting some input from the user
  • Branching (selection)

    A program construction that allows a program to run a sequence of code depending on whether a condition evaluates to true or false
  • Examples of branching
    • IF-ELSE
    • SWITCH-CASE
  • Iteration
    When a section of code is repeated using a loop, with the programmer specifying a group of statements to be repeated
  • Count-controlled (definite) iteration
    Classic FOR loop, we know exactly how many times we want to loop before we get started
  • Condition-controlled (indefinite) iteration

    Typically a WHILE loop, we loop until a condition is met
  • Post-check condition-controlled iteration
    DO-UNTIL loop, executes the statements first and then checks the condition
  • Recursion
    When a function calls itself, another way of producing iteration. Must have a stopping/exit condition or base case.
  • Recursive algorithms are slower and use additional system resources compared to iterative ones, but can be shorter and simpler to read and understand
  • Global variables
    Can be accessed throughout a program, declared or set outside of any subprogram
  • Local variables
    Set or declared inside a function or other subprogram, can only be accessed from within that subprogram
  • Modularity
    Programs written in a procedural manner, separated into subsections (subroutines, functions, procedures) to make them easier to create and test
  • Functions
    Generally return a value
  • Procedures
    Do some operation but do not return a value
  • Parameters
    Variables added in brackets after a subprogram name, corresponding arguments passed in the subprogram call
  • Pass by value
    Default, a copy of the variable is made for the subprogram, changing the value in the subprogram does not change the original
  • Pass by reference
    The address of the variable is passed to the subprogram, changes made in the subprogram affect the original variable
  • IDE (Integrated Development Environment)

    Comprehensive set of tools to develop programs, including a code editor, error diagnostics, build feature, runtime environment, and translation software
  • Object-Oriented Programming (OOP)

    Defines separate objects that have their own associated values (attributes) and subroutines (methods), allowing different parts of the program to be separated and easier to understand and work on
  • Encapsulation
    One of the core concepts of OOP, allows different parts of the program to be separated to make them easier to understand and work on
  • Inheritance
    One of the core concepts of OOP, allows different objects with slight differences to still share the same core code
  • Polymorphism
    One of the core concepts of OOP, allows subroutines to be flexible depending on what object is using the subroutine and what data is passed to it
  • Class
    A template or cookie cutter used to produce objects in OOP