Python Programming - Data Types

Exercise : Data Types - General Questions
  • Data Types - General Questions
1.
What is the data type of the following value: "Hello, World!"
String
List
Tuple
Dictionary
Answer: Option
Explanation:
"Hello, World!" is a string in Python. Strings are used to represent text data in Python.

2.
Which of the following is a mutable data type?
String
Tuple
List
Float
Answer: Option
Explanation:
Lists are mutable in Python, meaning that their contents can be changed after they are created. Strings, tuples, and floats are all immutable, meaning that their contents cannot be changed after they are created.

3.
Which of the following is a sequence data type?
Dictionary
Set
Tuple
None of the above
Answer: Option
Explanation:
Tuples are a sequence data type in Python, meaning that their elements are ordered and indexed, and they can be accessed by their position in the sequence. Dictionaries and sets are not sequence data types, because they are unordered.

4.
What is the data type of the following value: (1, 2, 3)
String
List
Tuple
Dictionary
Answer: Option
Explanation:
(1, 2, 3) is a tuple in Python. Tuples are used to group together multiple values into a single immutable container.

5.
What is the data type of the following value: {"a": 1, "b": 2, "c": 3}
String
List
Tuple
Dictionary
Answer: Option
Explanation:
{"a": 1, "b": 2, "c": 3} is a dictionary in Python. Dictionaries are used to store key-value pairs, where each key maps to a corresponding value.