Q1. Which of the following is a built-in data type in Python?
β
Correct Answer: (B) float
π Explanation: float is a built-in Python data type used to store decimal values.
π 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?
β
Correct Answer: (B) int
π Explanation: The int data type stores integer (whole number) values.
π Explanation: The int data type stores integer (whole number) values.
Q3. Which of the following is an immutable data type?
β
Correct Answer: (D) tuple
π Explanation: Tuples cannot be changed after creation, so they are immutable.
π Explanation: Tuples cannot be changed after creation, so they are immutable.
Q4. What will be the data type of the value 10.5?
β
Correct Answer: (B) float
π Explanation: Decimal numbers are stored as float in Python.
π Explanation: Decimal numbers are stored as float in Python.
Q5. Which function is used to check the data type of a variable?
β
Correct Answer: (B) type()
π Explanation: The type() function returns the data type of a variable.
π Explanation: The type() function returns the data type of a variable.
Q6. Which data type is used to store True or False values?
β
Correct Answer: (B) bool
π Explanation: The bool data type stores Boolean values: True or False.
π Explanation: The bool data type stores Boolean values: True or False.
Q7. Which of the following is a mutable data type?
β
Correct Answer: (C) list
π Explanation: Lists can be modified after creation, making them mutable.
π Explanation: Lists can be modified after creation, making them mutable.
Q8. What is the data type of 5 + 3j in Python?
β
Correct Answer: (C) complex
π Explanation: Numbers with real and imaginary parts are of complex data type.
π Explanation: Numbers with real and imaginary parts are of complex data type.
Q9. Which data type is used to store text in Python?
β
Correct Answer: (C) str
π Explanation: Python uses the str data type to store text..
π Explanation: Python uses the str data type to store text..
Q10. Which of the following represents a dictionary in Python?
β
Correct Answer: (D) {“a”: 1, “b”: 2}
π Explanation: Dictionaries store data in keyβvalue pairs using {}.
π Explanation: Dictionaries store data in keyβvalue pairs using {}.
Q11. Which function converts a value to an integer?
β
Correct Answer: (A) int()
π Explanation: The int() function converts compatible values to integers.
π Explanation: The int() function converts compatible values to integers.
Q12. Which data type stores unique values only?
β
Correct Answer: (C) set
π Explanation: A set automatically removes duplicate values.
π Explanation: A set automatically removes duplicate values.
Q13. What will be the output of the following code?
type([1, 2, 3])
β
Correct Answer: (B) class ‘list’
π Explanation: The type() function returns the class of the object.
π Explanation: The type() function returns the class of the object.
Q14. Which of the following is an ordered data type?
β
Correct Answer: (C) list
π Explanation: Lists maintain the order of elements.
π Explanation: Lists maintain the order of elements.
Q15. Which data type is used to store keyβvalue pairs?
β
Correct Answer: (D) dictionary
π Explanation: Dictionaries store data as keyβvalue pairs.
π Explanation: Dictionaries store data as keyβvalue pairs.
Q16. Which of the following is NOT a Python data type?
β
Correct Answer: (C) char
π Explanation: Python does not have a char data type; characters are stored as strings.
π 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)
β
Correct Answer: (A) bool
π Explanation: True is a Boolean value of type bool.
π Explanation: True is a Boolean value of type bool.
Q18. Which data type can store multiple different data types?
β
Correct Answer: (B) list
π Explanation: Lists can store elements of different data types.
π Explanation: Lists can store elements of different data types.
Q19. Which function converts data to string type?
β
Correct Answer: (C) str()
π Explanation: The str() function converts data into string format.
π Explanation: The str() function converts data into string format.
Q20. Which of the following data types is immutable?
β
Correct Answer: (D) tuple
π Explanation: Tuples cannot be modified after creation.
π Explanation: Tuples cannot be modified after creation.