Python Data Types Interview MCQ Questions and Answers

Study and learn Interview MCQ Questions and Answers on Python Data Types basics. Attend job interviews easily with these Multiple Choice Questions. You can print these Questions in default mode to conduct exams directly. You can download these MCQs in PDF format by Choosing Print Option first and Save as PDF option next using any Web Browser.

Go through Python Theory Notes on Data Types before reading these objective questions.



1) What is data type in Python?
A) The type of a variable
B) The type of data variable is holding
C) Both A and B
D) None
Answer [=]
B
Explanation: Python variable type is dependent on the type of data being assigned to it.
2) Python is a dynamically typed programming language. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
A
Explanation: Yes. Python is dynamically typed language. So, you do not need to exclusively specify the type of variable at compile time.
3) Python has Primitive and Non-Primitive data types. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
B
Explanation: Python does not have primitive and non-primitive data types.
4) Choose the correct answer about Python Data type?
A) Data type is resolved at runtime
B) Specifying Data type at compile time is not required
C) The type of a variable is nothing but the type of data being assigned to it.
D) All the above
Answer [=]
D
5) Choose the correct answer about Python data types.
A) There is no primitive data type in Python.
B) All variables in python are treated like Objects.
C) There are some built-in data types in Python
D) All the above
Answer [=]
D
6) Identify correct Python built in data types below.
A) int
B) float
C) complex
D) All the above.
Answer [=]
D
Explanation: All the above
7) Identify correct built-in python data types below.
A) True
B) False
C) Both A and B
D) TRUE and FALSE
Answer [=]
C
Explanation: True and False


8) Identify correct Python built-in data types below?
A) bytes
B) bytearray
C) memoryview
D) All the above
Answer [=]
D
Explanation: bytes, bytearray and memoryview
9) Identify correct built-in Python data types below.
A) list
B) tuple
C) range
D) All the above
Answer [=]
D
Explanation: list, tuple and range
10) Identify correct Python built-in data types?
A) set
B) frozenset
C) dict
D) All the above
Answer [=]
D
Explanation: set, frozenset and dict
11) The None data type in Python is comparable to _____ data type in Java.
A) void
B) null
C) int
D) None of the above
Answer [=]
B
Explanation: None in Python is equivalent to null data type in Java.
12) Identify built-in data type categories in Python.
A) Numeric (int, float, complex), Boolean (True, False), String or Text Sequence type(str)
B) Binary Sequence Type (bytes, bytearray, memoryview), Sequence Type (list, tuple, range)
C) Set type (set, frozenset), Mapping type (dict), None type
D) All the above
Answer [=]
D
13) What is the output of given Python program?
a=9; b=-8;
c=a+b;
print(c);
A) 17
B) -1
C) 1
D) Compiler error
Answer [=]
C
14) Choose the numeric data type below?
A) 10
B) 10.9
C) 10 + 9j
D) All the above
Answer [=]
D
Explanation: The above are examples for integer, float and complex data types.


15) In Python boolean data types True and False are equivalent to _______ and ______.
A) TRUE and FALSE
B) 1.0 and 0.0
C) 1 and 0
D) None of the above
Answer [=]
C
Explanation: In Python True is treated as 1 and False is treated as 0 when ever numeric operations are involved.
16) Choose the correct floating point number below used in Python language?
A) 10.8
B) 10.00008
C) -10.8e3
D) All the above
Answer [=]
D
Explanation: Any integer clubbed with a decimal point is treated as a floating point number.
17) Choose the correct representation of imaginary numbers or complex numbers in Python language.
A) 10 + 8j
B) 15.2 + 8.7j
C) 28J+5.5
D) All the above
Answer [=]
D
Explanation: Complex number may use j or J to denote imaginary part. You can use float numbers under real and imaginary parts.
18) Identify correct representation of String data type i.e "str" in Python below.
A) "Hello examtray"
B) 'Hi! examtray'
C)
"""Hello examtray..
What is your next move"""
or
'''Hello examtray..
What is your next move'''
D) All the above
Answer [=]
D
Explanation: A Python string should be enclosed within a pair of single or double quotes. For multi-line string, use triple single quotes or triple double quotes.
19) A Python string index starts with _____.
A) -1
B) 0
C) 1
D) None of the above
Answer [=]
B
Explanation: Python string index starts with 0 just like in Java language.
20) str() function in Python allows you to create a string from other data types. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
A
Explanation:

Yes. str() function can be used to create strings.

a=10;
mystring = str(a);