CBSE Class 12 Computer Science 2026 Question Paper

2026SET-470 Marks180 min48 Questions

Section A

1
1 markVery Short AnswerReview of Python Basics (Class XI Recap)Data Types in Python

State True or False : In Python, data type of 74 is same as the data type of 74.0.

2
1 markMCQReview of Python Basics (Class XI Recap)String Methods — capitalize()

Identify the output of the following code snippet : ```python s = "the Truth" print(s.capitalize()) ```

(A)The truth
(B)THE TRUTH
(C)The Truth
(D)the Truth
3
1 markMCQReview of Python Basics (Class XI Recap)Logical Operators (and)

Which of the following expressions in Python 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
4
1 markMCQReview of Python Basics (Class XI Recap)String Methods — partition()

What is the output of the following code snippet ? ```python 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']
5
1 markVery Short AnswerReview of Python Basics (Class XI Recap)String Slicing with Negative Step

What will be the output of the following statement ? ```python print("PythonProgram"[-1:2:-2]) ```

6
1 markMCQReview of Python Basics (Class XI Recap)Tuples — Indexing and Concatenation

What will be the output of the following code snippet ? ```python 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')
7
1 markMCQReview of Python Basics (Class XI Recap)Dictionaries — Key Properties

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.
8
1 markMCQReview of Python Basics (Class XI Recap)Lists — pop() and insert() Methods

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)
9
1 markMCQFunctionsFunctions - Default Arguments & Return Value

What will be the output of the following code ? ```python def f1(a,b=1): print(a+b,end='-') c=f1(1,2) print(c,sep='*') ```

(A)3-2
(B)3-2*
(C)3-None
(D)3*None-
10
1 markMCQFile Handling in PythonFile Handling - File Opening Modes

Consider the statement given below : ```python f1 = open("pqr.dat","________") ``` Which of the following is the correct file mode to open the file in read only mode ?

(A)a
(B)rb
(C)r+
(D)rb+
11
1 markVery Short AnswerException Handling in PythonException Handling - Logical vs Runtime Errors

State whether the following statement is True or False : In Python, Logical errors can be handled using try......except......finally statement.

12
1 markMCQDatabase ConceptsCandidate, Primary & Alternate Keys

A table has two candidate keys, one of which is chosen as the primary key. How many alternate keys does this table have ?

(A)0
(B)1
(C)2
(D)3
13
1 markMCQStructured Query Language (SQL)SQL DDL - ALTER TABLE

Which of the following SQL command can change the degree of the existing relation ?

(A)DROP TABLE
(B)ALTER TABLE
(C)UPDATE...SET
(D)DELETE
14
1 markMCQStructured Query Language (SQL)SQL SELECT with WHERE Clause

What will be the output of the query ? ```sql SELECT MACHINE_ID, MACHINE_NAME FROM INVENTORY WHERE QUANTITY <= 100; ```

(A)All columns of INVENTORY table with quantity greater than 100
(B)ID and name of machines with quantity less than 100 from INVENTORY table
(C)All columns of INVENTORY table with quantity greater than or equal to 100
(D)ID and name of machines with quantity less than or equal to 100 from INVENTORY table.
15
1 markMCQDatabase ConceptsDegree and Cardinality of a Relation

A relation in MySQL database consists of 2 tuples and 3 attributes. If 2 attributes are deleted and 4 tuples are added, what will be the cardinality of the relation ?

(A)4
(B)5
(C)6
(D)7
16
1 markMCQStructured Query Language (SQL)SQL Aggregate Functions

Which aggregate function in SQL returns the smallest value from a column in a table ?

(A)MIN()
(B)MAX()
(C)SMALL()
(D)LOWER()
17
1 markMCQComputer NetworksRJ-45 Connector

With respect to computer networks, which of the following is the correct expanded form of RJ 45 ?

(A)Radio Jockey 45
(B)Registered Jockey 45
(C)Radio Jack 45
(D)Registered Jack 45
18
1 markMCQComputer NetworksNetwork Devices — Gateway

Which network device serves as the entry and exit point of a network, as all data coming in or going out of a network must first pass through it in order to use routing paths ?

(A)Modem
(B)Gateway
(C)Switch
(D)Repeater
19
1 markVery Short AnswerComputer NetworksXML

Expand the term XML.

20
1 markPython Revision TourType Compatibility in Python Concatenation

Assertion (A) : [1,2,3]+'123' is an invalid expression in Python. Reason (R) : In Python, a list cannot be concatenated with a string.

(A)Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).
(B)Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A).
(C)Assertion (A) is true, but Reason (R) is false.
(D)Assertion (A) is false, but Reason (R) is true.
21
1 markDatabase Query using SQLPrimary Key and Candidate Keys

Assertion (A) : The PRIMARY KEY constraint in SQL ensures that each value in the column(s) is unique and cannot be NULL. Reason (R) : Candidate keys are not eligible to become a primary key.

(A)Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).
(B)Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A).
(C)Assertion (A) is true, but Reason (R) is false.
(D)Assertion (A) is false, but Reason (R) is true.

Section B

22
2 marksShort AnswerWorking with FunctionsPositional and Default Parameters

What is the difference between default parameters and positional parameters in Python ? Also give an example of a function header which uses both.

23
1 markShort AnswerPython Revision TourSorting a List — sorted()

To create a new list L1 containing the elements of list L arranged in ascending order, without modifying list L.

24
1 markShort AnswerPython Revision TourChecking Alphanumeric Characters — isalnum()

A statement to check whether the given character, ch is an alphabet or a number.

25
1 markShort AnswerPython DictionariesDictionary Membership Operators

(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.

26
1 markShort AnswerPython DictionariesDictionary Built-in Methods

(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.

27
2 marksShort AnswerPython Libraries (random module) and Iterative ConstructsRandom Module and Loop Tracing

What possible output(s) from the given options will NOT be displayed when the following code is executed ? Also, mention, for how many iterations the for loop in the given code will run ? ```python import random a = [1,2,3,4,5,6] for i in range(4): j = random.randrange(i,5) print(a[j],end='-') print() ```

(A)3-4-5-4-
(B)2-2-4-5-
(C)4-3-3-5-
(D)5-1-2-4-
28
2 marksShort AnswerFunctions in PythonDebugging Python Functions (String Traversal)

The function given below is written to accept a string s as a parameter and return the number of vowels appearing in the string. The code has certain errors. Observe the code carefully and rewrite it after removing all the logical and syntax errors. Underline all the corrections made. ```python def CountVowels(s): c=0 for ch in range(s): if 'aeiouAEIOU' in ch: c=+1 return(ch) ```

29
1 markShort AnswerStructured Query Language (SQL)SQL — CREATE TABLE and Primary Key

(a) Write an SQL command to create the above table (W_Code should be the primary key). OR (b) Can U_Price be the primary key of the above table ? Justify your answer.

30
1 markShort AnswerStructured Query Language (SQL)SQL — ALTER TABLE (ADD/DROP Column)

(a) Assuming that the table W_STOCK is already created, write an SQL command to add an attribute E_Date (of DATE type) to the table. OR (b) Assuming that the table W_STOCK is already created, write an SQL command to remove the column B_Qty from the table.

31
2 marksShort AnswerComputer NetworksNetwork Topologies and Protocols

(a) List one advantage and one disadvantage of Bus topology. OR (b) What is protocol in the context of computer networks? Which protocol is used to transmit hypertext across the web?

Section C

32
3 marksShort AnswerFile Handling in PythonText File Handling in Python

(a) Write a Python function that counts and returns the number of digits appearing in the text file "Space.txt". For example, if the file contains : ``` Space exploration has unlocked incredible advancements in technology and science. Since the first moon landing in 1969, space agencies have sent probes to Mars, Jupiter and beyond. The ISS, orbiting Earth at about 400 km, serves as a hub for research. With missions planned for 2030, humanity's cosmic journey continues! ``` Then the function should return 11. OR (b) Write a Python function that displays the words in which the lowercase letter 'e' appears at least twice in the text file 'Space.txt'. For example, if the file contains : ``` Space exploration has unlocked incredible advancements in technology and science. Since the first moon landing in 1969, space agencies have sent probes to Mars, Jupiter and beyond. The ISS, orbiting Earth at about 400 km, serves as a hub for research. With missions planned for 2030, humanity's cosmic journey continues! ``` Then the function should display : agencies serves incredible advancements science. research.

33
3 marksShort AnswerData Structures using Python — StackStack Implementation using List — PUSH, POP and Display Operations

(a) A stack named FruitStack, implemented using list, contains records of some fruits. Each record is represented as a dictionary with keys `Name', `Origin', `Price', and `Expiry'. A sample record is given here : ```python {'Name':'Apple','Origin':'France','Price':120, 'Expiry':'12-08-2025'} ``` Write the following user-defined functions in Python to perform the specified operations on FruitStack : (i) push_fruit(FruitStack, Fruit): This function takes the stack FruitStack and a new record Fruit as arguments and pushes the record stored in Fruit onto FruitStack if the Price is less than 100. (ii) pop_fruit(FruitStack): This function pops the topmost record from the stack and returns it. If the stack is already empty, the function should display "UNDERFLOW". (iii) display(FruitStack): This function displays all the elements of the stack starting from the topmost element. If the stack is empty, the function should display `EMPTY STACK'. OR (b) Write a Python program to accept 10 integers from the user. If the entered number is a three-digit even integer, push it onto a stack. After all inputs are taken, pop all the three-digit even integers from the stack and display them. For example, if the user enters 12, 31, 320, 457, 6, 92, 924, 220, 1, 218, then the stack should contain : 320, 924, 220, 218 and the output of the program should be : 218 220 924 320

34
3 marksShort AnswerFunctionsTracing Function Output — String Slicing, List append/pop/reverse, Modulo Arithmetic

(a) Write the output of the following code : ```python 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 the output of the following code : ```python def Exam2026(given): new = 0 while given: if new % 2: new += given % 10 else: new += given % 5 print(new, end='-') given //= 10 Exam2026(123456) ```

Section D

35
4 marksShort AnswerStructured Query Language (SQL)SQL Queries — GROUP BY, UPDATE, Aggregate SUM, and Pattern Matching (LIKE)

(a) Based on the data given above, write the SQL queries for the following tasks : (i) To display Type and the maximum Price for each Type of milk. (ii) For each record, increase the Price by 0.5 where Type is 'F'. (iii) To display the total value of the stock (total of Qty x Price). (iv) To display the details of all records where Code starts with 'A'. OR (b) Considering the table STOCK as given above, write the output on execution of the following queries : (i) SELECT Volume, Qty, Price FROM STOCK WHERE Type IN ('F','D'); (ii) SELECT Code, Qty FROM STOCK WHERE Price BETWEEN 30 AND 50; (iii) SELECT DISTINCT Type FROM STOCK; (iv) SELECT Volume, count(*) FROM STOCK GROUP BY Volume;

36
4 marksShort AnswerFile Handling in PythonCSV File Handling — Reading, Filtering and Writing Records

A csv file "States.csv" contains some data about all the states of India. Each record of the file contains the following data : - Name of the State - Capital of the State - Population of the State - Official Language of the State For example, a sample record in the file is : ['Andhra Pradesh','Amaravati',52221000,'Telugu'] Write a Python program which reads the data from this file and appends all those records where population is more than 10000000 into another csv file 'More.csv'. Note : "States.csv" also contains the Header row. The Header row should NOT be copied to "More.csv".

37
1 markShort AnswerStructured Query Language (SQL)SQL COUNT() with WHERE Condition

Number of records from LOANS table where Rate of Interest (RoI) is above 7.0.

38
1 markShort AnswerStructured Query Language (SQL)SQL Join between CUSTOMERS and LOANS using Common Key C_ID

Names of the customers whose loan amount (L_Amt) is above 1000000.

39
1 markShort AnswerStructured Query Language (SQL)SQL Join with Date Comparison Condition

C_ID, C_Name and Terms of all those records where Loan Date (L_Date) is after 31st December, 2024.

40
1 markShort AnswerStructured Query Language (SQL)SQL ORDER BY and GROUP BY with AVG()

(a) Details of all the loans in the descending order of RoI. OR (b) C_ID and average term for each C_ID from the LOANS table.

41
4 marksShort AnswerInterface of Python with SQL DatabasePython-MySQL Database Connectivity

Peter has created a table named Account in MySQL database, SCHOOL, having following structure : - Stud_id - integer - Sname - string - Class - string - Fees - float Help him in writing a Python program to display records of those students whose fees is less than 5000. Note the following to establish connectivity between Python and MySQL : - Username - admin - Password - root - Host - localhost

Section E

42
2 marksLong AnswerFile Handling in PythonBinary File Handling — Writing Records with pickle

Append() - To input the data of a Resource Person and write it in the file RESOURCES.DAT.

43
3 marksLong AnswerFile Handling in PythonBinary File Handling — Updating Records

Update() - To increase the Charges of each resource person by 500.

44
1 markComputer NetworksServer Placement in a Campus Network

Suggest the most appropriate location of the server inside the Amritsar University Campus. Justify your choice.

45
1 markComputer NetworksEfficient Cable Layout Design

Draw the cable layout to efficiently connect various blocks within the Amritsar University Campus.

46
1 markComputer NetworksWired Transmission Media

Name any two wired media that can be used to connect various computers of a block inside Amritsar Campus.

47
1 markMCQComputer NetworksWireless Transmission Media — Radio Waves

For the academic purpose, the University will provide its own 24 x 7 FM channel within the University Campus. Which communication medium, out of the following, is used by FM ?

(A)Radio Waves
(B)Micro Waves
(C)Infrared Waves
48
1 markComputer NetworksInternet Communication Protocol / Repeater Placement

(a) The students will be attending a lot of online academic sessions and workshops. These will involve audio-visual communication. Write the full name of the protocol which will be used for such a communication through the internet. OR (b) Where should a repeater be installed in Amritsar University campus to boost the signal between blocks ? Justify your answer.

Frequently Asked Questions

How many questions are in the CBSE Class 12 Computer Science 2026 paper?

The CBSE Class 12 Computer Science 2026 question paper has 48 questions carrying a total of 70 marks.

What is the maximum marks for CBSE Class 12 Computer Science 2026?

The maximum marks for the CBSE Class 12 Computer Science 2026 exam is 70.

How long is the CBSE Class 12 Computer Science 2026 exam?

The CBSE Class 12 Computer Science 2026 exam duration is 180 minutes (3 hours).

Where can I find answers to the CBSE Class 12 Computer Science 2026 question paper?

Padhantu provides complete answers to all questions in the CBSE Class 12 Computer Science 2026 paper. You can read the answers directly on this page. Each question shows the official answer along with chapter and topic information.