Page 450 - ComputerScience_Class_11
P. 450
B. Fill in the blanks.
1. Float can represent both positive and negative ………………… values.
2. The elements of a ………………… are enclosed in parentheses () and separated by commas.
3. ………………… is used when a variable has no data stored in it.
4. An ………………… object in Python is an object whose value cannot be changed after it is created.
5. A ………………… list is a list that contains one or more lists as its elements.
Answers
1. decimal 2. tuple 3. None 4. immutable 5. nested
C. Answer the following questions:
1. Define numeric data type in Python.
Ans. A numeric data type is used to store numbers in a program. It includes values that represent whole numbers, decimal numbers
and complex numbers and allows mathematical operations such as addition, subtraction, multiplication and division.
2. Mention two characteristics of sequences in Python.
Ans. There are two characteristics of Sequence data types in Python:
• Collection of Elements: Sequence data types store multiple items in a single variable.
• Position-Based Access: Elements are accessed using their position (index number).
3. Why are some data types called mutable in Python?
Ans. Mutable data types in Python can be modified, added to or deleted without creating a new object. They can be homogeneous.
4. Define a list in Python.
Ans. A list is a sequence data type in Python that stores multiple values in an ordered manner. The elements of a list are enclosed in
square brackets [] and separated by commas.
5. What are the ways to access elements in a Python set?
Ans. We cannot access set elements using an index because sets are unordered. To access items, we can loop through the set using a
for loop or convert it to a list first.
6. What are the main characteristics of a dictionary in Python?
Ans. There are some characteristics of Dictionary data types in Python:
• Key–Value Pair Structure: A dictionary stores data in the form of key–value pairs. Each key is associated with a specific value.
• Unordered Collection (Insertion Ordered in Modern Python): Dictionaries maintain insertion order (from Python 3.7 onward),
but elements are accessed using keys, not index numbers.
• Mutable: Dictionaries are changeable. You can add, update or remove key–value pairs after creation.
• Unique Keys: Each key in a dictionary must be unique. Duplicate keys are not allowed.
• Values Can Be Duplicated: While keys must be unique, values can be repeated.
• Accessed by Keys: Elements are accessed using their keys instead of index positions.
• Can Store Different Data Types: Keys and values can be of different data types (e.g., string, integer, float, etc.).
7. What does the Boolean data type represent in Python?
Ans. A Boolean (bool) is a logical data type that holds only two possible values, True and False. It represents the truth value of a
condition or expression in a program. Boolean data types are mainly used for decision-making, controlling the flow of execution
and performing logical operations such as checking conditions and combining multiple expressions.
Syntax of Boolean is as follows:
variable_name = True # Boolean True
another_variable = False # Boolean False
448 Touchpad Computer Science (Ver. 3.0)-XI

