Python Data Types Interview MCQ Questions and Answers 2

This ExamTray Free Online Test or Quiz or Trivia tests your Programming Skills on the basics of Python Data Types and Variables. This practice test displays answers after finishing the exam for review. You can easily clear Competitive Exams and Job Interview Questions. Students can learn Python basics.

Go through Python Theory Notes on Data Types before attempting this test.



1) What is the output of the given Python program with data types.
carrots = 5
carrots = 5.0
carrots = 'beetroots'
print(carrots)
A) 5
B) 5.0
C) beetroots
D) Compiler error
Answer [=]
Answer[=]
2) What is the output of the below Python program?
pen=10;
pencil=20.5
sum = pen + pencil
print(sum)
A) 30
B) 10
C) 30.5
D) TypeError: Unsupported operand type(s) for +
Answer [=]
Answer[=]
3) What is the output of the below Python code snippet?
bananas=5.0e2
print(bananas)
A) 500.0
B) 500
C) bananas
D) TypeError or Compiler error
Answer [=]
Answer[=]
4) What is the output of the given Python code snippet with floating point numbers?
apples=10e3
print(apples)
A) 1000.0
B) 1000
C) 10e3
D) 10E3
Answer [=]
Answer[=]
5) Can you use E or Exponential notation to represent integers in Python?
A) NO
B) YES
C) --
D) --
Answer [=]
Answer[=]
6) What is the output of the below Python code snippet with floating point and imaginary numbers?
ducks = 10e2+20e1j
print(ducks)
A) 1000+200j
B) (1000+200j)
C) 1000.0+200.0j
D) (1000.0+200.0j)
Answer [=]
Answer[=]
7) What is the output of the below Python code snippet with floating point and imaginary numbers?
ducks = 10.0 + 20.0j
print(ducks)
A) 10+20j
B) (10+20j)
C) 10.0+20.0j
D) (10.0+20.0j)
Answer [=]
Answer[=]


 

8) Imaginary numbers in Python suppress decimal notation if it can be converted to Integer. State TRUE or FALSE.
A) TRUE
B) FALSE
C) --
D) --
Answer [=]
Answer[=]
9) What is the output of below Python program with String?
dog_name = """Tomy
Tomi"""
print(dog_name)
A) Tomy Tomi
B)
Tomy
Tomi
C)
""Tomy
Tomi""
D) TypeError or Compiler Error
Answer [=]
Answer[=]
10) State TRUE or FALSE. A Multiline string when not assigned to any variable will be treated as text under multi-line comments.
A) TRUE
B) FALSE
C) --
D) --
Answer [=]
Answer[=]
11) In Python language you can use Single Quote and Double Quote interchangeably. State TRUE or FALSE.
A) TRUE
B) FALSE
C) --
D) --
Answer [=]
Answer[=]
12) What is the output of the given Python code snippet?
def count_ducks():
    print("Ducks 10")

    
print(count_ducks())
A)
Ducks 10
B)
Ducks 10
None
C)
None
D)
None
Ducks 10
Answer [=]
Answer[=]


Like or Share

Show some care. Like or Subscribe. [FB]...[Youtube]

C MCQ App by ExamTray 

Android APP

Java MCQ App by ExamTray 

Android APP
ALL MCQ App by ExamTray Android APP

Ad