2.1 algorithm

Cards (62)

  • What is the definition of an algorithm?
    An algorithm is a set of instructions presented in a logical sequence.
  • What are the three key components of computational thinking?
    Abstraction, Decomposition, Algorithmic thinking
  • Why do programmers create algorithm designs?
    To plan a program before writing any code and consider potential problems.
  • What does abstraction involve in computational thinking?
    Ignoring unnecessary information and focusing on important facts
  • What are the two main methods of defining algorithms?
    Pseudocode and flowcharts.
  • Why is abstraction important in problem-solving?
    It simplifies a problem to make it less complex
  • In what language will OCR display algorithms in exams?
    OCR Exam Reference Language.
  • What is decomposition in computational thinking?
    Breaking a problem down into smaller tasks
  • Why is decomposition important in problem-solving?
    It makes it easier to solve problems and allows for separate testing
  • What is the purpose of the 'constant' keyword in programming?
    To define a constant value that cannot be changed.
  • What is the exam board and specification for the study material?
    OCR Specification: J277
  • How do you write a comment in OCR Exam Reference Language?
    Using two slashes (//).
  • What is algorithmic thinking?
    Following logical steps to solve a problem
  • What does algorithmic thinking involve?
    Breaking down the problem using decomposition and considering required data
  • What command would you use to get user input in OCR Exam Reference Language?
    name = input("Enter your name")
  • What are the key features of a bubble sort?
    • Uses an outer while loop (condition controlled) to check for swaps
    • Uses an inner for loop (count controlled) to iterate through the data set
    • Uses a flag (Boolean value) to track swaps
    • Uses a temporary value to swap elements
  • What are the steps involved in computational thinking?
    • Abstraction: Focus on important facts
    • Decomposition: Break down into smaller tasks
    • Algorithmic thinking: Follow logical steps to solve the problem
  • What does the 'print' command do in programming?
    It outputs text to the console.
  • What is a linear search?
    A linear search is the simplest search algorithm that checks each data item in order.
  • What is the purpose of the 'if - then - else' selection structure?
    To execute different code based on a condition.
  • Why is a linear search also known as a sequential search?
    Because it searches through the list in a sequence from start to end.
  • What exam board and specification is mentioned for computational thinking?
    OCR Specification: J277
  • What is the source of the written, video, and visual content mentioned in the study material?
    CSNewbs
  • What does the 'for loop' structure do?
    It repeats a block of code a specified number of times.
  • What is a limitation of a linear search for large lists?
    It is not very efficient for large lists.
  • What is the purpose of a flowchart?
    To visually represent an algorithm.
  • What is a binary search?
    A binary search is a more efficient searching algorithm that searches through fewer data.
  • What year is the copyright for CSNewbs noted as?
    2024
  • How does a flowchart differ from a structure diagram?
    A flowchart shows how data is processed, while a structure diagram shows the organization of a problem.
  • What is the purpose of computational thinking?
    To provide smart problem-solving techniques
  • What is the prerequisite for using a binary search?
    The list of data must already be sorted.
  • What is a trace table used for?
    To track the value of variables as a program runs.
  • How do abstraction and decomposition work together in computational thinking?
    Abstraction simplifies the problem while decomposition breaks it down into manageable parts
  • How does a binary search work?
    • Selects the middle point of the data
    • Compares the midpoint to the target value
    • If the midpoint matches the target, the search stops
    • If not, the upper or lower half of the data is ignored
  • What does the 'next i' command do in a loop?
    It moves the loop to the next iteration.
  • What is merge sort based on?
    • The idea of 'divide and conquer'
    • Divides a list into halves until each item is separate
    • Combines items in the correct order
  • What is the stopping condition for a bubble sort?
    The algorithm stops when a complete iteration is made with no swaps.
  • If the input for 'maxvalue' is 5, what outputs will the algorithm produce?
    Outputs: 1, 4, 9, 16, 25, program finished.
  • What is the purpose of a structure diagram?
    To display the organization of a problem in a visual format.
  • What is the process of an insertion sort?
    It splits the list into sorted and unsorted values, inserting unsorted values into the correct position in the sorted part.