Question Bank - Full Course Final Examination Jan 2025
Question Bank - Full Course Final Examination Jan 2025
S NAGAR, LUDHIANA
INFORMATICS PRACTICES – CLASS XI
QUESTION BANK FOR FINAL EXAMINATION – JANUARY 2025
PYTHON
1. Write coding statements for the following:
a) Check whether substring ‘put’ occurs in string ‘putting’
b) Check whether value 10 occurs in list L
c) Check whether value 23.5 occurs in a tuple T. Display “yes” if it does and “no” if it does not.
d) A loop to display all values in list L one by one.
e) Considering a list L that contains [23,12,6,4,8,14,9] display the double of even numbers from it.
2. What will be the output of the following statements?
a) print(25 in [1,6,3,2])
b) print(True in [1,2,3,4])
c) print(False in [0,3,2,1])
d) print(‘Sad’ not in ‘Sadness’)
e) print('‘sad’ in ‘Sadness’)
f) if 12 not in (10,56,12,3):
print(“yes”)
else:
print(“no”)
g) print(‘abc’ not in [3,5,True,2.4,’xyz’))
h) for x in ‘super’:
print(x, end = “@”)
i) for ch in ‘tumult’:
if ch != ‘u’:
print(ch, sep = ‘:’)
j) List1 = [2,5,8,11,12]
for T in List1:
print(T*2)
k) P = (2,15,7,18,1,9)
for A in P:
if A%3 == 0:
print(A)
l) S = “Assignment 24-08-2024”
for x in S:
if x > =‘0’ and x<= ‘9’:
print(x, “ is a digit”)
3. Consider the following code snippets and predict their output:
i)
a=7
b = 14
c = 21
if a < b and b < c:
if c % b == 0:
result = "Divisible"
else:
result = "Not divisible"
elif a == b:
result = "Equal"
else:
result = "None of the above"
print(result)
ii)
x=3
y=6
z=9
if x < y:
if y < z:
if z % x == 0:
print("Condition A")
else:
print("Condition B")
else:
print("Condition C")
else:
print("Condition D")
iii)
x=2
y=4
z=6
if x < y and y < z:
if x != 2 or z > 5:
print("Pass")
else:
print("Fail")
else:
print("Out of range")
iv)
a = 10
b = 20
c = 30
if (a < b and b < c) or (a == 10 and c > 25):
print("Valid")
else:
print("Invalid")
4. Evaluate the following logical expressions, using the value of the given variables, indicating sequence of steps
required.
a = 12, b = 4, c = 7, d =3 , e = 5
i) d+e*b < (c+d)*12 or not( a-c != e) and c-d !=b
ii) c/b <= d or not( b+d*c > a//d) and a%c == c-b**2
iii) c-b != a//d and (a+c)/e == d or b+c*d != d*d and not(a%b == d)
5. What will be the values generated as a result of the following range() functions.
a) A = list((range(30,-5,-8))
b) B = list(range(1,10,3))
6. Write the output of the following codes:
a)
X,Y = 1,15
while(X<=Y):
print(X+Y,end =”#“)
X+=1
Y-=2
b)
for a in range(1,15,3):
print(a, end = “ “)
d) for x in range(100,10,-10):
print(x*x, sep = ‘,’)
e) c= 1
for ch in ‘tumult’:
if ch == ‘u’:
c = c+1
print(ch, sep = ‘:’)
print(c)
f)
a=0
while a<100:
a+=2
print(a)
g)
for x in range(2,-5,-1):
print(x, end = ‘,’)
h)
a,b = 1, 10
while a<10:
if (a+b)%2 == 1:
print(a*b)
a=a+1
b=b-2
k) S = “Good”
L = [“a”,3,4.5]
print(“S”*3)
print(L*2)
print(L+[10,20])
print(S+L)
l) for a in (2,11,12,50,23):
if a%5==0:
break
else:
print(a%5)
m) S = “Good”
L = list(range(10,50,5))
print(L)
L[1:4] = [‘abc’, ‘xyz’]
print(L)
S[0:2] – “Fo”
print(S)
7. Rewrite the following code using for loop.
A=1
while A<=100:
print(A)
A = A+5
8. Rewrite following code using while loop
P=1
for x in range(11, 1, -1):
P = P*x
print(P)
9. Write two different statements to create an empty list.
10. Write a code to accept starting no, ending no, and the difference and create a list with the generated
numbers using the range() function.
11. What is a sequence and name three types of sequences in Python
12. What is meant by immutable and mutable properties of strings and lists? Explain with the help of an
example.
13. Given the following list, write the output of the given statements:
L = [109.25, 17,'Extreme', 67, True, 'Mystery', 1, 20, False,25, 56]
print(L[2:8:2])
print(L[2:])
print(L[:])
print(L[5:1:-3])
print(L[7:3:-2])
print(L[ : : -1])
print(L[-2:3])
print(L[-3:3:-1])
print(L[-1:4:-2])
print(L[ :3])
14. Write outputs of the following Python statements considering the given sequence:
S = 'ABCDEFGHIJKLMNOP'
print(S[1:5])
print(S[6:2:-2])
print(S[5:12:2])
print(S[-3:-7:-1])
print(S[-14:-9:1])
print(S[-4:8])
print(S[-4:8:-3])