Python MCQs Data Types

Q1. Which of the following is a built-in data type in Python?

A) real
B) float
C) double
D) character
βœ… Correct Answer: (B) float
πŸ“˜ Explanation: float is a built-in Python data type used to store decimal values.

Q2. Which data type is used to store whole numbers in Python?

A) float
B) int
C) complex
D) bool
βœ… Correct Answer: (B) int
πŸ“˜ Explanation: The int data type stores integer (whole number) values.

Q3. Which of the following is an immutable data type?

A) list
B) set
C) dictionary
D) tuple
βœ… Correct Answer: (D) tuple
πŸ“˜ Explanation: Tuples cannot be changed after creation, so they are immutable.

Q4. What will be the data type of the value 10.5?

A) int
B) float
C) complex
D) bool
βœ… Correct Answer: (B) float
πŸ“˜ Explanation: Decimal numbers are stored as float in Python.

Q5. Which function is used to check the data type of a variable?

A) datatype()
B) typeof()
C) type()
D) check()
βœ… Correct Answer: (B) type()
πŸ“˜ Explanation: The type() function returns the data type of a variable.

Q6. Which data type is used to store True or False values?

A) int
B) bool
C) str
D) float
βœ… Correct Answer: (B) bool
πŸ“˜ Explanation: The bool data type stores Boolean values: True or False.

Q7. Which of the following is a mutable data type?

A) tuple
B) string
C) list
D) int
βœ… Correct Answer: (C) list
πŸ“˜ Explanation: Lists can be modified after creation, making them mutable.

Q8. What is the data type of 5 + 3j in Python?

A) int
B) float
C) complex
D) bool
βœ… Correct Answer: (C) complex
πŸ“˜ Explanation: Numbers with real and imaginary parts are of complex data type.

Q9. Which data type is used to store text in Python?

A) char
B) string
C) str
D) text
βœ… Correct Answer: (C) str
πŸ“˜ Explanation: Python uses the str data type to store text..

Q10. Which of the following represents a dictionary in Python?

A) (1, 2, 3)
B) [1, 2, 3]
C) {1, 2, 3}
D) {“a”: 1, “b”: 2}
βœ… Correct Answer: (D) {“a”: 1, “b”: 2}
πŸ“˜ Explanation: Dictionaries store data in key–value pairs using {}.

Q11. Which function converts a value to an integer?

A) int()
B) float()
C) str()
D) bool()
βœ… Correct Answer: (A) int()
πŸ“˜ Explanation: The int() function converts compatible values to integers.

Q12. Which data type stores unique values only?

A) list
B) tuple
C) set
D) dictionary
βœ… Correct Answer: (C) set
πŸ“˜ Explanation: A set automatically removes duplicate values.

Q13. What will be the output of the following code?


type([1, 2, 3])

A) list
B) class ‘list’
C) tuple
D) dict
βœ… Correct Answer: (B) class ‘list’
πŸ“˜ Explanation: The type() function returns the class of the object.

Q14. Which of the following is an ordered data type?

A) set
B) dictionary
C) list
D) none
βœ… Correct Answer: (C) list
πŸ“˜ Explanation: Lists maintain the order of elements.

Q15. Which data type is used to store key–value pairs?

A) list
B) tuple
C) set
D) dictionary
βœ… Correct Answer: (D) dictionary
πŸ“˜ Explanation: Dictionaries store data as key–value pairs.

Q16. Which of the following is NOT a Python data type?

A) int
B) float
C) char
D) str
βœ… Correct Answer: (C) char
πŸ“˜ Explanation: Python does not have a char data type; characters are stored as strings.

Q17. What is the output of the following code?


type(True)

A) bool
B) int
C) str
D) float
βœ… Correct Answer: (A) bool
πŸ“˜ Explanation: True is a Boolean value of type bool.

Q18. Which data type can store multiple different data types?

A) int
B) list
C) float
D) bool
βœ… Correct Answer: (B) list
πŸ“˜ Explanation: Lists can store elements of different data types.

Q19. Which function converts data to string type?

A) int()
B) float()
C) str()
D) bool()
βœ… Correct Answer: (C) str()
πŸ“˜ Explanation: The str() function converts data into string format.

Q20. Which of the following data types is immutable?

A) list
B) dictionary
C) set
D) tuple
βœ… Correct Answer: (D) tuple
πŸ“˜ Explanation: Tuples cannot be modified after creation.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top