Part 1: Theory Refresh 🧠
1. Binary Conversion
Convert the denary number 45 to an 8-bit binary number.
Convert the binary number 10110101 to denary.
2. Two's Complement
Show the 8-bit two's complement for -59.
3. Utility Software
Name and explain the utility used to fix a fragmented hard disk.
4. The Fetch-Decode-Execute Cycle
Name the three main stages of the CPU's instruction cycle.
5. Boolean Logic
A ride starts if `safetyBar` is down (True) AND `gate` is closed (True). Complete the truth table.
| safetyBar | gate | rideStarts |
|---|---|---|
| True | True | ... |
| True | False | ... |
| False | True | ... |
| False | False | ... |
Part 2: Code Comprehension & Debugging 💻
Task A: Identify the Constructs
Identify the line number for an example of each programming construct.
Task B: Spot the Bugs! 🐞
The code below is broken. Find and fix at least three errors.
Buggy Code:
Your Corrected Code:
Part 3: Python Coding Challenge ⌨️
The Goal: A Simple "Classroom Quiz" Program
Follow the steps to build the quiz program. You can reveal a code skeleton if you need help getting started.
Step 1: Create Question & Answer Lists
You need two lists to store your questions and the corresponding answers. The order is important!
Step 2: Ask the Questions
A for loop is perfect for this. You need to iterate
through the questions, print each one, and get the user's answer.
Step 3: Check the Answer and Keep Score
Inside the loop, an if statement can compare the
user's answer to the correct one. Remember to create a score variable
before the loop starts.
Step 4: Display the Final Score
After the loop finishes, a final print statement can
show the user how well they did.