Skip to content
← All years

Computer Science · 2024

CBSE Class 12 Computer Science 2024 — Previous-Year Question Paper

CBSE Class XII Board 2024 · Set 91/4

Real board examination

About this paper

The real Class-12 board examination held in 2024. Every question below is solved the concept-first way. Sample papers are labelled honestly — never shown as a past exam.

Total marks
70
Questions
35
Duration
180 min
Sections
5

The marks / questions / duration above are the official exam pattern. We currently have 35 of this paper’s questions (100% of the full paper), with 35 fully solved. Questions we couldn’t yet extract or verify are held — never shown as complete.

Sections & marks

SectionTypeQuestionsMarks eachTotal
ASection AObjective (MCQ / True-False / 1-mark)18118
BSection BVery short answer7214
CSection CShort answer5315
DSection DLong answer248
ESection ELong answer3515
Total3570

The question paper

The questions we hold for this paper, laid out by section. Solutions are on the Answers tab.

Board Examination

Computer Science

CBSE Class XII Board 2024 · Set 91/4

Series/Set: 91/4Roll No. ________
Time Allowed: 3 hoursMaximum Marks: 70

General Instructions

  1. This question paper contains 35 questions divided into 5 sections — A, B, C, D, E.
  2. Section A comprises 18 questions of 1 mark each (Objective (MCQ / True-False / 1-mark)).
  3. Section B comprises 7 questions of 2 marks each (Very short answer).
  4. Section C comprises 5 questions of 3 marks each (Short answer).
  5. Section D comprises 2 questions of 4 marks each (Long answer).
  6. Section E comprises 3 questions of 5 marks each (Long answer).

Above is the official exam pattern. The questions printed below are those we currently hold for this paper.

Section A

Objective (MCQ / True-False / 1-mark) · 1 mark each · 18 of 18 shown

Q1.
State True or False: While defining a function in Python, the positional parameters in the function header must always be written after the default parameters.
[1]
Q2.
The SELECT statement when combined with ____ clause, returns records without repetition. (A) DISTINCT (B) DESCRIBE (C) UNIQUE (D) NULL
[1]
Q3.
What will be the output of the following statement: print(165/42/5-8) (A) -3.33 (B) 6.0 (C) 0.0 (D) -13.33
[1]
Q4.
What possible output from the given options is expected to be displayed when the following Python code is executed? import random Signal = ['RED', 'YELLOW', 'GREEN'] for K in range(2, 0, -1): R = random.randrange(K) print(Signal[R], end='#') (A) YELLOW # RED # (B) RED # GREEN # (C) GREEN # RED # (D) YELLOW # GREEN #
[1]
Q5.
In SQL, the aggregate function which will display the cardinality of the table is ____. (A) sum() (B) count() (C) avg() (D) sum()
[1]
Q6.
Which protocol out of the following is used to send and receive emails over a computer network? (A) PPP (B) HTTP (C) FTP (D) SMTP
[1]
Q7.
Identify the invalid Python statement from the following: (A) d = dict() (B) e = {} (C) f = [] (D) g = dict{}
[1]
Page 1 of 7
Q8.
Consider the statements given below and then choose the correct output from the given options: myStr="MISSISSIPPI" print(myStr[:4]+"#"+myStr[-5:]) (A) MISSI#SIPPI (B) MISS#SIPPI (C) MISS#IPPIS (D) MISSI#IPPIS
[1]
Q9.
Identify the statement from the following which will raise an error: (A) print("A"*3) (B) print(5*3) (C) print("15" + 3) (D) print("15" + "13")
[1]
Q10.
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'
[1]
Q11.
Which of the following options is the correct unit of measurement for network bandwidth? (A) KB (B) Bit (C) Hz (D) Km
[1]
Q12.
Observe the given Python code carefully: a=20 def convert(a): b=20 a=a+b convert(10) print(a) Select the correct output from the given options: (A) 10 (B) 20 (C) 30 (D) Error
[1]
Q13.
State whether the following statement is True or False: While handling exceptions in Python, name of the exception has to be compulsorily added with except clause.
[1]
Q14.
Which of the following is not a DDL command in SQL? (A) DROP (B) CREATE (C) UPDATE (D) ALTER
[1]
Q15.
Fill in the blank: __ is a set of rules that needs to be followed by the communicating parties in order to have a successful and reliable data communication over a network.
[1]
Q16.
Consider the following Python statement: F=open('CONTENT.TXT') Which of the following is an invalid statement in Python? (A) F.seek(1,0) (B) F.seek(0,1) (C) F.seek(0,-1) (D) F.seek(0,2)
[1]
Page 2 of 7
Q17.
Q. 17 and 18 are ASSERTION (A) and REASONING (R) based questions. 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 Assertion (A): CSV file is a human readable text file where each line has a number of fields, separated by comma or some other delimiter. Reason (R): writerow() method is used to write a single row in a CSV file.
[1]
Q18.
Q. 17 and 18 are ASSERTION (A) and REASONING (R) based questions. 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 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.
[1]
Section B

Very short answer · 2 marks each · 7 of 7 shown

Q1.
(A) (i) Expand the following terms: XML, PPP (ii) Give one difference between circuit switching and packet switching. OR (B) (i) Define the term web hosting. (ii) Name any two web browsers.
[2]
Q2.
The code given below accepts five numbers and displays whether they are even or odd. Observe the following code carefully and rewrite it after removing all syntax and logical errors. Underline all the corrections made. def EvenOdd() for i in range(5): num=int(input("Enter a number") if num/2==0: print("Even") else: print("Odd") EvenOdd()
[2]
Q3.
(A) Write a user defined function in Python named showGrades(S) which takes the dictionary S as an argument. The dictionary, S contains Name:[Eng,Math,Science] as key:value pairs. The function displays the corresponding grade obtained by the students according to the following grading rules: Average of Eng, Math, Science Grade >= 90 A < 90 but >= 60 B < 60 C For example: Consider the following dictionary S="AMIT":[92,86,64],"NAGMA":[65,42,43],"DAVID":[92,90,88] The output should be: AMIT - B NAGMA - C DAVID - A OR (B) Write a user defined function in Python named Puzzle(W,N) which takes the argument W as an English word and N as an integer and returns the string where every Nth alphabet of the word W is replaced with an underscore ("_"). For example: if W contains the word "TELEVISION" and N is 3, then the function should return the string "TEEVSIN". Likewise for the word "TELEVISION" if N is 4, then the function should return "TELVISON".
[2]
Q4.
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="#")
[2]
Page 3 of 7
Q5.
(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.
[2]
Q6.
(A) Ms. Veda created a table named Sports in a MySQL database, containing columns Gameᵢd, PAge and Gₙame. After creating the table, she realized that the attribute, Category has to be added. Help her to write a command to add the Category column. Thereafter, write the command to insert the following record in the table: Gameᵢd: G42 PAge: Above 18 Gₙame: Chess Category: Senior OR (B) Write the SQL commands to perform the following tasks: (i) View the list of tables in the database, Exam. (ii) View the structure of the table, Term1.
[2]
Q7.
Predict the output of the following code: def callon(b=20,a=10): b=b+a a=b-a print(b,"#",a) return b x=100 y=200 x=callon(x,y) print(x,"@",y) y=callon(y) print(x,"@",y)
[2]
Section C

Short answer · 3 marks each · 5 of 5 shown

Q1.
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()
[3]
Q2.
Consider the table ORDERS given below and write the output of the SQL queries that follow: ORDNO ITEM QTY RATE ORDATE 1001 RICE 23 120 2023-09-10 1002 PULSES 13 120 2023-10-18 1003 RICE 25 110 2023-11-17 1004 WHEAT 28 65 2023-12-25 1005 PULSES 16 110 2024-01-15 1006 WHEAT 27 55 2024-04-15 1007 WHEAT 25 60 2024-04-30 (i) SELECT ITEM, SUM(QTY) FROM ORDERS GROUP BY ITEM; (ii) SELECT ITEM, QTY FROM ORDERS WHERE ORDATE BETWEEN '2023-11-01' AND '2023-12-31'; (iii) SELECT ORDNO, ORDATE FROM ORDERS WHERE ITEM = 'WHEAT' AND RATE>=60;
[3]
Page 4 of 7
Q3.
(A) Write a user defined function in Python named showInLines() which reads contents of a text file named STORY.TXT and displays every sentence in a separate line. Assume that a sentence ends with a full stop (.), a question mark (?), or an exclamation mark (!). For example, if the content of file STORY.TXT is as follows: Our parents told us that we must eat vegetables to be healthy. And it turns out, our parents were right! So, what else did our parents tell? Then the function should display the file's content as follows: Our parents told us that we must eat vegetables to be healthy. And it turns out, our parents were right! So, what else did our parents tell? OR (B) Write a function, cwords() in Python that separately counts and displays the number of uppercase and lowercase alphabets in a text file, Words.txt.
[3]
Q4.
Consider the table Projects given below: Table: Projects Pᵢd Pname Language Startdate Enddate P001 School Management System Python 2023-01-12 2023-04-03 P002 Hotel Management System C++ 2022-12-01 2023-02-02 P003 Blood Bank Python 2023-02-11 2023-03-02 P004 Payroll Management System Python 2023-03-12 2023-06-02 Based on the given table, write SQL queries for the following: (i) Add the constraint, primary key to column Pᵢd in the existing table Projects. (ii) To change the language to Python of the project whose id is P002. (iii) To delete the table Projects from MySQL database along with its data.
[3]
Q5.
Consider a list named Nums which contains random integers. Write the following user defined functions in Python and perform the specified operations on a stack named BigNums. (i) PushBig(): It checks every number from the list Nums and pushes all such numbers which have 5 or more digits into the stack, BigNums. (ii) PopBig(): It pops the numbers from the stack, BigNums and displays them. The function should also display "Stack Empty" when there are no more numbers left in the stack. For example: If the list Nums contains the following data: Nums = [213,10025,167,254923,14,1297653,31498,386,92765] Then on execution of PushBig(), the stack BigNums should store: [10025, 254923, 1297653, 31498, 92765] And on execution of PopBig(), the following output should be displayed: 92765 31498 1297653 254923 10025 Stack Empty
[3]
Section D

Long answer · 4 marks each · 2 of 2 shown

Q1.
Consider the tables Admin and Transport given below: Table: Admin Sᵢd Sₙame Address Stype S001 Sandhya Rohini Day Boarder S002 Vedanshi Rohtak Day Scholar S003 Vibhu Raj Nagar NULL S004 Atharva Rampur Day Boarder Table: Transport Sᵢd Busₙo Stopₙame S002 TSS10 Sarai Kale Khan S004 TSS12 Sainik Vihar S005 TSS10 Kamla Nagar Write SQL queries for the following: (i) Display the student name and their stop name from the tables Admin and Transport. (ii) Display the number of students whose Stype is not known. (iii) Display all details of the students whose name starts with 'V'. (iv) Display student id and address in alphabetical order of student name, from the table Admin.
[4]
Page 5 of 7
Q2.
Sangeeta is a Python programmer working in a computer hardware company. She has to maintain the records of the peripheral devices. She created a csv file named Peripheral.csv, to store the details. The structure of Peripheral.csv is: [Pᵢd, Pₙame, Price] where Pᵢd is Peripheral device ID (integer) Pₙame is Peripheral device name (String) Price is Peripheral device price (integer) Sangeeta wants to write the following user defined functions: AddDevice(): to accept a record from the user and add it to a csv file, Peripheral.csv. CountDevice(): To count and display number of peripheral devices whose price is less than 1000.
[4]
Section E

Long answer · 5 marks each · 3 of 3 shown

Q1.
Infotainment Ltd. is an event management company with its prime office located in Bengaluru. The company is planning to open its new division at three different locations in Chennai named as - Vajra, Trishula and Sudershana. You, as a networking expert need to suggest solutions to the questions in part (i) to (v), keeping in mind the distances and other given parameters. Distances between various locations: Vajra to Trishula 350 m Trishula to Sudershana 415 m Sudershana to Vajra 300 m Bengaluru Office to Chennai 2000 km Number of computers installed at various locations: Vajra 120 Sudershana 75 Trishula 65 Bengaluru Office 250 (i) Suggest and draw the cable layout to efficiently connect various locations in Chennai division for connecting the digital devices. (ii) Which block in Chennai division should host the server? Justify your answer. (iii) Which fast and effective wired transmission medium should be used to connect the prime office at Bengaluru with the Chennai division? (iv) Which network device will be used to connect the digital devices within each location of Chennai division so that they may communicate with each other? (v) A considerable amount of data loss is noticed between different locations of the Chennai division, which are connected in the network. Suggest a networking device that should be installed to refresh the data and reduce the data loss during transmission to and from different locations of Chennai division.
[5]
Q2.
(A) (i) Differentiate between 'w' and 'a' file modes in Python. (ii) Consider a binary file, items.dat, containing records stored in the given format: itemᵢd: [itemₙame, amount] Write a function, Copyₙew(), that copies all records whose amount is greater than 1000 from items.dat to newᵢtems.dat. OR (B) (i) What is the advantage of using with clause while opening a data file in Python? Also give syntax of with clause. (ii) A binary file, EMP.DAT has the following structure: [EmpId, Name, Salary] where EmpId: Employee id Name: Employee Name Salary: Employee Salary Write a user defined function, dispDetail(), that would read the contents of the file EMP.DAT and display the details of those employees whose salary is below 25000.
[5]
Page 6 of 7
Q3.
(A) (i) Define cartesian product with respect to RDBMS. (ii) Sunil wants to write a program in Python to update the quantity to 20 of the records whose item code is 111 in the table named shop in MySQL database named Keeper. The table shop in MySQL contains the following attributes: Itemcode: Item code (Integer) Itemₙame: Name of item (String) Qty: Quantity of item (Integer) Price: Price of item (Integer) Consider the following to establish connectivity between Python and MySQL: Username: admin Password: Shopping Host: localhost OR (B) (i) Give any two features of SQL. (ii) Sumit wants to write a code in Python to display all the details of the passengers from the table flight in MySQL database, Travel. The table contains the following attributes: Fcode: Flight code (String) Fₙame: Name of flight (String) Source: Departure city of flight (String) Destination: Destination city of flight (String) Consider the following to establish connectivity between Python and MySQL: Username: root Password: airplane Host: localhost
[5]
Page 7 of 7