Python Revision Tour: Class 12 PYQs 2024–2026 with solutions
All 31 CBSE board questions asked from Python Revision Tour in 3 board papers, with the year, set and marks of each. 16 are solved free below. The Class 12 Computer Science PYQ Book: Solved Board Papers 2024-2026 (CBSE) has every solution, all chapters and 3 full board papers.
Python Revision Tour: board weightage
Board weightage 2024–2026
| Year | 2024 | 2025 | 2026 |
|---|---|---|---|
| Questions | 9 | 11 | 11 |
| Marks | 13 | 13 | 13 |
Most asked topics
31 questions from 3 papers. Repeated questions are shown once with every year they were asked.
1 mark: MCQ and Assertion–Reason
State True or False: In Python, data type of 74 is same as the data type of 74.0.
Solution
False. type(74) is int; type(74.0) is float.
s = "the Truth"; print(s.capitalize()) (A) The truth (B) THE TRUTH (C) The Truth (D) the Truth
Solution
(A) The truth. capitalize() makes the first character upper case and all others lower case.
Which expression evaluates to True? (A) 2>3 and 2<3 (B) 3>1 and 2 (C) 3>1 and 3>2 (D) 3>1 and 3<2
Solution
(C). True and True → True. (A) and (D) give False; (B) gives 2 (and returns its last operand), which is truthy but not the value True, so the scheme also accepted (B).
s='War and Peace by Leo Tolstoy'; print(s.partition("by"))
Solution
(A) ('War and Peace ', 'by', ' Leo Tolstoy'). partition() returns a tuple of three parts: before the separator, the separator, after it (spaces kept).
What will be the output of print("PythonProgram"[-1:2:-2])?
Solution
Step −2 from index −1 (= 12, 'm') down to index 3 (excluded): indices 12, 10, 8, 6, 4 → 'm','r','o','P','o'. Output: mroPo.
t = tuple('tuple'); t2 = t[2],; t += t2; print(t)
Solution
(C) ('t', 'u', 'p', 'l', 'e', 'p'). tuple('tuple') splits the string into characters; t[2], is the one-element tuple ('p',); += creates a new, longer tuple.
True about dictionaries: (A) a sequence type (B) cannot have two elements with same key (C) cannot have two elements with same value (D) key and value cannot be the same
Solution
(B). Keys are unique (assigning to an existing key overwrites it). Values may repeat; a dictionary is a mapping, not a sequence.
If L has 6 elements, which raises an exception? (A) L.pop(1) (B) L.pop(6) (C) L.insert(1,6) (D) L.insert(6,1)
Solution
(B) L.pop(6). Valid indices are 0–5, so IndexError. insert() never fails: an index beyond the end simply appends.
A–R. (A): [1,2,3]+'123' is invalid. (R): a list cannot be concatenated with a string.
Solution
(A) Both true; R is the correct explanation (TypeError: can only concatenate list to list).
State True or False: "A Python List must always contain all its elements of same data type."
Solution
False. A list can hold elements of different types, e.g. [1, "a", 2.5, [3]].
What will be the output of print(14%3**2*4)? (A) 16 (B) 64 (C) 20 (D) 256
Solution
(C) 20. ** has the highest precedence: 3**2 = 9. Then % and * from left to right: 14 % 9 = 5; 5 * 4 = 20.
Identify the correct output: game="Olympic2024"; print(game.index("C")) (A) 0 (B) 6 (C) −1 (D) ValueError
Solution
(D) ValueError. There is a lowercase "c" at index 6 but no uppercase "C"; index() raises ValueError when the substring is absent (find() would return −1).
Which is the correct identifier? (A) global (B) Break (C) def (D) with
Identify the invalid statement: (A) print("A",10,end="*") (B) print("A",sep="*",10) (C) print("A",10,sep="*") (D) print("A"*10)
L=['TIC','TAC']; print(L[::-1]) (A) ['CIT','CAT'] (B) ['TIC','TAC'] (C) ['CAT','CIT'] (D) ['TAC','TIC']
Which operator evaluates to True if the variables on either side point to the same memory location? (A) is (B) is not (C) and (D) or
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#
Which built-in function/method returns a dictionary? (A) dict() (B) keys() (C) values() (D) items()
Output of print(16*5/4*2/5-8): (a) −3.33 (b) 6.0 (c) 0.0 (d) −13.33
Identify the invalid statement: (a) d = dict() (b) e = {} (c) f = [] (d) g = dict{}
myStr = "MISSISSIPPI"; print(myStr[:4]+"#"+myStr[-5:]) (a) MISSI#SIPPI (b) MISS#SIPPI (c) MISS#IPPIS (d) MISSI#IPPIS
Which statement will raise an error? (a) print("A"*3) (b) print(5*3) (c) print("15" + 3) (d) print("15" + "13")
event="G20 Presidency@2023"; L=event.split(' '); print(L[::-2]) (a) 'G20' (b) ['Presidency@2023'] (c) ['G20'] (d) 'Presidency@2023'
A–R. (A): "Hello".sort() will give an error. (R): sort() does not exist as a method for strings.
2 marks: very short answer
Write a statement (built-in functions/methods only): (i) to create a new list L1 with the elements of L in ascending order, without modifying L; (ii) to check whether the character ch is an alphabet or a number.
Solution
(i) L1 = sorted(L) (sorted returns a new list; L.sort() would change L). (ii) ch.isalnum() (or ch.isalpha() or ch.isdigit()).
Assuming D1 is a dictionary: (i)(a) Expression to check if key 'RNo' is present. OR (b) Check if any key in D1 has value 12. (ii)(a) A single built-in statement to add 'RNo':12 if 'RNo' is absent, but return its value if present. OR (b) Delete all elements of D1.
Solution
(i)(a) 'RNo' in D1 (b) 12 in D1.values()
(ii)(a) D1.setdefault('RNo', 12) (b) D1.clear()
Write one example each of (i) Syntax Error (ii) Implicit type conversion.
Solution
(i) print(2 ; 5) or if x>5 print(x) (missing colon): the program does not run.
(ii) x = 10; y = 20.5; print(x + y) → 30.5: the int 10 is converted to float automatically.
D={"Suman":40, "Raj":55, "Raman":60}; D1={"Aditi":30, "Amit":90, "Raj":20} (built-in functions only).
(i)(a) Display the value for key "Raj" in D. OR (b) Display the length of D1.
(ii)(a) Append all pairs of D to D1. OR (b) Delete the item with key "Amit" from D1.
Output: 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="#")
(A) (i) Remove the item with key "NISHA" from dictionary Students. (ii) Display the number of occurrences of "is" in string message. OR (B) Convert tuple subject to a list and delete its last element.
3 marks: short answer
Output: 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()
Solution
"RACECAR" is a palindrome → printed in upper case with *. "CAR" is not → original "Car" with #. "RADAR" is a palindrome → *.
R*A*C*E*C*A*R*
C#a#r#
R*A*D*A*R*
Get every solution for all chapters
- Every board question of every chapter, each fully solved the way the board gives marks
- 3 complete board papers, each followed by its solutions
- Weightage and most-asked topics for every chapter
- Instant PDF download, colour and black & white print copies
Revising the chapter first? Complete Computer Science Notes for Class 12 (CBSE 083, 2026-27) →
What you get in the pack
- CBSE Class 12 Computer Science board papers 2024 to 2026 (3 full board papers)
- All 14 chapters and 3 board papers complete
- Part A: all 14 chapters, questions sorted chapter-wise and by marks
- Year-wise weightage table and most-asked topics for every chapter
- Part B: each full board paper followed by its complete solutions
- Full programs; every output traced and verified by running the code
- Only the current syllabus in Part A
All chapters in this pack
- PYQ Ch 1 Python Revision Tour
- PYQ Ch 2 Functions
- PYQ Ch 3 Exception Handling
- PYQ Ch 4 Text Files
- PYQ Ch 5 Binary Files
- PYQ Ch 6 CSV Files
- PYQ Ch 7 Stack
- PYQ Ch 8 Computer Networks I: Evolution and Data Communication
- PYQ Ch 9 Computer Networks II: Devices, Topologies and Types
- PYQ Ch 10 Network Protocols and Web Services
- PYQ Ch 11 Database Concepts
- PYQ Ch 12 SQL: DDL, DML and Queries
- PYQ Ch 13 SQL: Aggregates, Grouping and Joins
- PYQ Ch 14 Interface of Python with MySQL
- Board Paper 2026 Set 91 with Solutions
- Board Paper 2025 Set 91 with Solutions
- Board Paper 2024 Set 91 with Solutions
