0% found this document useful (0 votes)
32 views1 page

Python Code Output Quiz

Module 1

Uploaded by

lisaandrias5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views1 page

Python Code Output Quiz

Module 1

Uploaded by

lisaandrias5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

*1. What will be the output of the following code?

*
x = 10
if x > 10:
print("Greater")
elif x == 10:
print("Equal")
else:
print("Smaller")

*2. What will be printed by the following code?*


x = 20
y = 15
if x > y:
print("x is greater")
elif x == y:
print("x is equal to y")
else:
print("y is greater")

*3. What will happen if no condition in the if-elif-else ladder is true and there is no else block?*

A) An error will occur


B) The program will crash
C) Nothing will happen
D) The first condition will be executed by default

*4. What will be the output of the following code?*

python
x=0
if x:
print("True")
else:
print("False")

*5. What will be the output of the following code?*


a = 10
b=6
print(a % b)

*6. What will be the output of the following code?*


print(3 * '5')

*7. What will be the output of the following code?*


a = True
b = False
print(a and b)

*8. What will be the output of the following code?*


a=7
print(a >> 1)

*9.Which of the following is the comparison operator in Python?*


a) =
b) ==
c) !=
d) Both b) and c)

You might also like