π’ Computational Thinking & Programming-I Quiz 3 β Python Data Types (Class 11 CS)
Practice 20 CBSE Class 11 Computer Science (Code 083) MCQs on Python data types β numbers (integer, float, complex), boolean, sequences (string, list, tuple), None, mapping (dictionary), and mutable vs immutable data types.
Every type() output and expression result below has been verified by actually running it in Python. Tap any question to reveal the answer with a clear explanation.
π’ Data Types
Which of the following is a numeric data type in Python?
- String
- List
- Integer
- Dictionary
Show Answer & Explanation
β Answer: (c) Integer
Integer is a numeric data type in Python, used to represent whole numbers. String, List, and Dictionary all hold non-numeric or mixed data.
π’ Data Types
What is the data type of 3.14 in Python?
- Integer
- Floating point
- Complex
- Boolean
Show Answer & Explanation
β Answer: (b) Floating point
3.14 has a decimal point, which makes it a floating point number in Python β confirmed by type(3.14) returning <class 'float'>.
π Sequences
Which of the following is a sequence data type in Python?
- None
- Dictionary
- Tuple
- Boolean
Show Answer & Explanation
β Answer: (c) Tuple
A tuple is an ordered sequence of elements, just like lists and strings. None, Dictionary, and Boolean are not sequence types.
π Mutability
Which data type is used to represent a collection of elements that can be modified in Python?
- Immutable
- Boolean
- Mutable
- Integer
Show Answer & Explanation
β Answer: (c) Mutable
Mutable data types (like lists, dictionaries, and sets) allow their contents to be changed after creation β elements can be added, removed, or updated in place.
π Mutability
Which data type is used to represent a collection of elements that cannot be modified in Python?
- Mutable
- Float
- Complex
- Immutable
Show Answer & Explanation
β Answer: (d) Immutable
Immutable data types (like tuples and strings) cannot be changed once created β any βmodificationβ actually creates a brand-new object instead.
β Boolean
What is the value of the expression 5 > 3 in Python?
- True
- False
- None
- Error
Show Answer & Explanation
β Answer: (a) True
5 is indeed greater than 3, so this comparison evaluates to the boolean True.
π’ Data Types
Which data type is used to represent a single character or a sequence of characters in Python?
- Integer
- Boolean
- String
- List
Show Answer & Explanation
β Answer: (c) String
A string represents text β either a single character or a whole sequence of characters, enclosed in quotes.
π type()
What is the value of the expression type(42) in Python?
- Integer
- Float
- String
- Boolean
Show Answer & Explanation
β Answer: (a) Integer
type(42) returns <class 'int'>, meaning 42 is an Integer.
π type()
What is the value of the expression type([1, 2, 3]) in Python?
- Integer
- Float
- List
- Boolean
Show Answer & Explanation
β Answer: (c) List
Square brackets [ ] define a list in Python, so type([1, 2, 3]) returns <class 'list'> β List.
ποΈ Mapping
Which data type is used to represent key-value pairs in Python?
- Boolean
- List
- Tuple
- Dictionary
Show Answer & Explanation
β Answer: (d) Dictionary
A dictionary stores data as key-value pairs, letting you look up a value quickly using its associated key β e.g. {"name": "Riya"}.
π type()
What is the data type of the value None in Python?
- Integer
- String
- Boolean
- NoneType
Show Answer & Explanation
β Answer: (d) NoneType
None is a special built-in value representing βnothingβ or βno valueβ, and its type is its own unique class: NoneType.
ποΈ Mapping
Which data type represents an unordered collection of key-value pairs in Python?
- List
- Tuple
- Dictionary
- String
Show Answer & Explanation
β Answer: (c) Dictionary
A dictionary is Python’s built-in mapping type β an unordered (prior to Python 3.7, and insertion-ordered since) collection of key-value pairs.
π Mutability
Which of the following data types in Python is mutable?
- Tuple
- Dictionary
- String
- Integer
Show Answer & Explanation
β Answer: (b) Dictionary
A dictionary is mutable β you can add, remove, or update key-value pairs after it’s created. Tuples, strings, and integers are all immutable.
π’ Data Types
What is the value of the expression 3 + 4j in Python?
- Integer
- String
- Complex
- Boolean
Show Answer & Explanation
β Answer: (c) Complex
The j suffix marks the imaginary part of a number in Python, making 3 + 4j a Complex number β confirmed by type(3 + 4j) returning <class 'complex'>.
β Boolean
Which of the following is an actual boolean value in Python (not just text that looks like one)?
- “True”
- 1
- True
- 0
Show Answer & Explanation
β Answer: (c) True
True (without quotes) is the real boolean literal in Python. "True" is just a string that happens to say True, while 1 and 0 are integers β even though Python treats them as βtruthyβ and βfalsyβ in conditions, their actual type is int, not bool.
π type()
What is the value of the expression type(“Hello”) in Python?
- List
- Integer
- String
- Tuple
Show Answer & Explanation
β Answer: (c) String
Text enclosed in quotes is always a string in Python, so type("Hello") returns <class 'str'> β String.
π type()
What is the value of the expression type((1, 2, 3)) in Python?
- List
- Tuple
- Set
- Dictionary
Show Answer & Explanation
β Answer: (b) Tuple
Round brackets ( ) with comma-separated values define a tuple, so type((1, 2, 3)) returns <class 'tuple'> β Tuple.
π Type Conversion
Which built-in function converts a value to an integer in Python?
- str()
- int()
- float()
- bool()
Show Answer & Explanation
β Answer: (b) int()
int() is the built-in function used to convert a compatible value (like a numeric string or a float) into an integer β for example, int("5") gives 5.
π Mutability
Which of the following data types is immutable in Python?
- List
- Dictionary
- Set
- Tuple
Show Answer & Explanation
β Answer: (d) Tuple
A tuple is immutable β trying to change an element (e.g. t[0] = 5) raises a TypeError. List, dictionary, and set are all mutable and can be changed after creation.
π type()
What is the value of the expression type(True) in Python?
- Integer
- Boolean
- String
- NoneType
Show Answer & Explanation
β Answer: (b) Boolean
type(True) returns <class 'bool'> β Boolean. (Interesting fact: bool is technically a subclass of int in Python, which is why True == 1 evaluates to True β but type() still correctly reports it as bool.)
