We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
112923, 1122. AM Python Quiz
Python Qu
1, What is the output of the following code?
Z
rint(x, y)
a3s
b.53
6.23
32
2. What is the output of the following code?
a=10
b=5
caas/b
d-a%b
print(c, d)
a. 105
b. 102
52
20
3. What is the output of the following code?
x=5
y= ie
xay
y= 20
print(x)
as
b.10
€.20
None
4, What is the output of the following code snippet?
is greater")
print("y is greater")
a. xis greater
b. y is greater
cc. Error
{ie:C:/Users/eunivOneDrve/Desktoplsuniindex html
18112923, 1122. AM Python Quiz
4. None
5. What will be the output of the given code?
sum = @
for i in range(1, 6):
sum +2 i
print (sum)
a15S
b.10
oS
4.30
6. What will be the output of the given code?
count = @
while count < 5:
print(count)
count += 1
a 01234
b.12345
6.012345
d. Error
7. What will be the output of the given code if x ~ 10?
x=10
if x > 5:
print ("x is greater than 5")
elit x
print ("x is equal to S*)
else
print("x is less than $")
a. x is greater than 5
b. x is equal to 5
cc, xis less than 5
Error
8, Which of the following data types in Python is mutable?
a. int
». float
c. tuple
list
9. Which of the following data types in Python is immutable?
a. set
b. diet
. list
di str
10. Which of the following operations can be performed on immutable objects?
a. Appending new elements
b. Removing elements
c. Modifying elements
. None of the above
11, What happens when you assign a new value to an existing variable of an immutable data
type?
‘oi: UsersieunvOneDrvelDesktoplsunitindex hin! 20112923, 1122. AM Python Quiz
a. The existing object is modified with the new value.
b. A new object is created with the new value and assigned to the variable.
c. An error occurs as you cannot assign a new value to an existing variable of an
immutable data type.
4. None of the above.
12. Consider the following code:
ay_list = (1, 2, 3]
new_list = my list
new list. append(4)
print(my list)
What will be the output of the above code?
3]
3,4]
3,3,4]
ve
Be
{ie:C:/Users/eunivOneDrve/Desktoplsuniindex html 33