Q1. What is the data type of the variable “x” in the following code snippet?
x=5
a) Integer
New Feature Beta
Personalized GenAI Learning Path 2025 Crafted Just for YOU!
b) String
c) Float
d) Boolean
Answer: a
Explanation: The variable “x” is assigned an integer value, so its data type is Integer.
Q2. What will be the output of the following code snippet?
x = "Hello"
print(type(x))
a) hello
b) str
c) string
d) String
Answer: b
Explanation: The code snippet prints the data type of the variable “x”, which is a string. The correct
type name in Python is “str”.
Q3. Which data type in Python is used to store a sequence of characters?
a) Integer
b) Float
c) String
d) Boolean
Answer: c
Explanation: Strings are used to store sequences of characters in Python.
Q4. What is the output of the following code snippet?
x = 3.14
print(type(x))
a) int
,b) Integer
c) float
d) Float
Answer: c
Explanation: The code snippet prints the data type of the variable “x”, which is a floating-point
number. The correct type name in Python is “float”.
Q5. Which data type is used to store a collection of items, where each item is indexed by a key?
a) List
b) Tuple
c) Set
d) Dictionary
Answer: d
Explanation: Dictionaries in Python are used to store collections of items where each item is indexed
by a key.
Q6. What will be the output of the following code snippet?
x = 10
y = "20"
print(x + int(y))
a) 30
b) 1020
c) “1020”
d) Error
Answer: a
Explanation: The code snippet converts the string “20” to an integer using the int() function and then
adds it to the integer value of “x”. Therefore, the output will be 30.
Q7. Which data type in Python is mutable?
a) String
b) Tuple
c) Set
d) List
Answer: d
, Explanation: Lists in Python are mutable, meaning their elements can be changed after they are
created.
Q8. What will be the output of the following code snippet?
x = {"apple", "banana", "cherry"}
print(type(x))
a) set
b) Set
c) list
d) List
Answer: a
Explanation: The code snippet prints the data type of the variable “x”, which is a set. The correct
type name in Python is “set”.
Q9. Which data type is used to store a collection of items, where each item is unique and
unordered?
a) List
b) Tuple
c) Set
d) Dictionary
Answer: c
Explanation: Sets in Python are used to store collections of items where each item is unique and
unordered.
Q10. What is the output of the following code snippet?
x = {"name": "John", "age": 30}
print(type(x))
a) dictionary
b) dict
c) Dictionary
d) Dict
Answer: b
Explanation: The code snippet prints the data type of the variable “x”, which is a dictionary. The
correct type name in Python is “dict”.
x=5
a) Integer
New Feature Beta
Personalized GenAI Learning Path 2025 Crafted Just for YOU!
b) String
c) Float
d) Boolean
Answer: a
Explanation: The variable “x” is assigned an integer value, so its data type is Integer.
Q2. What will be the output of the following code snippet?
x = "Hello"
print(type(x))
a) hello
b) str
c) string
d) String
Answer: b
Explanation: The code snippet prints the data type of the variable “x”, which is a string. The correct
type name in Python is “str”.
Q3. Which data type in Python is used to store a sequence of characters?
a) Integer
b) Float
c) String
d) Boolean
Answer: c
Explanation: Strings are used to store sequences of characters in Python.
Q4. What is the output of the following code snippet?
x = 3.14
print(type(x))
a) int
,b) Integer
c) float
d) Float
Answer: c
Explanation: The code snippet prints the data type of the variable “x”, which is a floating-point
number. The correct type name in Python is “float”.
Q5. Which data type is used to store a collection of items, where each item is indexed by a key?
a) List
b) Tuple
c) Set
d) Dictionary
Answer: d
Explanation: Dictionaries in Python are used to store collections of items where each item is indexed
by a key.
Q6. What will be the output of the following code snippet?
x = 10
y = "20"
print(x + int(y))
a) 30
b) 1020
c) “1020”
d) Error
Answer: a
Explanation: The code snippet converts the string “20” to an integer using the int() function and then
adds it to the integer value of “x”. Therefore, the output will be 30.
Q7. Which data type in Python is mutable?
a) String
b) Tuple
c) Set
d) List
Answer: d
, Explanation: Lists in Python are mutable, meaning their elements can be changed after they are
created.
Q8. What will be the output of the following code snippet?
x = {"apple", "banana", "cherry"}
print(type(x))
a) set
b) Set
c) list
d) List
Answer: a
Explanation: The code snippet prints the data type of the variable “x”, which is a set. The correct
type name in Python is “set”.
Q9. Which data type is used to store a collection of items, where each item is unique and
unordered?
a) List
b) Tuple
c) Set
d) Dictionary
Answer: c
Explanation: Sets in Python are used to store collections of items where each item is unique and
unordered.
Q10. What is the output of the following code snippet?
x = {"name": "John", "age": 30}
print(type(x))
a) dictionary
b) dict
c) Dictionary
d) Dict
Answer: b
Explanation: The code snippet prints the data type of the variable “x”, which is a dictionary. The
correct type name in Python is “dict”.