Search Tutorials


Python Data Types MCQ Questions and Answers | JavaInUse

Python Data Types MCQ Questions and Answers

Q. What is the data type of the result of the expression 5 + 3?

A. Integer
B. Float
C. String
D. Boolean

Q. What is the data type of the result of the expression "Hello" + "World"?

A. Integer
B. Float
C. String
D. List

Q. What is the data type of the result of the expression [1, 2, 3] * 2?

A. Integer
B. List
C. Tuple
D. Dictionary

Q. What is the data type of the result of the expression (True and False)?

A. Integer
B. Float
C. String
D. Boolean

Q. What is the data type of the result of the expression {1: "One", 2: "Two"}?

A. Integer
B. Dictionary
C. Set
D. Tuple

Q. What is the data type of the result of the expression (1, 2, 3)?

A. Integer
B. List
C. Tuple
D. Set

Q. What is the data type of the result of the expression "5"?

A. Integer
B. Float
C. String
D. Boolean

Q. What is the data type of the result of the expression True + False?

A. Integer
B. Float
C. String
D. Boolean

Q. What is the data type of the result of the expression {1, 2, 3}?

A. Integer
B. List
C. Tuple
D. Set

Q. What is the data type of the result of the expression "5" + 3?

A. Integer
B. Float
C. String
D. Error (cannot be added)

Q. What is the data type of the result of the expression not True?

A. Integer
B. Float
C. String
D. Boolean

Q. What is the data type of the result of the expression [1] * 3?

A. Integer
B. List
C. Tuple
D. Set





Q. What is the data type of the keys in a dictionary?

def calculate_average(numbers):
    total = sum(numbers)
    average = total / len(numbers)
    return average

numbers = [1, 2, 3, 4, 5]
avg = calculate_average(numbers)
print(avg)
A. Only integers
B. Only strings
C. Either integers or strings
D. Any data type

Q. What is the data type of the result of the expression (1, 2) * 2?

A. Integer
B. Tuple
C. List
D. Error (cannot be multiplied)

Q. What is the data type of the result of the expression 5 / 2?

A. Integer
B. Float
C. String
D. Boolean

Q. What is the data type of the following value: "Python is a versatile programming language."

A. int
B. float
C. str
D. list

Q. What will be the output of the following code snippet?

my_variable = True
print(type(my_variable))
int
float
str
bool

Q. Which data type is used to store a sequence of items?

tuple
set
dict
list

Q. What will be the output of the following code snippet?

my_list = [1, 2, 3, 4, 5]
my_tuple = ("a", "b", "c", "d", "e")
print(type(my_list))
print(type(my_tuple))
<class 'int'> and <class 'str'>
<class 'list'> and <class 'tuple'>
<class 'float'> and <class 'str'>
<class 'tuple'> and <class 'list'>

Q. What is the data type of the following value: {"name": "John", "age": 30}?

int
dict
list
tuple

Q. What will be the output of the following code snippet?

my_dict = {"a": 1, "b": 2, "c": 3}
print(type(my_dict))
int
dict
list
str

Q. Which data type is used to store a collection of unique items?

set
list
dict
tuple

Q. What will be the output of the following code snippet?

my_set = {1, 2, 3, 3, 4, 5}
print(my_set)
{1, 2, 3}
{1, 2, 3, 3, 4, 5}
{1, 2, 3, 4, 5}
{3, 2, 5, 4, 1}

Q. What is the data type of the following value: 3.14?

int
float
str
bool

Q. What will be the output of the following code snippet?

my_float = 3.14
print(type(my_float))
int
float
str
bool