Level 1: The Basics

Rapid Fire Questions (1 - 3 Marks)

1. The Missing Input (1 Mark)

A program asks for a PIN code. Complete the code to store the user's input in the variable pin.

Examiner's Notes

  • 1 Mark: Using the input() function correctly.

2. Fixing the Math (2 Marks)

This code crashes because input() returns a string.
Task: Cast the input to an Integer so the math works.

Examiner's Notes

  • 1 Mark: Casting string to integer using int().
  • 1 Mark: Performing the multiplication correctly.

3. Join the Strings (2 Marks)

Create a variable message that joins word1 and word2 to make "HelloEveryone" (No space).

Examiner's Notes

  • 1 Mark: Using + to join strings.
  • 1 Mark: Ensuring no spaces are added.

4. Calculate Area (2 Marks)

Calculate the area of a rectangle (`width * height`) and store it in area.

Examiner's Notes

  • 1 Mark: Selecting the correct operator (*).
  • 1 Mark: Assigning result to correct variable name.

5. Comparison (3 Marks)

Write an if statement.
If grade is greater than or equal to 50, print "Pass", else print "Fail".

Examiner's Notes

  • 1 Mark: Correct comparison (>=).
  • 1 Mark: Correct use of else.
  • 1 Mark: Correct indentation.

6. Boolean Logic (1 Mark)

What will result be? Change `...` to either `True` or `False` to match the logic.
Logic: (True AND False) OR True

Examiner's Notes

  • 1 Mark: Understanding and logic.
  • 1 Mark: Understanding or logic.

7. List Indexing (1 Mark)

Access and print "Green" from the list. Remember, lists start at 0.

Examiner's Notes

  • 1 Mark: Accessing list with square brackets [].
  • 1 Mark: Using correct index (2 for Green).

8. Loop Trace (3 Marks)

What is the Final Value of total?
Run the code to see. (In an exam, you'd calculate this in your head!).

9. Impossible Condition (2 Marks)

This code never prints "Valid" because a number cannot be greater than 10 AND less than 5.
Change and to or to fix it.

10. Calling Functions (2 Marks)

The function double(x) exists. Call it with the value 5 and print the result.

Examiner's Notes

  • 1 Mark: Calling function with parentheses ().
  • 1 Mark: Passing correct argument 5.

11. Decimal Math (1 Mark)

Calculate 2.5 * 5 and print the result.

Examiner's Notes

  • 1 Mark: Correct use of multiplication * operator.
  • 1 Mark: Handling float types correctly.

12. Slicing (2 Marks)

Print the first 2 letters of lang ("Py").

Examiner's Notes

  • 1 Mark: Correct slice syntax `[start:stop]`.
  • 1 Mark: Correct stop index (2).

13. Countdown (3 Marks)

Use a loop to print: 3, 2, 1.

Examiner's Notes

  • 1 Mark: Using range() function.
  • 1 Mark: Correct start, stop, and step arguments (3, 0, -1).
  • 1 Mark: Correct Loop Syntax (for/in/colon).

14. Adding Items (2 Marks)

Add "Purple" to the list colours.

Examiner's Notes

  • 1 Mark: Using list method .append().
  • 1 Mark: Correct string syntax for argument.

15. Else If (3 Marks)

If colour is "Red" print "Stop". Else print "Go".

Examiner's Notes

  • 1 Mark: Correct comparison == operator.
  • 1 Mark: Correct use of else:.
  • 1 Mark: Correct output strings.

16. Remainders (2 Marks)

What is the remainder of 10 divided by 3? (Use %).

Examiner's Notes

  • 1 Mark: Identifying Modulo operator %.
  • 1 Mark: Printing correct result (1).

17. Swapping Variables (3 Marks)

Swap the values of a and b using a temp variable t.

Examiner's Notes

  • 1 Mark: Assigning `a` to temp variable.
  • 1 Mark: Assigning `b` to `a`.
  • 1 Mark: Assigning temp to `b`.

18. Fix the Error (2 Marks)

This code has a Syntax Error. Fix the 'if' statement line.

Examiner's Notes

  • 1 Mark: Replacing assignment = with comparison ==.
  • 1 Mark: Adding missing colon :.

19. Logic Gates (1 Mark)

(True AND False) OR True.

Examiner's Notes

  • 1 Mark: Evaluating parens (True AND False = False).
  • 1 Mark: Evaluating OR (False OR True = True).

20. Return Values (2 Marks)

Complete square(x) to return x * x.

Examiner's Notes

  • 1 Mark: Using return keyword.
  • 1 Mark: Returning correct calculation logic.

21. Updating Variables (1 Mark)

Change the value of score to 20. Then print it.

Examiner's Notes

  • 1 Mark: Reassigning variable and printing new value.

22. String Length (1 Mark)

Print the length of the string "Hello".

Examiner's Notes

  • 1 Mark: Using len() function correctly.

23. Subtraction (1 Mark)

Subtract 5 from 10 and print the result.

Examiner's Notes

  • 1 Mark: Correct subtraction syntax.

24. String Repetition (1 Mark)

Print the word "Go" 3 times (e.g., "GoGoGo").

Examiner's Notes

  • 1 Mark: Using multiplication operator * on string.

25. List Replacement (1 Mark)

Change the first item in the list to 5.

Examiner's Notes

  • 1 Mark: Accessing index 0 and assigning new value.

26. Not Equal (1 Mark)

Check if a is not equal to b. Print the result (True/False).

Examiner's Notes

  • 1 Mark: Using != operator.

27. Less Than (1 Mark)

Check if 2 is less than 5. Print the result.

Examiner's Notes

  • 1 Mark: Using < operator.

28. Grade Check (3 Marks)

If score is > 80 print "High". Else, if score > 50 print "Medium". Else print "Low".

Examiner's Notes

  • 1 Mark: First if condition.
  • 1 Mark: First elif condition.
  • 1 Mark: Correct else block.

29. ID Check (2 Marks)

Check if id is 1 OR id is 2. Print "Valid".

Examiner's Notes

  • 1 Mark: Correct OR logic (id == 1 or id == 2).
  • 1 Mark: Correct print statement.

30. Precise Math (1 Mark)

Add 2.5 and 2.5 and print the result.

Examiner's Notes

  • 1 Mark: Adding floats correctly.

31. Floor Division (1 Mark)

Calculate how many times 3 goes into 10 (whole number) using //.

Examiner's Notes

  • 1 Mark: Using floor division operator //.

32. Powers (1 Mark)

Calculate 2 to the power of 3 using **.

Examiner's Notes

  • 1 Mark: Using exponent operator **.

33. Membership In (1 Mark)

Check if "Red" is in the list colours.

Examiner's Notes

  • 1 Mark: Using in keyword.

34. Membership Not In (1 Mark)

Check if "Cat" is not in the list.

Examiner's Notes

  • 1 Mark: Using not in keywords.

35. Add Function (2 Marks)

Define a function add(a, b) that returns a + b.

Examiner's Notes

  • 1 Mark: Defining function with 2 parameters.
  • 1 Mark: Returning the sum.

36. String Concatenation (1 Mark)

Use the + operator to join "Score: " and the number 10.

Examiner's Notes

  • 1 Mark: Using str() to convert number.
  • 1 Mark: Using + to join strings.

37. Remove Item (1 Mark)

Remove and print the last item using .pop().

Examiner's Notes

  • 1 Mark: Calling .pop() method.

38. Count Range (1 Mark)

Loop from 1 to 3 using range(1, 4) and print i.

Examiner's Notes

  • 1 Mark: Correct range parameters (start, end+1).

39. Total Count (2 Marks)

Add 1 to total inside the loop.

Examiner's Notes

  • 1 Mark: Updating total (total += 1 or total = total + 1).
  • 1 Mark: Printing final total.

40. Debugging Names (1 Mark)

Fix the typo so it prints "Hello".

Examiner's Notes

  • 1 Mark: Correcting the variable name in print statement.

Level 1 Complete!

You've secured the basic marks. Now try formatting and algorithms.

Next Level