Class 11 Computer Science Code 083
Ch 8: Data Handling
Check Point 8.3
Sumita Arora Book Exercise Solution
1. What is a String data type in Python?
Answer: In Python, a String is a sequence of characters and each character can be individually accessed using an index. In Python, a String is a pure sequence of Unicode characters.
Set of characters written inside the single ‘ ‘, double ” “, or triple ”’ ”’ , “”” “”” quotes, called String in Python. A string can hold any type of known character i.e. letters, numbers, and special symbols.
For example:- name = “Anjeev Singh Academy”,
website = “https://www.anjeevsinghacademy.com”
2. What are two internal subtypes of String data in Python?
Answer: (a) str type string, and (b) Unicode type string
3. How are str-type strings different from a Unicode string?
Answer: In Python, the str type string uses the ASCII system. In str type string each character consumed 1 byte of memory, and
Unicode type string used the UNICODE system. In Unicode string, each character consumed 2 bytes of memory.
Note – All Python 3.x strings store Unicode characters.
4. What are the List and Tuple data types of Python?
Answer: In Python, Lists and Tuples are compound data types.
List: In Python, a List is a sequential data type containing a list of comma-separated values of any datatype written inside the square brackets.
a = [1, 2, 3, 4]
b = [1.5, 4.6, 7.8]
c = [‘anjeev’, ‘singh’, ‘academy’]
d = [1 ‘one’, True, 25.69]
Tuple: In Python, a Tuple is a sequential data type containing a list of comma-separated values of any datatype written inside the parenthesis.
a = (1, 2, 3, 4)
b = (1.5, 4.6, 7.8)
c = (‘anjeev’, ‘singh’, ‘academy’)
d = (1 ‘one’, True, 25.69)
5. How is a list type different from a tuple data type in Python?
Answer: In Python, Lists and Tuples are sequential data types. There is one difference between a List and Tuple.
- A List is a mutable data type that allows in-place changes.
- A Tuple is an immutable data type that does not allows in-place changes.