paper 1 & 2

Cards (149)

  • What is abstraction in computer science?
    • A representation of reality
    • Recognizes important aspects of a problem
    • Codes and formulates it for algorithms
    • Used extensively with variables, objects, and data structures
  • How does abstraction help in problem-solving?
    It allows us to separate component parts and focus on important issues
  • What are subroutines and libraries examples of?
    Abstraction
  • What does thinking ahead involve in programming?
    Planning inputs and outputs
  • What is caching in programming?
    Storing data temporarily for future use
  • Where can cached data be stored?
    In cache or in RAM
  • What are reusable components in programming?
    Code that can be used in multiple places
  • What is recursion in programming?
    • A procedure or function that calls itself
    • An alternative to iteration
    • Can cause stack overflow if no terminating condition is present
  • What happens if a terminating condition is not built into a recursive function?
    It will cause a stack overflow error
  • What are the differences between local and global variables?
    • Global variables: accessible throughout the program, declared outside functions
    • Local variables: accessible only within the function, declared inside it
    • Global variables can lead to errors if overlooked
  • Why do programmers prefer local variables over global variables?
    Local variables reduce the risk of unintended changes
  • What is modularity in programming?
    • Writing programs in separate subsections
    • Makes creation and testing easier
    • Sub-programs can be called functions, procedures, etc.
  • What is the difference between functions and procedures?
    Functions return a value, while procedures perform operations without returning a value
  • What are parameters in subprograms?
    Variables added in brackets after the subprogram name
  • What is the default method of passing parameters in many programming languages?
    By value
  • What happens when a parameter is passed by value?
    A copy is made for the subprogram, and changes do not affect the original
  • What does passing a parameter by reference mean?
    The address of the variable is passed, allowing changes to affect the original
  • What are common features of an Integrated Development Environment (IDE)?
    • Code editor optimized for languages
    • Error diagnostics and debugging tools
    • Build feature for compiling and linking
    • Version control and runtime environment
    • Translator such as a compiler or interpreter
  • What is Object-Oriented Programming (OOP)?
    • A programming paradigm based on objects
    • Involves classes and methods
    • Encourages code reuse and modularity
  • How do you create a class in pseudo code?
    By using the keyword 'class' followed by the class name
  • What is the purpose of a constructor in a class?
    To initialize attributes of the class
  • How do you instantiate a new object from a class?
    By using the class name followed by 'new' and any parameters
  • What is the difference between public and private methods in a class?
    Public methods can be called from outside the class, while private methods cannot
  • How do you call a method from another class in pseudo code?
    By using the object name followed by the method name
  • Why is a specific line of code important in exams?
    It can be worth four marks.
  • What is necessary to instantiate a new object?
    Knowing how to write the correct line of code.
  • What type of methods can be created for a class?
    Procedures or functions.
  • When are methods typically public in a class?
    Unless specified otherwise.
  • What happens if a method is private in a class?
    It can only be called from inside that class.
  • What is the syntax to call a method from another class?
    Use the object name followed by the method name.
  • How do you call the method 'set_name' for an object 'my_pet'?
    my_pet.set_name('spike').
  • What does inheritance allow in object-oriented programming?
    It allows a class to inherit methods and attributes from a parent class.
  • What keyword is used to indicate inheritance in a class?
    Inherits.
  • What is the purpose of the 'super' keyword in a constructor?
    It calls the original constructor of the parent class.
  • What is polymorphism in object-oriented programming?
    It allows the same code to process different objects according to their type.
  • How can you utilize polymorphism with an array of pet objects?
    By calling the same method on different pet objects in the array.
  • What is backtracking in problem-solving?
    It involves trying a sequence of actions until a solution is found or deemed impossible.
  • What does data mining examine?
    Large sets of data looking for patterns and relationships.
  • What is performance modeling used for?
    To predict how real-life objects and systems behave when in use.
  • What notation is used to show how algorithms behave with increasing input size?
    Big O notation.