Click “Download PDF”, then choose “Save as PDF” as the printer.
MCQs with answers
Python Programming for Beginners
1. Which symbol starts a comment in Python?
- A. //
- B. #
- C. /*
- D. --
2. Which data type does Python give to the value 3.0?
- A. float
- B. int
- C. str
- D. double
3. Which keyword defines a function in Python?
- A. function
- B. define
- C. fun
- D. def
4. What does print(f"{7 / 2:.2f}") display?
- A. 3
- B. 3.5
- C. 3.50
- D. 3.500
5. After total = 0 and then for n in range(1, 5): total += n, what is the value of total?
- A. 15
- B. 10
- C. 4
- D. 5
6. Which statement about tuples is true?
- A. Tuples can grow with append()
- B. Tuples cannot contain repeated values
- C. Tuples are written in square brackets
- D. The items of a tuple cannot be changed after it is created
7. What does len(set([3, 1, 3, 2, 1])) return?
- A. 5
- B. 2
- C. 3
- D. 1
8. In a method of a class, what does self refer to?
- A. The particular object on which the method was called
- B. The class itself, shared by all objects
- C. The file in which the class is saved
- D. The value that the method returns
9. count = 0, then while count < 5: print(count), with nothing else inside the loop. What happens when this runs?
- A. It prints 0 to 4 and stops
- B. It prints nothing
- C. It prints 0 again and again without stopping
- D. It raises an error at once
10. If d = {'a': 1}, which expression gives 0 instead of raising an error for the missing key 'b'?
- A. d['b']
- B. d.get('b', 0)
- C. d.find('b')
- D. d['b'] or 0
Answer key
- 1 B
- 2 A
- 3 D
- 4 C
- 5 B
- 6 D
- 7 C
- 8 A
- 9 C
- 10 B
© 2026 VJ Classes · vjclasses.in