Skip to content

Python MCQs: Test Your Knowledge

Part 1: Basics & Foundations

1. Which of the following is the correct extension of the Python file? - A) .python - B) .pl - C) .py - D) .p

Answer: C

2. Is Python case sensitive when dealing with identifiers? - A) Yes - B) No - C) Machine dependent - D) None of the mentioned

Answer: A

3. Which keyword is used for function in Python language? - A) Function - B) def - C) Fun - D) Define

Answer: B

4. What is the output of print(2 ** 3)? - A) 6 - B) 8 - C) 9 - D) 5

Answer: B

Part 2: Data Structures & Logic

5. Which of the following is a mutable data type in Python? - A) List - B) Tuple - C) String - D) Integer

Answer: A

6. What is the output of len(["apple", "banana", "cherry"])? - A) 3 - B) 1 - C) 18 - D) 2

Answer: A

7. How do you start a comments in Python? - A) // - B) /* - C) # - D) <!--

Answer: C

8. Which of these is not a core data type in Python? - A) Lists - B) Dictionary - C) Tuples - D) Class

Answer: D

Practice Makes Perfect

Try to explain why an answer is correct before looking it up. Understanding the logic is more important than memorizing the answer.