Basic Python MCQ Test
Basic Python MCQ Test
Name: ______________________________ Date: ______________________________
Course: ______________________________
Instructions:
– Total Questions: 30
– Each question carries 1 mark.
– Choose the correct option.
– Write only one answer for each question.
1. Who developed Python?
A. Dennis Ritchie
B. James Gosling
C. Guido van Rossum
D. Bjarne Stroustrup
2. Which keyword is used to define a function in Python?
A. function
B. define
C. def
D. fun
3. Which of the following is used to display output in Python?
A. echo()
B. display()
C. print()
D. output()
4. Which data type is used to store text?
A. int
B. float
C. string
D. bool
5. What is the correct extension of a Python file?
A. .pt
B. .py
C. .pyt
D. .python
6. Which symbol is used for comments in Python?
A. //
B.
C. #
D. **
Page 1
Basic Python MCQ Test
7. Which of the following is a mutable data type?
A. tuple
B. string
C. list
D. int
8. Which function is used to take input from the user?
A. get()
B. input()
C. scanf()
D. read()
9. What is the output of `type(10)`?
A. float
B. string
C. int
D. bool
10. Which operator is used for exponentiation?
A. ^
B. **
C. //
D. %%
11. Which keyword is used for conditional statements?
A. loop
B. switch
C. if
D. case
12. Which loop is used to iterate over a sequence?
A. while
B. do-while
C. for
D. repeat
13. What is the output of `len("Python")`?
A. 5
B. 6
C. 7
D. Error
14. Which collection stores key-value pairs?
A. list
B. tuple
C. set
D. dictionary
15. Which keyword is used to exit a loop?
A. stop
B. break
Page 2
Basic Python MCQ Test
C. exit
D. end
16. Which of the following is an ordered collection?
A. set
B. dictionary
C. tuple
D. all of these
17. What is the output of `5 // 2`?
A. 2.5
B. 3
C. 2
D. 2.0
18. Which function converts a string into an integer?
A. str()
B. float()
C. int()
D. bool()
19. Which keyword is used to create a class?
A. object
B. class
C. struct
D. define
20. Which operator is used to compare equality?
A. =
B. !=
C. ==
D. >=
21. Which of the following is used to store unique values?
A. list
B. tuple
C. set
D. string
22. What is the output of `bool(0)`?
A. True
B. False
C. 0
D. Error
23. Which function is used to find the maximum value?
A. high()
B. max()
C. maximum()
D. top()
24. Which keyword is used to import modules?
Page 3
Basic Python MCQ Test
A. include
B. using
C. import
D. require
25. Which of the following is not a Python data type?
A. list
B. tuple
C. arraylist
D. set
26. What is the output of `3 * "Hi"`?
A. HiHiHi
B. 9
C. Error
D. Hi3
27. Which method adds an item to a list?
A. insert()
B. add()
C. append()
D. push()
28. What is the correct way to create a tuple?
A. [1,2,3]
B. {1,2,3}
C. (1,2,3)
D. <1,2,3>
29. Which statement is used to handle exceptions?
A. catch
B. error
C. try
D. final
30. What is the output of `10 % 3`?
A. 3
B. 1
C. 0
D. 10
Page 4