SLIP TEST - 2 (Python Revision Tour-1)
SLIP TEST - 2 (Python Revision Tour-1)
SLIP TEST – 2
SUB: COMPUTER SCIENCE (083) MARKS : 20
DATE : 13.3.2025 TIME : 50 Mts
SNO QUESTIONS MARKS
1. Evaluate the following expressions: 3
(a) 5 // 10 * 9 % 3 ** 8 + 8 – 4
(b) 65 > 55 or not 8 < 5 and 0 != 55
(c) print(15.0/4+(8*3.0))
2. a) Mona has written a code to input a positive integer and display all 1+1
its even factors in descending order. Her code is having errors.
Rewrite the correct code and underline the corrections made.
n=input("Enter a positive integer: ")
for i in range(n):
if i%2
if n%i==0:
print i,end=' '
b) Find error in the following code (if any) and correct code by
rewriting code and underline the correction;‐
x= int(“Enter value of x:”)
for in range [0,10]:
if x=y
Print( x + y)
else:
print (x‐y)
3. (i) Find the output generated by the following code: 2+2
a=5
b=10
a+=a+b
b*=a+b print(a,b)
(ii)Answer the following questions from the following code:
num_list=["One","Two","Three","Four"]
for c in num_list:
print(c)
1. What will be the output of the above code?
2. How many times the loop executed?
4. Predict the output of the following: 2
X=3
Y=5
Z = -2
X *= Y + Z
Y -= X * 2 + Y
Z += X + Y
print(X, Y, Z)
5. V, W, X = 12, 5, 7 1
W, V, X = X-2, V+3, W*2.
print(X,V,W)
6. Predict the output of the following: 2
P,S=1,0
for X in range(-5,15,5):
P*=X
S+=X
if S==0:
break
else:
print(P, "#", S)
7. Predict the output of the following: 1
N=5
C=1
while (C < 8):
if(C==3 or C==5):
C+=1
continue
print(C,'*',N,'=',C*N)
C+=1
8. Rewrite the following code after Convert the following into while loop:- 2
a) for x in range(0,15,2):
print(x*2)
b) for r in range(25,0,-5):
print(r)
9. Write a python program o check whether the entered number is Armstrong or not. 2
10. Evaluate the following expression: - False and bool(15/5*10/2+1) 1