More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
post
page
Python IDE Dashboard

System Architecture Quiz (GCSE Level)

Are you preparing for your GCSE Computer Science exams and want to put your understanding of System Architecture to the test? This quiz is designed to help you reinforce key concepts from the OCR GCSE Computer Science spec. Challenge yourself with 10 multiple-choice questions about System Architecture. Ready to dive in? Start the quiz now!

What Is System Architecture?

System Architecture refers to the structure and organisation of a computer system. It’s about how the hardware components—like the CPU, memory, and storage—work together to process data and execute instructions. Think of it as the blueprint of a computer, explaining how everything connects and functions as a whole.

At this level, you will focus on the Von Neumann architecture, which is the foundation of most modern computers. This architecture consists of four main components: the Central Processing Unit (CPU), memory, input devices, and output devices. These components are connected by buses, which are pathways for data to travel between them.

The Central Processing Unit (CPU)

The CPU is often called the main processing chip of the computer. It’s responsible for executing instructions and performing calculations. To understand the CPU, you need to know about its three main parts: the Arithmetic Logic Unit (ALU), the Control Unit (CU), and the registers.

The ALU performs all the arithmetic and logical operations, such as addition, subtraction, and comparisons. The Control Unit manages the flow of data within the CPU and coordinates the activities of all the other components, ensuring that instructions are fetched, decoded, and executed in the correct sequence. The CPU also operates using a clock, which is a synchronising signal that keeps all parts of the CPU working in time. The speed of the clock, measured in hertz (Hz), determines how many instructions the CPU can process per second—faster clock speeds generally mean faster processing.

Registers are small, fast storage locations within the CPU that hold data temporarily during processing.

The Fetch-Decode-Execute cycle is the process the CPU follows to run instructions. It fetches an instruction from memory, decodes it to understand what needs to be done, executes the instruction, and then repeats the cycle to execute a sequence of instructions (a computer program!).

Memory and Storage

Memory and storage are crucial for holding data and instructions. Primary memory, also known as Random Access Memory (RAM), is volatile, meaning it loses its data when the computer is turned off. RAM is used to store data and instructions that the CPU needs to access quickly.

Secondary storage, such as hard drives and solid-state drives (SSDs), is non-volatile and retains data even when the computer is powered down. You’ll need to understand the differences between these types of memory, including their speed, capacity, and cost.

Another important concept is cache memory, a small, fast type of memory located close to the CPU. It stores frequently used data to speed up processing. The more cache a CPU has, the faster it can perform tasks.

Buses and Data Transfer

Buses are the communication pathways that connect the components of a computer system. There are three main types of buses: the data bus, the address bus, and the control bus.

The data bus carries data between the CPU, memory, and other components. The address bus transmits the memory addresses of where data should be read from or written to. The control bus sends control signals to coordinate the activities of the different components.

Understanding how these buses work together is essential for grasping how data moves around a computer system.

Modern Computers and Multi-Core CPUs

Modern computers often use multi-core CPUs, which contain two or more independent processing units, called cores, within a single CPU chip. Each core can execute its own set of instructions, allowing the CPU to perform multiple tasks simultaneously. This improves overall performance, especially when running complex applications or multitasking.

Multi-core CPUs are essential for tasks like video editing, gaming, and scientific simulations, where large amounts of data need to be processed quickly. Understanding multi-core technology helps explain why modern computers are so powerful compared to older single-core systems.

Input and Output Devices

Input and output devices allow users to interact with the computer. Input devices, such as keyboards, mice, and scanners, send data into the computer. Output devices, like monitors, printers, and speakers, display or present the results of processing back to the user.

Embedded Systems

An embedded system is a computer system designed to perform a specific task within a larger system. Examples include microwaves, digital watches, smart speakers or cruise control systems in cars. These systems often have limited resources and are optimised for efficiency and reliability.

Understanding embedded systems helps you see how computer architecture applies beyond traditional computers, influencing everyday technology.

Why Is System Architecture Important?

System Architecture is the foundation of computer science. It helps you understand how computers work at a fundamental level, which is essential for programming, troubleshooting, and designing new systems. Whether you’re writing code, building hardware, or simply using a computer, knowing how everything connects gives you a deeper appreciation of technology.

Metronome App (Python Challenge)

With this Python challenge, we will create a metronome app to help musicians keep the right tempo when practising their favourite tunes. By the end of this project, we will have a program that takes user input for the BPM (Beats Per Minute) and the time signature, then generates a matching tempo on screen.

Our first task is to write a Python program that:

    Takes user input for BPM (beats per minute) and time signature (e.g., 4/4, 3/4, 6/8).
    Calculates the interval between beats based on the BPM
    Generates a visual metronome on the screen, showing the beats in real-time and refreshing the screen based on the bpm and the time signature

Our second aim will be to add a menu system to our app. The menu will give the user two options:

    Option 1: The user can use the metronome from our first task and will therefore be asked to enter the BPM and time signature to use.
    Option 2: The user will be asked to enter the name of a famous rock song they would like to practise on. The program will then try to find this rock song in the rock-songs.csv file provided to find out the BPM and time signature to use to configure the metronome.

BPM and Beat Interval

The interval (in seconds) between two beats can be calculated using the given bpm of a track as follows:

So for instance with a bpm of 120 (beats per minute), the delay between two beats is: 60/120 = 0.5 seconds.

Time Signature

The time signature determines how many beats are in each measure. For example, 4/4 means 4 beats per measure, while 3/4 means 3 beats. Our metronome should group beats accordingly by clearing the screen after each measure and displaying the first beat within a measure as a “Tick” while the other beats will be displayed as “Tock”.

Python Code

Here is the full code for the first part of this challenge, enabling the user to enter the BPM and time signature to be used by the metronome.

You will need to complete this code to add the menu system and let the user configure the metronome using either option 1 (entering the BPM and time signature) or option 2 (entering a song title).

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

The Skyscraper Smart Lift Algorithm

Imagine you are the lead developer for a cutting-edge, luxurious hotel housed in a 101-floor skyscraper. The hotel’s main lift needs a smart algorithm to efficiently transport guests to their rooms. Each floor has seven rooms, and the numbering starts from the ground floor (Floor 0) with rooms 1 to 7, then Floor 1 with rooms 8 to 14, and so on, up to Floor 100 with rooms 701 to 707.

The smart lift of this hotel is equipped with a keypad that let the guests enter their room number.

Your challenge is to write a Python algorithm to control this smart lift. Your algorithm will need to:

    Take a room number as input
    Validate this room number to only accept room numbers between 1 and 707 and display an error message if the room number is invalid
    Calculate and output the corresponding floor number that the lift will have to reach.

Key Insight

You may decide to solve this problem by yourself. Alternatively you can read through the following guidance to help you solve this challenge.

Let’s first make sense of the room numbering pattern:

  • Ground Floor (Floor 0): Rooms 1, 2, 3, 4, 5, 6, 7
  • Floor 1: Rooms 8, 9, 10, 11, 12, 13, 14
  • Floor 2: Rooms 15, 16, 17, 18, 19, 20, 21
  • Floor 100: Rooms 701, 702, 703, 704, 705, 706, 707

The floor number for any given room can be calculated using integer division (//). For example:

Room 24: 24 // 7 = 3. This room will be located on the 3rd floor.

However we need to be cautious, as just applying an integer division will not work for every room:
For instance: Room 7: 7 // 7 = 1 though we know that room 7 should be on the ground floor (0).

We can therefore define a formula to help us get the correct floor number for every valid room number:

Python Code

Your turn, use the online Python IDE below to complete the code for this challenge. Then you will be able to test your code with the test plan provided below the Python IDE.

Test Plan

Use the following test plan to test your code:

Input Expected Output Pass/Fail?
Room Number: 5 Ground Floor
Room Number: 12 1
Room Number: 16 2
Room Number: 21 2
Room Number: 22 3
Room Number: 76 10
Room Number: 101 14
Room Number: 707 100
Room Number: 708 Invalid Room Number!
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Kaprekar’s Constant – Python Challenge

In this challenge, we’re going to explore a fascinating mathematical curiosity known as Kaprekar’s Constant, and then write a Python program to demonstrate how it works.

Kaprekar’s constant, number 6174 has an odd particularity: If you rearrange its four digits in descending order (7641) and take away the number made of these same 4 digits in ascending order (1467) you will fall back on the initial number 7641 – 1467 = 6174!

But that’s not all… The Indian mathematician D. R. Kaprekar discovered something amazing about 4-digit numbers. Here’s the process he found:

  1. Take any 4-digit number (at least two different digits).
    Example: 3524

  2. Rearrange its digits to create:
    • The largest possible number: 5432
    • The smallest possible number: 2345
  3. Subtract the smaller number from the larger one:
    5432 – 2345 = 3087

  4. Now take this result and repeat the process!
    Step 1: 5432 – 2345 = 3087
    Step 2: 8730 – 0378 = 8352
    Step 3: 8532 – 2358 = 6174
    Step 4: 7641 – 1467 = 6174

Once you reach 6174, the process stops — because you’ll keep getting 6174 forever!

This number, 6174, is known as Kaprekar’s Constant. No matter which 4-digit number you start with (as long as the digits aren’t all identical), you will always end up at 6174 after a few iterations!

Let’s visualise this with 2025 as our starting 4-digit number:

Python Challenge

The initial challenge is to write a Python program that:

  • Asks the user to enter a 4-digit number (with at least two different digits).
  • Applies Kaprekar’s routine (rearrange digits, subtract, repeat).
  • Displays each step of the process.
  • Stops once it reaches 6174.
  • Outputs how many iterations it took to reach the constant.

Example output:

Enter a 4-digit number: 3524

Step 1: 5432 - 2345 = 3087
Step 2: 8730 - 0378 = 8352
Step 3: 8532 - 2358 = 6174

It took 3 iterations to reach Kaprekar's constant (6174).

Python Code (Solution)

Extra Challenge

Write a program to count how many iterations it takes for every 4-digit number (from 0001 to 9998) to reach 6174. Use this program to find out both the average (mean) and the maximum number of iterations it takes to reach Kaprekar’s constant amongst all these numbers!

Warning: Make sure to remove any number with the same 4 digits (1111, 2222, 3333… as these cannot lead to Kaprekar’s constant: When applying the process described above on such a 4-digit number, the computer will loop indefinitely without reaching Kaprekar’s constant.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

The Recamán’s Sequence (Recursive Algorithm)

The Recamán’s Sequence is a well-known recursive sequence used in Mathematics and Computer Science. It can easily be implemented using a recursive function.

Recamán’s sequence a0, a1, a2, … is defined as:

The first terms of the sequence are:
0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9, 24, 8, 25, 43, 62, 42, 63, 41, 18, 42, 17, 43, 16, 44, 15, 45, 14, 46, 79, 113, 78, 114, 77, 39, 78, 38, 79, 37, 80, 36, 81, 35, 82, 34, 83, 33, 84, 32, 85, 31, 86, 30, 87, 29, 88, 28, 89, 27, 90, 26, 91, 157, 224, 156, 225, 155, …

By drawing an arc between each consecutive number of the Recamán’s Sequence we can create beautiful visual representations of the sequence:

The above visualisation represents the first 70 numbers of the Recamán’s Sequence

To create this visual representation, we start with a0=0 and then draw an arc between each consecutive set of values of the sequence:

Recursive Function

Let’s implement a recursive function in Python to generate the first n values of the Recamán’s sequence:

Tagged with:

Flood-Fill Algorithm

The aim of this challenge is to demonstrate the use of a recursive algorithm used in most Graphic Editing Software when you use the fill tool to quickly and automatically fill a selected area with a solid colour.

To demonstrate this algorithm we will first initialise a 2D-array called grid that will represent our picture, each cell being a pixel of colour. We will use three integer values to represent the colours white (=0), black (=1) and purple (=2).

We will prefill our grid with mainly white pixels as well as a few random black blocks randomly positioned on the grid. We will then use a recursive algorithm, starting from a random position on the grid, to colour all adjacent white pixels using a recursive approach:

Python Code

Here is the Python code to create a visual demonstration of our recursive flood-fill algorithm:

Tagged with:

Random Alphabet Challenge

Welcome to the Random Alphabet Challenge! This set of three Python programming challenges is designed to test your problem-solving skills, creativity, and ability to manipulate strings and data structures.

But first let’s see if you can solve the following puzzle:

Hint?
Recite the alphabet in your head, one letter at a time and compare each letter with the letter of the randomised alphabet. If the two letters are the same, then you found the letter that is in the correct position!

Coding Challenge #1: Find the Correctly Placed Letter.

You are given a string of 26 uppercase letters, representing a shuffled version of the English alphabet. In this shuffled string, only one letter remains in its correct position (i.e., its position in the alphabet). Your task is to write a Python script that identifies which letter is correctly placed.

Example:

  • Input: “IVKOCEPJLTAMZNSYXUWRHFBDGQ”
  • Output: “N” (because “N” is the 14th letter of the alphabet and also the 14th letter in the given string)

Flowchart
Here is the flowchart to solve this challenge:

Python Code
Complete your code using the following online Python IDE:

Suggested Approach
Our recommended approach to solve this challenge is write a Python program to:

  • Iterate through each letter in the input string.
  • Compare the position of each letter in the string with its position in the alphabet.
  • Identify the letter where these positions match.

Testing
See if your code can find the letter in the correct position for the following shuffled alphabets:

Test # Input Values Output?
#1 SZDABJWLNRITXOUGQHEFPMVCKY
#2 OLMETJKXNGVYRZIWADSHPCQFBU
#3 XMBYCNGRQOVZPFWTJLHKEIUADS

Coding Challenge #2: Alphabet Shuffling Algorithm

In Stage 1, you wrote a Python script to identify the correctly placed letter in a shuffled alphabet string. Now, in Stage 2, we flip the script: your task is to generate a shuffled alphabet string where only one letter remains in its correct position.

You will need to write a Python program that:

  • Generates a random permutation of the 26 uppercase letters of the English alphabet.
  • Ensures that only one letter in this permutation is in its correct alphabetical position (e.g., “A” at index 0, “B” at index 1, etc.).

Coding Challenge #3: Quiz Time

This is the final stage of the Random Alphabet Challenge! In Stage 1, you identified the correctly placed letter in a shuffled alphabet. In Stage 2, you generated such a shuffled string. Now, in Stage 3, we combine both to create an interactive 10-round quiz where the player must identify the correctly placed letter in each round. Each correct answer scores one point.

Your Python script will need to:

  • Generate 10 shuffled alphabet strings (using your Stage 2 code), each with only one correctly placed letter.
  • Present each shuffled string to the user and asks them to identify the correctly placed letter.
  • Award one point for each correct answer (you may need to use your code from stage 1 for the computer to identify the correct letter and use this to check if the player’s answer is correct)
  • Display the final score at the end.
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Storage Technologies – Tic-Tac-Toe (Python Challenge)

For this challenge, we are putting a tech twist on the classic Tic-Tac-Toe game. Instead of Xs and Os, you will be working with a 3×3 grid filled with various computer storage devices. Your task is to write a Python program that not only generates this grid but also analyses it to detect if three devices of the same technology are aligned horizontally, vertically, or diagonally. Your program will give a score to the randomly generated grid where each alignment will add 10 points to the grid score.

Learning Objectives

The aim of this challenge is to work with different data structures in Python. The code provided below will use:

  • A 2D-array to store the tic-tac-toe grid (3×3 grid)
  • A list of storage devices
  • A dictionary of storage devices to store the technologies of each storage device

Your Challenge

Step 1:

Generate a 3×3 grid filled with random storage devices from the following list:

  • CD
  • DVD
  • BluRay
  • HDD
  • Floppy Disk
  • Magnetic Tape
  • USB Key
  • SD Card
  • SSD

Step 2:

Analyse the grid to check for any horizontal, vertical, or diagonal alignments of three devices from the same technology category:

  • Optical: CD, DVD, BluRay
  • Magnetic: HDD, Floppy Disk, Magnetic Tape
  • Solid State: USB Key, SD Card, SSD

Step 3:

Score points: For every alignment of three devices from the same technology, increase the score by 10.

Python Code

The code is already started for you. The code generates the random 3×3 grid of storage devices (step 1). But step 2 and 3 are incomplete. A this stage the code only checks the first row of the grid. You will need to complete this code t check all three rows as well as all thre columns and the two diagonales.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Lesson Finder (Python Challenge)

In this project, you’ll design a Python program that stores your school timetable (e.g. 5 lessons per day, Monday to Friday) and allows you to quickly find out what lesson you have on any given day and period. Simply enter a day (e.g. Tuesday) and a lesson number (e.g. 2), and the program will instantly tell you what subject you have, who the teacher is, and where the class is held.

Example Output:

“On Tuesday, Lesson 2 you have a Maths lesson with Mr. Smith in Room 105.”

Challenge Objectives

By completing this project, you will gain experience with:

  • Data Structures: Using dictionaries and lists to store and organise your timetable.
  • Input Validation: Taking input from the user and applying validation checks on the data being entered.
  • Output Formatting: Creating a user-friendly messages for the user to provide them with the required information.

Step 1: Storing the timetable using dictionaries and lists in Python

To complete this challenge, our first step will be to store our timetable within the code of our program. We will do so by using a combination of dictionaries and lists in Python.

  • Dictionaries ({}) are used to store data as key-value pairs. For example, in the Lesson Finder, each day of the week (e.g., “Monday”) is a key, and its value is a list of lessons for that day.
  • Lists ([]) are used to store ordered collections of items. In this project, each day’s lessons are stored as a list of dictionaries, where each dictionary contains details like the subject, teacher, and room.

To store the 5-day timetable so we will use a dictionary: Each key will represent a day, and the value will be a list of lessons for that day:

timetable = {
    "Monday": [
        {"subject": "English", "teacher": "TS", "room": "201"},
        {"subject": "Maths", "teacher": "MX", "room": "105"},
        {"subject": "Biology", "teacher": "SC", "room": "302"},
        {"subject": "History", "teacher": "HT", "room": "110"},
        {"subject": "Art", "teacher": "AR", "room": "403"}
    ],
    "Tuesday": [
        {"subject": "Maths", "teacher": "MX", "room": "105"},
        {"subject": "Physics", "teacher": "PH", "room": "301"},
        {"subject": "English", "teacher": "TS", "room": "201"},
        {"subject": "PE", "teacher": "PB", "room": "Gym"},
        {"subject": "ICT", "teacher": "KN", "room": "205"}
    ],
    # Add the rest of your days here
}

JSON Syntax?

If you are familiar with JSON syntax, you may have noticed that the syntax of our timetable built using a mix of dictionaries and lists in Python mirrors the JSON syntax (JavaScript Object Notation). JSON is a lightweight data format that is easy for humans to read and write, and easy for machines to parse and generate. It’s widely used for storing and exchanging data, especially in web applications. In Python, using a combination of dictionaries and lists allows us to create a structured, nested format that is both flexible and easy to work with—just like JSON!

Step 2: Receiving and validating user inputs

Now that we have stored our timetable in our Python code, we can retrieve the two inputs from the user: The day of the Week (Monday to Friday) and the period (1 to 5) of the lesson.

For our first input, we will use a look-Up check to validate the day of the week as we will only accept the following values: Monday, Tuesday, Wednesday, Thursday, Friday.

day = input("Enter the day of the week: ").title()
while day not in ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]:
   print("Invalid input! Please try again.")
   day = input("Enter the day of the week: ").title()

For our second input, we will use a range check to make sure only a value between 1 and 5 is being entered.

lessonNumber = int(input("Enter the lesson number (1-5): "))
while lessonNumber <1 or lessonNumber >5:
   print("Invalid input! Please try again.")
   lessonNumber = int(input("Enter the lesson number (1-5): "))

Step 3: Extracting the required information from the timetable

The following code enables us to access the different values from our timetable:

lesson = timetable[day][lessonNumber - 1]
subject = lesson["subject"]
teacher = lesson["teacher"]
room = lesson["room"]

We can then output a user-friendly message to the end-user using string concatenation:

print("On " + day + ", lesson " + str(lessonNumber) + ", you have a " + subject + " lesson with " + teacher + " in room " + room + ".")

Python Code

Here is the Python code for this challenge. You can tweak this code to enter your own timetable:

Your Challenge

Can you tweak this code to start by generating a printout of the whole timetable. The output would look like this:

>>> Weekly Timetable <<<

>>> Monday
> Lesson 1: English with TS in room 201.
> Lesson 2: Maths with MX in room 105.
> Lesson 3: Biology with SC in room 302.
> Lesson 4: History with HT in room 110.
> Lesson 5: Art with AR in room 403.

>>> Tuesday
> Lesson 1: Maths with MX in room 105.
> Lesson 2: Physics with PH in room 301.
> Lesson 3: English with TS in room 201.
> Lesson 4: PE with PB in room Gym.
> Lesson 5: ICT with KN in room 205.
...
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Programming Languages Classification (Python Challenge)

Choosing the right programming language can feel overwhelming, especially for beginners. Should you learn Python, JavaScript, Swift, or something else? The answer depends on what you want to build! That’s why we are launching a fun and practical Python challenge: Build a Programming Language Recommender.

In this challenge, you’ll create a Python program that guides users to the best programming language for their project. Whether they want to build a website, a mobile app, a video game, or even create a computer program to control an embedded device, your program will ask the right questions and provide tailored recommendations.

How It Works

Your task is to write a Python program that interacts with the user through a series of questions. Based on their answers, your program will suggest one or more programming languages that fit their goals.

Your algorithm will be based on the following classification (Click on the picture to open in a new window).

The first question your program will need to ask is:

What would you like to create?

The user will have to pick an option: Website, Mobile App, Video Game, Desktop Software or Embedded System

Based on the user choice, the program will then ask follow-up questions. For instance, if the user selects “Mobile App” the program will then ask:

Is this app for an iPhone or for an Android phone?

Based on the answers provided by the end-user, the program will suggest the most relevant programming languages the end-user should consider for their project.

Decision Tree Logic

To complete this challenge you will need to use decision tree logic to implement the given classification (see picture above). To to do so you will have to use several nested IF, ELIF and ELSE statements within your code.

Here is an example of what your code may look like:

print("Welcome to the Programming Language Recommender!")
project = input("What would you like to create? (Website/Mobile App/Video Game/Desktop Software/Embedded System): ").lower()

if project == "mobile app":
   platform = input("Is this app for iPhone or an Android phone? ").lower()
   if platform == "iphone":
      print("We recommend learning Swift or Dart!")
   elif platform == "android":
      print("We recommend learning Kotlin or JavaScript, Python or Dart!")
   else:
      print("Invalid Option!")

# Add more conditions for other types of projects!

When using nested if statements within an algorithm, make sure to indent your code properly:

Python Code

Use our online Python IDE to complete this challenge:

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area