Python Programming Basics – MCQ Practice Test
Practise Python Programming Basics with this free MCQ test for Grade 9 (Matric / O-Level) students. Class 9 computer science notes: Python variables, data types, if statements, loops and lists, with worked programs. The questions follow the same ground as the study notes, so they are a good way to check what you have learned before an exam.
Below you will find 10 sample questions with answers and short explanations, at Easy level. Easy questions are worth 1 mark, Intermediate 2 marks and Advanced 3 marks. When you are ready, take the full timed test in the Test Zone — with a timer, negative marking and fresh questions every time.
Start the Python Programming Basics test in the Test Zone → Pick “Python Programming Basics” in the subject dropdown, then choose your level, number of questions and timer. Or read the notes for Python Programming Basics first.
How this test works
In the full Test Zone test you choose how many questions to answer (10, 20, 30 or 50), a level — Easy, Intermediate, Advanced or Mixed — and an optional timer of 30, 45 or 60 seconds per question. Easy questions carry 1 mark, Intermediate 2 marks and Advanced 3 marks. You can switch on negative marking, which takes away a quarter of a question’s marks for a wrong answer; skipped questions score nothing. At the end you see your marks and percentage, a breakdown by level, and every question with the correct answer and a short explanation.
Sample questions: Python Programming Basics
Try these 10 sample questions from the test. Choose an answer in your head, then tap “Show answer” to check yourself.
Q1. Which symbol starts a comment in Python? Easy · 1 mark
- //
- #
- /*
- --
Show answer
Answer: B. #. A # makes the rest of the line a comment in Python.
Q2. What does input() return in Python? Easy · 1 mark
- An integer
- A float
- A string
- A boolean
Show answer
Answer: C. A string. input() always returns a string, so convert it with int() or float() for arithmetic.
Q3. What is the value of 7 // 2 in Python? Easy · 1 mark
- 3.5
- 3
- 1
- 2
Show answer
Answer: B. 3. Floor division drops the remainder, so 7 // 2 = 3.
Q4. What is the index of the first item in a Python list? Easy · 1 mark
- 0
- 1
- −1
- It has no index
Show answer
Answer: A. 0. Python lists are indexed from 0.
Q5. What does print("Hello") do in Python? Easy · 1 mark
- Saves a file
- Displays Hello on the screen
- Creates a variable
- Deletes Hello
Show answer
Answer: B. Displays Hello on the screen. print() displays its output on the screen.
Q6. What is the value of int("5") + 1? Easy · 1 mark
- 51
- 6
- "51"
- Error
Show answer
Answer: B. 6. int("5") is 5, so 5 + 1 = 6.
Q7. What is the value of 2 ** 3 in Python? Easy · 1 mark
- 5
- 6
- 8
- 9
Show answer
Answer: C. 8. The ** operator is power: 2³ = 8.
Q8. What does the % operator do in Python? Easy · 1 mark
- Division
- Remainder after division
- Power
- Multiplication
Show answer
Answer: B. Remainder after division. % gives the remainder, so 7 % 2 = 1.
Q9. Which numbers does range(1, 5) produce? Easy · 1 mark
- 1, 2, 3, 4
- 1, 2, 3, 4, 5
- 0, 1, 2, 3, 4
- 5, 4, 3, 2, 1
Show answer
Answer: A. 1, 2, 3, 4. range(1, 5) starts at 1 and stops before 5.
Q10. What is len([10, 20, 30, 40])? Easy · 1 mark
- 3
- 4
- 10
- 40
Show answer
Answer: B. 4. len() counts the items in the list, which is 4.
More practice tests
- Essay & Letter Writing Skills MCQ test
- Seerat-un-Nabi (PBUH) MCQ test
- The Pakistan Movement 1857-1947 MCQ test
- Algorithms & Data Structures MCQ test
Last updated: 23 November 2026. Back to the Test Zone · Python Programming Basics notes & MCQs