65 questions from CBSE board, sample and compartment papers (2024–2027), 1 to 3 marks, each with a model answer. Questions on strings, lists, tuples and dictionaries: slicing and indexing, built-in methods such as split(), find(), index(), insert(), remove() and update(), mutable and immutable types, and predicting the output of code that uses them. Programming answers open in the Python Lab.
Python Revision Tour II· 1 Mark· Q10· 2024 Board Paper Python
Select the correct output of the following code:
event="G20 Presidency@2023"
L=event.split(' ')
print(L[::-2])
(A)'G20'
(B)['Presidency@2023']
(C)['G20']
(D)'Presidency@2023'
Model answer
(b) ['Presidency@2023']
Explanation: L is ['G20', 'Presidency@2023']. Slicing with step -2 starts at index -1 ('Presidency@2023') and stops since index -3 is out of range. Result is ['Presidency@2023'].
Python Revision Tour II· 1 Mark· Q18· 2024 Board Paper
Assertion (A): The expression "HELLO".sort() in Python will give an error.
Reason (R): sort() does not exist as a method/function for strings in Python.
Mark the correct choice as:
(A)Both (A) and (R) are true and (R) is the correct explanation for (A).
(B)Both (A) and (R) are true and (R) is not the correct explanation for (A).
(C)(A) is true but (R) is false.
(D)(A) is false but (R) is true.
Model answer
(a) Both (A) and (R) are true and (R) is the correct explanation for (A).
Explanation: Strings in Python do not have a sort() method (sort() is for mutable lists). Attempting to call it raises an AttributeError, so (R) correctly explains (A).
Python Revision Tour II· 2 Marks· Q22· 2024 Board Paper Python
Write the output displayed on execution of the following Python code:
LS=["HIMALAYA", "NILGIRI", "ALASKA", "ALPS"]
D={}
for S in LS :
if len(S)%4 == 0:
D[S] = len(S)
for K in D :
print(K,D[K], sep = "#")
Model answer
HIMALAYA#8
ALPS#4
Explanation: Lengths: HIMALAYA (8, 8%4==0 -> added), NILGIRI (7), ALASKA (6), ALPS (4, 4%4==0 -> added). Iterating over D prints HIMALAYA#8 and ALPS#4.
LS=["HIMALAYA", "NILGIRI", "ALASKA", "ALPS"]
D={}
for S in LS :
if len(S)%4 == 0:
D[S] = len(S)
for K in D :
print(K,D[K], sep = "#")
Python Revision Tour II· 2 Marks· Q23· 2024 Board Paper Python
(A) Write the Python statement for each of the following tasks using built-in functions/methods only:
(i) To remove the item whose key is "NISHA" from a dictionary named Students.
For example, if the dictionary Students contains {"ANITA":90, "NISHA":76, "ASHA":92}, then after removal the dictionary should contain {"ANITA":90, "ASHA":92}
(ii) To display the number of occurrences of the substring "is" in a string named message.
For example if the string message contains "This is his book", then the output will be 3.
OR
(B) A tuple named subject stores the names of different subjects. Write the Python commands to convert the given tuple to a list and thereafter delete the last element of the list.
Model answer
(A)
(i) Students.pop("NISHA") # or: del Students["NISHA"]
(ii) print(message.count("is"))
OR
(B)
subject_list = list(subject)
subject_list.pop() # or: del subject_list[-1]
# Part A Demonstration
Students = {"ANITA": 90, "NISHA": 76, "ASHA": 92}
Students.pop("NISHA")
print("Dictionary after pop:", Students)
message = "This is his book"
print("Count of 'is':", message.count("is"))
Python Revision Tour II· 3 Marks· Q26· 2024 Board Paper Python
Write the output on execution of the following Python code:
S="Racecar Car Radar"
L=S.split()
for W in L :
x=W.upper()
if x==x[::-1]:
for I in x:
print(I,end="*")
else:
for I in W:
print(I,end="#")
print()
Model answer
R*A*C*E*C*A*R*
C#a#r#
R*A*D*A*R*
Explanation: 'Racecar' is a palindrome in uppercase -> printed with '*'. 'Car' is not a palindrome -> printed from W with '#'. 'Radar' is a palindrome -> printed with '*'.
S="Racecar Car Radar"
L=S.split()
for W in L :
x=W.upper()
if x==x[::-1]:
for I in x:
print(I,end="*")
else:
for I in W:
print(I,end="#")
print()
Python Revision Tour II· 1 Mark· Q1· 2025 Board Paper
State True or False:
"A Python List must always contain all its elements of same data type."
Model answer
False
Explanation: Python lists are heterogeneous.
Python Revision Tour II· 1 Mark· Q3· 2025 Board Paper Python
Identify the correct output of the following code snippet:
game="Olympic2024"
print(game.index("C"))
(A)0
(B)6
(C)-1
(D)ValueError
Model answer
(D) ValueError
Explanation: index() is case sensitive. "Olympic2024" has a small c but no capital C, so index("C") raises ValueError.
game="Olympic2024"
print(game.index("C"))
Python Revision Tour II· 1 Mark· Q6· 2025 Board Paper Python
Consider the statements given below and then choose the correct output from the given options:
L=['TIC', 'TAC']
print(L[::-1])
(A)['CIT', 'CAT']
(B)['TIC', 'TAC']
(C)['CAT', 'CIT']
(D)['TAC', 'TIC']
Model answer
['TAC', 'TIC']
L = ['TIC', 'TAC']
print(L[::-1])
Python Revision Tour II· 1 Mark· Q8· 2025 Board Paper Python
Consider the statements given below and then choose the correct output from the given options:
D={'S01':95, 'S02':96 }
for I in D :
print(I,end='#')
(A)S01#S02#
(B)95#96#
(C)S01,95#S02,96#
(D)S01#95#S02#96#
Model answer
S01#S02#
Explanation: Iterating over a dictionary yields its keys.
D = {'S01':95, 'S02':96}
for I in D:
print(I, end='#')
Python Revision Tour II· 1 Mark· Q12· 2025 Board Paper
Which of the following built-in function/method returns a dictionary?
(A)dict()
(B)values()
(C)keys()
(D)items()
Model answer
dict()
Explanation: dict() creates a dictionary.
Python Revision Tour II· 2 Marks· Q24· 2025 Board Paper Python
Consider the following dictionaries, D and D1:
D={"Suman": 40, "Raj":55, "Raman":60}
D1={"Aditi":30, "Amit":90,"Raj":20}
(Answer using built-in Python functions only)
(i) (a) Write a statement to display/return the value corresponding to the key "Raj" in the dictionary D.
OR
(b) Write a statement to display the length of the dictionary D1.
(ii) (a) Write a statement to append all the key-value pairs of the dictionary D to the dictionary D1.
OR
(b) Write a statement to delete the item with the given key "Amit" from the dictionary D1.
D = {'Suman': 40, 'Raj': 55, 'Raman': 60}
D1 = {'Aditi': 30, 'Amit': 90, 'Raj': 20}
# (i)
print(D.get('Raj'))
# (ii)
print(len(D1))
# (iii)
D1.update(D)
print(D1)
# (iv)
if 'Amit' in D1:
del D1['Amit']
print(D1)
Python Revision Tour II· 3 Marks· Q31· 2025 Board Paper Python
Predict the output of the following code:
def ExamOn(mystr):
newstr = ""
count = 0
for i in mystr:
if count%2 != 0:
newstr = newstr + str(count-1)
else:
newstr = newstr + i.lower()
count += 1
newstr = newstr + mystr[:2]
print("The new string is:", newstr)
ExamOn("GenX")
Model answer
The new string is: g0n2Ge
Explanation: G gives g (count 0), e gives 0 (count 1), n gives n (count 2), X gives 2 (count 3), so newstr is 'g0n2'. Then mystr[:2] adds 'Ge'.
def ExamOn(mystr):
newstr = ""
count = 0
for i in mystr:
if count % 2 != 0:
newstr = newstr + str(count-1)
else:
newstr = newstr + i.lower()
count += 1
newstr = newstr + mystr[:2]
print("The new string is:", newstr)
ExamOn("GenX")
Python Revision Tour II· 3 Marks· Q31· 2025 Board Paper Python
Write the output on execution of the following Python code:
def Change(X):
for K,V in X.items():
L1.append(K)
L2.append(V)
D={1:"ONE",2:"TWO",3:"THREE"}
L1=[]
L2=[]
Change(D)
print(L1)
print(L2)
print(D)
Explanation: The function iterates over dictionary D using items(). Keys are appended to list L1 and values are appended to list L2. The dictionary D remains unchanged.
def Change(X):
for K, V in X.items():
L1.append(K)
L2.append(V)
D = {1: 'ONE', 2: 'TWO', 3: 'THREE'}
L1 = []
L2 = []
Change(D)
print(L1)
print(L2)
print(D)
Python Revision Tour II· 1 Mark· Q2· 2026 Board Paper Python
Identify the output of the following code snippet:
s = "the Truth"
print(s.capitalize())
(A)The truth
(B)THE TRUTH
(C)The Truth
(D)the Truth
Model answer
The truth
Explanation: The capitalize() method converts the first character of a string to uppercase and makes all other characters lowercase.
s = "the Truth"
print(s.capitalize())
Python Revision Tour II· 1 Mark· Q4· 2026 Board Paper Python
What is the output of the following code snippet?
s = 'War and Peace by Leo Tolstoy'
print(s.partition("by"))
(A)('War and Peace ', 'by', ' Leo Tolstoy')
(B)['War and Peace ', 'by', ' Leo Tolstoy']
(C)('War and Peace ', ' Leo Tolstoy')
(D)['War and Peace ', ' Leo Tolstoy']
Model answer
('War and Peace ', 'by', ' Leo Tolstoy')
Explanation: The partition() method splits a string at the first occurrence of the separator and returns a tuple containing three elements: the part before the separator, the separator itself, and the part after.
s = 'War and Peace by Leo Tolstoy'
print(s.partition("by"))
Python Revision Tour II· 1 Mark· Q5· 2026 Board Paper Python
What will be the output of the following statement?
print("PythonProgram"[-1:2:-2])
Model answer
mroPo
Explanation: Slicing starts from index -1 ('m') and moves backward with a step of -2 until it reaches index 2 (exclusive). Sequence: 'm' -> 'r' -> 'o' -> 'P' -> 'o'.
print("PythonProgram"[-1:2:-2])
Python Revision Tour II· 1 Mark· Q6· 2026 Board Paper Python
What will be the output of the following code snippet?
t = tuple('tuple')
t2 = t[2],
t += t2
print(t)
(A)('tuple')
(B)('tuple', 'p')
(C)('t', 'u', 'p', 'l', 'e', 'p')
(D)('t', 'u', 'p', 'l', 'e')
Model answer
('t', 'u', 'p', 'l', 'e', 'p')
Explanation: tuple('tuple') creates ('t', 'u', 'p', 'l', 'e'). t[2] is 'p', making t2 a single-element tuple ('p',). Adding them concatenates the tuples. Note: The official board paper had a typo showing '1' instead of 'l', but 'l' is computationally correct.
t = tuple('tuple')
t2 = t[2],
t += t2
print(t)
Python Revision Tour II· 1 Mark· Q7· 2026 Board Paper
Which of the following statements is true about dictionaries in Python?
(A)A dictionary is an example of sequence datatype.
(B)A dictionary cannot have two elements with same key.
(C)A dictionary cannot have two elements with same value.
(D)The key and value of an element cannot be the same.
Model answer
A dictionary cannot have two elements with same key.
Explanation: Dictionary keys must be unique. If a duplicate key is assigned, the new value overwrites the old one.
Python Revision Tour II· 1 Mark· Q8· 2026 Board Paper Python
If L is a list with 6 elements, then which of the following statements will raise an exception?
(A)L.pop(1)
(B)L.pop(6)
(C)L.insert(1, 6)
(D)L.insert(6, 1)
Model answer
L.pop(6)
Explanation: Indices in a 6-element list range from 0 to 5. Attempting to pop at index 6 raises an IndexError. However, insert(6, 1) does not raise an error; it simply appends at the end if the index is out of bounds.
L = [10, 20, 30, 40, 50, 60]
try:
L.pop(6)
except IndexError as e:
print("Error:", e)
Python Revision Tour II· 1 Mark· Q20· 2026 Board Paper
Assertion (A): [1, 2, 3] + '123' is an invalid expression in Python.
Reason (R): In Python, a list cannot be concatenated with a string.
Model answer
Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).
Explanation: The + operator expects identical iterable types. You cannot concatenate a list and a string directly.
Python Revision Tour II· 2 Marks· Q23· 2026 Board Paper Python
Write a Python statement to perform the following tasks: (USE BUILT_IN FUNCTIONS/METHODS ONLY)
(i) To create a new list L1 containing the elements of list L arranged in ascending order, without modifying list L.
(ii) A statement to check whether the given character, ch is an alphabet or a number.
# (i) Create sorted list without modifying original
L = [5, 2, 9, 1]
L1 = sorted(L)
print("Original:", L, "New:", L1)
# (ii) Check if character is alphanumeric
ch = '7'
print(f"Is '{ch}' alphanumeric?", ch.isalnum())
Python Revision Tour II· 2 Marks· Q24· 2026 Board Paper Python
Assuming that D1 is a dictionary in Python,
(i) (a) Write a Python expression to check if the key, 'RNo' is present in D1. OR (b) Write a Python expression to check if any key in D1 has a value 12.
(ii) (a) Write a single statement using a BUILT_IN function to add the key: value pair 'RNo': 12, if the key 'RNo' is not present in D1. However, if the key 'RNo' is present, the function should return its value. OR (b) Write a single statement to delete all the elements from D1.
D1 = {'Name': 'Amit', 'Age': 17}
# (i)(a) Check if key exists
print("Is RNo present?", 'RNo' in D1)
# OR (i)(b) Check if value 12 exists
print("Is value 12 present?", 12 in D1.values())
# (ii)(a) Add key or return value if present
print("Returned Value:", D1.setdefault('RNo', 12))
print("Updated D1:", D1)
# OR (ii)(b) Clear dictionary
D1.clear()
print("Cleared D1:", D1)
Python Revision Tour II· 3 Marks· Q31· 2026 Board Paper Python
(a) Write output: def Exam2026(given): new=[]; for ch in given[1:-1]: if ch.isupper(): new.reverse() elif ch not in new: new.append(ch) elif ch in new: new.pop(); print(new); Exam2026("Gold-24Medals")
OR (b) Write output: def Exam2026(given): new=0; while given: if new%2: new+=given%10 else: new+=given%5; print(new,end='-'); given//=10; Exam2026(123456)
Explanation: In (a), processing 'old-24Medal': lowercase and digits get appended. Duplicates cause a pop. Uppercase 'M' reverses the list. Note: The exact MS showed a '1' instead of 'l', but 'l' is the correct programmatic output.
In (b), modular arithmetic builds the new integer sequentially.
def Exam2026_A(given):
new = []
for ch in given[1:-1]:
if ch.isupper():
new.reverse()
elif ch not in new:
new.append(ch)
elif ch in new:
new.pop()
print(new)
def Exam2026_B(given):
new = 0
while given:
if new % 2:
new += given % 10
else:
new += given % 5
print(new, end='-')
given //= 10
Exam2026_A("Gold-24Medals")
print()
Exam2026_B(123456)
Python Revision Tour II· 1 Mark· Q1· 2025 Compartment Paper
State if following statement is True or False:
If T is a tuple and L is a list, then T+L is a valid statement in Python.
Model answer
False
Explanation: You cannot concatenate a tuple and a list directly using the + operator in Python. They must be of the same data type.
Python Revision Tour II· 1 Mark· Q2· 2025 Compartment Paper Python
Identify the output of the following code segment:
s = "an apple. a toy."
s = s.find('a', 2)
print(s)
(A)0
(B)1
(C)3
(D)'a'
Model answer
3
Explanation: The find('a', 2) method searches for the first occurrence of 'a' starting from index 2. The character 'a' is located at index 0, 3, and 10. The first one after index 2 is at index 3 ('apple').
s = "an apple. a toy."
s = s.find('a', 2)
print(s)
Python Revision Tour II· 1 Mark· Q4· 2025 Compartment Paper Python
What is the output of the following expression?
Sports="Paralympic Games"
print(Sports.split("m"))
(A)['Paraly', 'm', 'pic Ga', 'm','es']
(B)('Paraly', 'm', 'pic Games')
(C)('Paraly', 'pic Ga','es')
(D)['Paraly', 'pic Ga','es']
Model answer
['Paraly', 'pic Ga','es']
Explanation: The split('m') method breaks the string into a list at every occurrence of the character 'm', removing the 'm's in the process.
Python Revision Tour II· 1 Mark· Q5· 2025 Compartment Paper Python
What will be the output of the following code segment?
p = list("Session 2024-25")
print(p[10:20:])
Model answer
['2', '4', '-', '2', '5']
Explanation: The string is converted to a list of characters. Slicing p[10:20:] extracts elements from index 10 to the end.
p = list("Session 2024-25")
print(p[10:20:])
Python Revision Tour II· 1 Mark· Q6· 2025 Compartment Paper
Which of the following is a mapped data type?
(A)List
(B)Sets
(C)Dictionary
(D)Boolean
Model answer
Dictionary
Explanation: A Dictionary is a mapped data type in Python because it maps keys to specific values.
Python Revision Tour II· 1 Mark· Q7· 2025 Compartment Paper
If the dictionary D1 is defined as: D1={1:'a', 2:'b'}, then which of the following statements is incorrect and hence will result in an error?
(A)D1.get(1)
(B)D1.get(3)
(C)D1.del(1)
(D)D1.clear()
Model answer
D1.del(1)
Explanation: To delete an element from a dictionary using its key, the correct syntax is 'del D1[1]'. Dictionaries do not have a built-in method named .del().
Python Revision Tour II· 1 Mark· Q8· 2025 Compartment Paper
Which of the following list methods accepts exactly 2 parameters?
(A)append()
(B)extend()
(C)insert()
(D)pop()
Model answer
insert()
Explanation: The insert() method takes exactly two arguments: insert(index, element).
Python Revision Tour II· 2 Marks· Q24· 2025 Compartment Paper Python
Assuming that D1 and D2 are Python dictionaries. Write statements using built-in functions:
(I)(a) Delete all elements of D1 OR (b) Generate a list of values of D1.
(II)(a) Update dictionary D2 with elements of D1 OR (b) Generate a tuple of keys of D2.
Python Revision Tour II· 3 Marks· Q31· 2025 Compartment Paper Python
(a) Write the output on execution of the following Python code:
P = [3, 5, 7, 4]
P.insert(2, 3)
P.extend([10, 6])
print(P)
print(P.index(7))
print(P[::2])
OR (b) Output of the ALTER function execution.
Model answer
[3, 5, 3, 7, 4, 10, 6]
3
[3, 3, 4, 6]
Explanation: insert(2,3) places '3' at index 2. P becomes [3, 5, 3, 7, 4]. extend adds [10, 6]. index(7) returns the position of 7. P[::2] slices the list starting from 0, picking every 2nd element.
Python Revision Tour II· 1 Mark· Q4· 2024 Sample Paper Python
Select the correct output of the code:
s = "Python is fun"
l = s.split()
s_new = "-".join([l[0].upper(), l[1], l[2].capitalize()])
print(s_new)
(A)a. PYTHON-IS-Fun
(B)b. PYTHON-is-Fun
(C)c. Python-is-fun
(D)d. PYTHON-Is -Fun
Model answer
Option b
PYTHON-is-Fun
Explanation: l[0].upper() is 'PYTHON', l[1] is 'is', l[2].capitalize() is 'Fun'. Joined by '-' produces 'PYTHON-is-Fun'.
s = "Python is fun"
l = s.split()
s_new = "-".join([l[0].upper(), l[1], l[2].capitalize()])
print(s_new)
Python Revision Tour II· 1 Mark· Q7· 2024 Sample Paper
Which of the following will delete key-value pair for key = “Red” from a dictionary D1?
(A)a. delete D1("Red")
(B)b. del D1["Red"]
(C)c. del.D1["Red"]
(D)d. D1.del["Red"]
Model answer
Option b
del D1["Red"]
Explanation: The 'del' keyword followed by dict[key] deletes the corresponding key-value pair.
Python Revision Tour II· 1 Mark· Q8· 2024 Sample Paper Python
Consider the statements given below and then choose the correct output from the given options:
pride="#G20 Presidency"
print(pride[-2:2:-2])
(A)a. ndsr
(B)b. ceieP0
(C)c. ceieP
(D)d. yndsr
Model answer
Option b
ceieP0
Explanation: pride[-2:2:-2] slices backwards with step -2 from index -2 ('c') down to index > 2, giving characters: 'c', 'e', 'i', 'e', 'P', '0'.
pride="#G20 Presidency"
print(pride[-2:2:-2])
Python Revision Tour II· 1 Mark· Q9· 2024 Sample Paper
Which of the following statement(s) would give an error during execution of the following code?
tup = (20,30,40,50,80,79)
print(tup) #Statement 1
print(tup[3]+50) #Statement 2
print(max(tup)) #Statement 3
tup[4]=80 #Statement 4
(A)a. Statement 1
(B)b. Statement 2
(C)c. Statement 3
(D)d. Statement 4
Model answer
Option d
Statement 4
Explanation: Tuples in Python are immutable; item assignment raises a TypeError.
Python Revision Tour II· 2 Marks· Q22· 2024 Sample Paper Python
Predict the output of the following code:
S = "LOST"
L = [10,21,33,4]
D={}
for I in range(len(S)):
if I%2==0:
D[L.pop()] = S[I]
else:
D[L.pop()] = I+3
for K,V in D.items():
print(K,V,sep="*")
Model answer
4*L
33*4
21*S
10*6
S = "LOST"
L = [10,21,33,4]
D={}
for I in range(len(S)):
if I%2==0:
D[L.pop()] = S[I]
else:
D[L.pop()] = I+3
for K,V in D.items():
print(K,V,sep="*")
Python Revision Tour II· 2 Marks· Q23· 2024 Sample Paper Python
Write the Python statement for each of the following tasks using BUILT-IN functions/methods only:
(i) To insert an element 200 at the third position, in the list L1.
(ii) To check whether a string named, message ends with a full stop / period or not.
OR
A list named studentAge stores age of students of a class. Write the Python command to import the required module and (using built-in function) to display the most common age value from the given list.
Model answer
(i) L1.insert(2,200)
(ii) message.endswith('.')
OR
import statistics
print( statistics.mode(studentAge) )
Python Revision Tour II· 3 Marks· Q26· 2024 Sample Paper Python
Predict the output of the Python code given below:
Text1="IND-23"
Text2=""
I=0
while I<len(Text1):
if Text1[I]>="0" and Text1[I]<="9":
Val = int(Text1[I])
Val = Val + 1
Text2=Text2 + str(Val)
elif Text1[I]>="A" and Text1[I]<="Z":
Text2=Text2 + (Text1[I+1])
else:
Text2=Text2 + "*"
I+=1
print(Text2)
Model answer
ND-*34
Text1="IND-23"
Text2=""
I=0
while I<len(Text1):
if Text1[I]>="0" and Text1[I]<="9":
Val = int(Text1[I])
Val = Val + 1
Text2=Text2 + str(Val)
elif Text1[I]>="A" and Text1[I]<="Z":
Text2=Text2 + (Text1[I+1])
else:
Text2=Text2 + "*"
I+=1
print(Text2)
Python Revision Tour II· 1 Mark· Q2· 2025 Sample Paper Python
Identify the output of the following code snippet:
text = "PYTHONPROGRAM"
text=text.replace('PY','#')
print(text)
(A)#THONPROGRAM
(B)##THON#ROGRAM
(C)#THON#ROGRAM
(D)#YTHON#ROGRAM
Model answer
#THONPROGRAM
Explanation: replace('PY', '#') replaces the first occurrence of 'PY' with '#'.
text = "PYTHONPROGRAM"
text = text.replace('PY', '#')
print(text)
Python Revision Tour II· 1 Mark· Q4· 2025 Sample Paper Python
What is the output of the expression?
country='International'
print(country.split("n"))
(A)('I', 'ter', 'atio', 'al')
(B)['I', 'ter', 'atio', 'al']
(C)['I', 'n', 'ter', 'n', 'atio', 'n', 'al']
(D)Error
Model answer
['I', 'ter', 'atio', 'al']
Explanation: Splits the string at every 'n'.
country='International'
print(country.split('n'))
Python Revision Tour II· 1 Mark· Q5· 2025 Sample Paper Python
What will be the output of the following code snippet?
message= "World Peace"
print(message[-2::-2])
Model answer
ce lo
Explanation: Starts at 'c' (index -2), moves backward with step 2.
message = "World Peace"
print(message[-2::-2])
Python Revision Tour II· 1 Mark· Q6· 2025 Sample Paper Python
What will be the output of the following code?
tuple1 = (1, 2, 3)
tuple2 = tuple1
tuple1 += (4,)
print(tuple1 == tuple2)
(A)True
(B)False
(C)tuple1
(D)Error
Model answer
False
Explanation: Tuples are immutable. Adding to tuple1 creates a new object; tuple2 still points to the old one.
Python Revision Tour II· 1 Mark· Q7· 2025 Sample Paper Python
If my_dict is a dictionary as defined below, then which of the following statements will raise an exception?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
(A)my_dict.get('orange')
(B)print(my_dict['apple', 'banana'])
(C)my_dict['apple']=20
(D)print(str(my_dict))
Model answer
(B) print(d['a','b'])
Explanation: Dictionary keys are single elements. Accessing multiple keys like a tuple without definition causes a KeyError.
d = {'a':1, 'b':2}
try:
print(d['a','b'])
except Exception as e:
print(e)
Python Revision Tour II· 1 Mark· Q8· 2025 Sample Paper
What does the list.remove(x) method do in Python?
(A)Removes the element at index x from the list
(B)Removes the first occurrence of value x from the list
(C)Removes all occurrences of value x from the list
(D)Removes the last occurrence of value x from the list
Model answer
Removes the first occurrence of value x
Explanation: It searches for x and removes the first match found.
Python Revision Tour II· 2 Marks· Q24· 2025 Sample Paper Python
If L1=[1,2,3,2,1,2,4,2, . . . ], and L2=[10,20,30, . . .], then (Answer using builtin functions only)
(I)
A) Write a statement to count the occurrences of 4 in L1.
OR
B) Write a statement to sort the elements of list L1 in ascending order.
(II)
A) Write a statement to insert all the elements of L2 at the end of L1.
OR
B) Write a statement to reverse the elements of list L2.
L1 = [1, 2, 3, 2, 1, 2, 4, 2]
L2 = [10, 20, 30]
print(L1.count(4)) # (I) A
L1.sort() # (I) B
L1.extend(L2) # (II) A
L2.reverse() # (II) B
print(L1, L2)
Python Revision Tour II· 3 Marks· Q31· 2025 Sample Paper Python
Predict the output of the following code:
d = {"apple": 15, "banana": 7, "cherry": 9}
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + "\n"
str2 = str1[:-1]
print(str2)
OR
Predict the output of the following code:
line=[4,9,12,6,20]
for I in line:
for j in range(1,I%5):
print(j,'#',end="")
print()
Explanation: Option A: str1[:-1] removes only the last newline. Option B: range(1, I%5) gives 1 to 3 for 4 and 9, 1 for 12, and nothing for 6 and 20, but print() still ends each line.
d = {"apple": 15, "banana": 7, "cherry": 9}
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + "\n"
str2 = str1[:-1]
print(str2)
Python Revision Tour II· 1 Mark· Q2· 2026 Sample Paper Python
What will be the output of the following code?
L = ["India", "Incredible", "Bharat"]
print(L[1][0] + L[2][-1])
(A)IT
(B)it
(C)It
(D)iT
Model answer
It
Explanation: L[1] is 'Incredible', index [0] is 'I'. L[2] is 'Bharat', index [-1] is 't'. 'I' + 't' = 'It'.
L = ["India", "Incredible", "Bharat"]
print(L[1][0] + L[2][-1])
Python Revision Tour II· 1 Mark· Q5· 2026 Sample Paper Python
What will be the output of the following Python code?
str= "Soft Skills"
print(str[-3::-3])
(A)lSf
(B)Stkl
(C)StKi
(D)l
Model answer
lSf
Explanation: Index -3 is 'l'. Stepping back by 3 gives 'l', 'S', 'f'.
str = "Soft Skills"
print(str[-3::-3])
Python Revision Tour II· 1 Mark· Q10· 2026 Sample Paper Python
What will be the output of the following Python code?
my_dict = {"name": "Alicia", "age": 27, "city": "DELHI"}
print(my_dict.get("profession", "Not Specified"))
(A)Alicia
(B)DELHI
(C)None
(D)Not Specified
Model answer
Not Specified
Explanation: The key 'profession' does not exist in the dictionary, so get() returns the default value provided.
Python Revision Tour II· 1 Mark· Q14· 2026 Sample Paper Python
What is the output of the given Python code?
st='Waterskiing is thrilling!'
print(st.split("i"))
(A)['Watersk', 'ng ', 's thr', 'll', 'ng!']
(B)['Watersk', '', 'ng ', 's thr', 'll', 'ng!']
(C)['Watersk', 'i', 'ng ', 's thr', 'll', 'ng!']
(D)Error
Model answer
['Watersk', '', 'ng ', 's thr', 'll', 'ng!']
st='Waterskiing is thrilling!'
print(st.split("i"))
Python Revision Tour II· 1 Mark· Q20· 2026 Sample Paper
Assertion (A): The expression (1, 2, 3, 4).append(5) in Python will modify the original sequence datatype.
Reason (R): The append() method adds an element to the end of a list and modifies the list in place.
(A)Both A and R are True and R is the correct explanation for A
(B)Both A and R are True and R is not the correct explanation for A
(C)A is True but R is False
(D)A is False but R is True
Model answer
A is False but R is True
Explanation: (1,2,3,4) is a tuple, which is immutable and does not have an append method. Lists do have append.
Python Revision Tour II· 2 Marks· Q24· 2026 Sample Paper Python
A. (Answer using Python built-in methods/functions only):
I. Write a statement to find the index of the first occurrence of the substring "good" in a string named review.
II. Write a statement to sort the elements of list L1 in descending order. 2025-26.
OR
B. Predict the output of the following Python code: text="Learn Python with fun and practice"
print(text.partition("with"))
print(text.count("a"))
# Part A
review = "This is a good movie"
print(review.find("good"))
L1 = [3, 1, 4]
L1.sort(reverse=True)
print(L1)
# Part B
text = "Learn Python with fun and practice"
print(text.partition("with"))
print(text.count("a"))
Python Revision Tour II· 2 Marks· Q26· 2026 Sample Paper Python
Predict the output of the Python code given below:
emp = {"Arv": (85000,90000),"Ria": (78000,88000),"Jay": (72000,80000),"Tia": (80000,70000)}
selected = [ ]
for name in emp:
salary = emp[name]
average = (salary[0] + salary[1]) / 2
if average > 80000:
selected.append(name)
print(selected)
Model answer
['Arv', 'Ria']
emp = {"Arv": (85000,90000), "Ria": (78000,88000), "Jay": (72000,80000), "Tia": (80000,70000)}
selected = []
for name in emp:
salary = emp[name]
average = (salary[0]+salary[1])/2
if average > 80000:
selected.append(name)
print(selected)
Python Revision Tour II· 3 Marks· Q31· 2026 Sample Paper Python
A. Predict the output of the following Python code:
s1="SQP-25"
s2=""
i=0
while i<len(s1):
if s1[i]>='0' and s1[i]<='9':
Num=int(s1[i])
Num-=1
s2=s2+str(Num)
elif s1[i]>='A' and s1[i]<='Z':
s2=s2+s1[i+1]
else:
s2=s2+'^'
i+=1
print(s2)
OR
B. Predict the output of the following Python code:
wildlife_sanctuary = ["Kaziranga", "Ranthambhore", "Jim Corbett", "Sundarbans", "Periyar", "Gir", "Bandipur"]
output = [ ]
for sanctuary in wildlife_sanctuary:
if sanctuary[-1] in 'aeiou':
output.append(sanctuary[0].upper())
print(output)
s1="SQP-25"
s2=""
i=0
while i<len(s1):
if s1[i]>='0' and s1[i]<='9':
Num=int(s1[i])
Num-=1
s2=s2+str(Num)
elif s1[i]>='A' and s1[i]<='Z':
s2=s2+s1[i+1]
else:
s2=s2+'^'
i+=1
print(s2)
Python Revision Tour II· 1 Mark· Q1· 2027 Sample Paper Python
Write the output on execution of the following Python code:
L1=[10,20,25,30]
L1.insert(1,15)
print(L1)
Model answer
[10, 15, 20, 25, 30]
L1=[10,20,25,30]
L1.insert(1,15)
print(L1)
Python Revision Tour II· 1 Mark· Q2· 2027 Sample Paper Python
What will be the output of the following expression?
Msg = "programming is amazing"
print(Msg.split("m"))
(A)['progra', '', 'ing is a', 'azing']
(B)['progra', 'ming is a', 'azing']
(C)('progra', '', 'ing is amazing')
(D)['program', 'ing is a', 'zing']
Model answer
a) ['progra', '', 'ing is a', 'azing']
Msg = "programming is amazing"
print(Msg.split("m"))
Python Revision Tour II· 1 Mark· Q5· 2027 Sample Paper
Consider the following Python code:
t = (1, 2, 3)
l = [4, 5]
print(t + l)
What will happen when this code is executed?
(A)[1, 2, 3, 4, 5]
(B)(1, 2, 3, 4, 5)
(C)Error, because a tuple cannot be concatenated with a list
(D)((1, 2, 3), [4, 5])
Model answer
c) Error, because a tuple cannot be concatenated with a list
Python Revision Tour II· 1 Mark· Q7· 2027 Sample Paper Python
Predict the output for the following:
Dl={"Pen":12, "Pencil":6, "Scale":5, "InkPen":20}
print(12 in Dl)
(A)False
(B)Error
(C)None
(D)True
Model answer
a) False
Dl={"Pen":12, "Pencil":6, "Scale":5, "InkPen":20}
print(12 in Dl)
Python Revision Tour II· 1 Mark· Q18· 2027 Sample Paper Python
What will be the output of the following Python code?
text = "Drone Expo"
print(text[-2: :-4])
Model answer
peD
text = "Drone Expo"
print(text[-2: :-4])
Python Revision Tour II· 2 Marks· Q23· 2027 Sample Paper Python
The Python program below tries to print the list in reverse. However, there are syntax and logical errors in the code.
Rewrite it after removing all the errors. Also, underline all the corrections made
words=["Class Test","Term Exams","Pre-board Exam","Board Exam']
L=len(words)
for i in range(L, -1, -1)
Print (words[i] , end = " ")
Model answer
words=["Class Test","Term Exams","Pre-board Exam","Board Exam"]
L=len(words)
for i in range(L-1, -1, -1):
print (words[i] , end = " ")
words=["Class Test","Term Exams","Pre-board Exam","Board Exam"]
L=len(words)
for i in range(L-1, -1, -1):
print (words[i] , end = " ")
Python Revision Tour II· 2 Marks· Q25· 2027 Sample Paper Python
A. (Answer using Python built-in methods/functions only):
I. Write a statement to check whether the string username starts with "admin".
II. Given data = [2, 7, 9, 9, 2], write a statement to count how many times the largest element occurs.
OR
B. Predict the output of the following Python code:
text = "Python Programming"
print(text.replace("o", "0"))
print(text.find("z"))
Model answer
A.
I. username.startswith("admin")
II. data.count(max(data))
OR
B.
Pyth0n Pr0gramming
-1
text = "Python Programming"
print(text.replace("o", "0"))
print(text.find("z"))
Python Revision Tour II· 2 Marks· Q26· 2027 Sample Paper Python
Predict the output of the following Python code:
code = "gLaD5"
result = []
i = 0
while i < len(code):
if code[i].isupper():
result.append(code[i].lower())
elif code[i].isdigit():
result.append(int(code[i]) * 2)
else:
result.append("#")
i += 1
print(result)
Model answer
['#', 'l', '#', 'd', 10]
code = "gLaD5"
result = []
i = 0
while i < len(code):
if code[i].isupper():
result.append(code[i].lower())
elif code[i].isdigit():
result.append(int(code[i]) * 2)
else:
result.append("#")
i += 1
print(result)