Skip to content
← 2023

Computer Science · 2023 · Set 91/4

CBSE Class 12 Computer Science 2023 — Set 91/4

CBSE Class XII Board 2023 · Set 91/4

Real board examination
Sets

About this paper

The real Class-12 board examination held in 2023. 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 answer3515
ESection ELong answer248
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 2023 · 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 3 questions of 5 marks each (Long answer).
  6. Section E comprises 2 questions of 4 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. "Comments are not executed by interpreter."
[1]
Q2.
Which of the following is not a sequential datatype in Python ?
  • (a) Dictionary
  • (b) String
  • (c) List
  • (d) Tuple
[1]
Q3.
Given the following dictionary Day={1:"Monday", 2: "Tuesday", 3: "Wednesday"} Which statement will return "Tuesday".
  • (a) Day.pop()
  • (b) Day.pop(2)
  • (c) Day.pop(1)
  • (d) Day.pop("Tuesday")
[1]
Q4.
Consider the given expression : 7<4 or 6>3 and not 10==10 or 17>4 Which of the following will be the correct output if the given expression is evaluated ?
  • (a) True
  • (b) False
  • (c) NONE
  • (d) NULL
[1]
Q5.
Select the correct output of the code : S="Amrit Mahotsav @ 75" A=S.split(" ",2) print(A)
  • (a) ('Amrit', 'Mahotsav', '@', '75')
  • (b) ['Amrit', 'Mahotsav', '@ 75']
  • (c) ('Amrit', 'Mahotsav', '@ 75')
  • (d) ['Amrit', 'Mahotsav', '@', '75']
[1]
Q6.
Which of the following modes in Python creates a new file, if file does not exist and overwrites the content, if the file exists ?
  • (a) r+
  • (b) r
  • (c) w
  • (d) a
[1]
Page 1 of 6
Q7.
Fill in the blank : ______ is not a valid built-in function for list manipulations. (a) count() (b) length() (c) append() (d) extend()
[1]
Q8.
Which of the following is an example of identity operators of Python ? (a) is (b) on (c) in (d) not in
[1]
Q9.
Which of the following statement(s) would give an error after executing the following code ? S="Happy" # Statement 1 print(S*2) # Statement 2 S+="Independence" # Statement 3 S.append("Day") # Statement 4 print(S) # Statement 5 (a) Statement 2 (b) Statement 3 (c) Statement 4 (d) Statement 3 and 4
[1]
Q10.
Fill in the blank : In a relational model, tables are called _____, that store data for different columns. (a) Attributes (b) Degrees (c) Relations (d) Tuples
[1]
Q11.
The correct syntax of tell() is : (a) tell.fileobject() (b) fileobject.tell() (c) tell.fileobject(1) (d) fileobject.tell(1)
[1]
Q12.
Fill in the blank : _____ statement of SQL is used to insert new records in a table. (a) ALTER (b) UPDATE (c) INSERT (d) CREATE
[1]
Q13.
Fill in the blank : In _____ switching, before a communication starts, a dedicated path is identified between the sender and the receiver. (a) Packet (b) Graph (c) Circuit (d) Plot
[1]
Q14.
What will the following expression be evaluated to in Python ? print(6/3 + 4**3//8-4) (a) 6.5 (b) 4.0 (c) 6.0 (d) 4
[1]
Q15.
Which of the following functions is a valid built-in function for both list and dictionary datatype ? (a) items() (b) len() (c) update() (d) values()
[1]
Q16.
fetchone() method fetches only one row in a ResultSet and returns a _____. (a) Tuple (b) List (c) Dictionary (d) String
[1]
Page 2 of 6
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) : In Python, a stack can be implemented using a list. Reasoning (R) : A stack is an ordered linear list of elements that works on the principle of First In First Out (FIFO).
[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) : readlines() reads all the lines from a text file and returns the lines along with newline as a list of strings. Reasoning (R) : readline() can read the entire text file line by line without using any looping statements.
[1]
Section B

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

Q1.
Ravi, a Python programmer, is working on a project in which he wants to write a function to count the number of even and odd values in the list. He has written the following code but his code is having errors. Rewrite the correct code and underline the corrections made. define EOCOUNT(L): evenₙo=oddₙo=0 for i in range(0,len(L)) if L[i]%2=0: evenₙo+=1 Else: oddₙo+=1 print(evenₙo, oddₙo)
[2]
Q2.
(a) Write any two differences between Fiber-optic cable and Coaxial cable. OR (b) Write one advantage and one disadvantage of wired over wireless communication.
[2]
Q3.
(a) Given is a Python string declaration : NAME = "Learning Python is Fun" Write the output of : print(NAME[-5:-10:-1]) (b) Write the output of the code given below : dict1=1:["Rohit",20], 2:["Siya",90] dict2=1:["Rahul",95], 5:["Rajan",80] dict1.update(dict2) print(dict1.values())
[2]
Q4.
Explain the usage of HAVING clause in GROUP BY command in RDBMS with the help of an example.
[2]
Q5.
(a) Write the full forms of the following : (i) XML (ii) HTTPS (b) What is the use of FTP ?
[2]
Page 3 of 6
Q6.
(a) Write the output of the Python code given below : g=0 def fun1(x,y): global g g=x+y return g def fun2(m,n): global g g=m-n return g k=fun1(2,3) fun2(k,7) print(g) OR (b) Write the output of the Python code given below : a=15 def update(x): global a a+=2 if x%2==0: a*=x else: a//=x a=a+5 print(a,end="") update(5) print(a)
[2]
Q7.
(a) Differentiate between IN and BETWEEN operators in SQL with appropriate examples. OR (b) Which of the following is NOT a DML command. DELETE, DROP, INSERT, UPDATE
[2]
Section C

Short answer · 3 marks each · 5 of 5 shown

Q1.
(a) Consider the following tables Student and Sport : Table : Student ADMNO NAME CLASS 1100 MEENA X 1101 VANI XI Table : Sport ADMNO GAME 1100 CRICKET 1103 FOOTBALL What will be the output of the following statement ? SELECT * FROM Student, Sport; (b) Write the output of the queries (i) to (iv) based on the table, GARMENT given below : TABLE : GARMENT GCODE TYPE PRICE FCODE ODRDATE G101 EVENING GOWN 850 F03 2008-12-19 G102 SLACKS 750 F02 2020-10-20 G103 FROCK 1000 F01 2021-09-09 G104 TULIP SKIRT 1550 F01 2021-08-10 G105 BABY TOP 1500 F02 2020-03-31 G106 FORMAL PANT 1250 F01 2019-01-06 (i) SELECT DISTINCT(COUNT(FCODE)) FROM GARMENT; (ii) SELECT FCODE, COUNT(*), MIN(PRICE) FROM GARMENT GROUP BY FCODE HAVING COUNT(*)>1; (iii) SELECT TYPE FROM GARMENT WHERE ODRDATE >'2021-02-01' AND PRICE <1500; (iv) SELECT * FROM GARMENT WHERE TYPE LIKE 'F%';
[3]
Q2.
(a) Write a function in Python that displays the book names having 'Y' or 'y' in their name from a text file "Bookname.txt". Example : If the file 'Bookname.txt' contains the names of following books : One Hundred Years of Solitude The Diary of a Young Girl On the Road After execution, the output will be : One Hundred Years of Solitude The Diary of a Young Girl OR (b) Write a function RevString() to read a textfile "Input.txt" and prints the words starting with 'O' in reverse order. The rest of the content is displayed normally. Example : If content in the text file is : UBUNTU IS AN OPEN SOURCE OPERATING SYSTEM Output will be : UBUNTU IS AN NEPO SOURCE GNITAREPO SYSTEM (words 'OPEN' and 'OPERATING' are displayed in reverse order)
[3]
Q3.
Write the output of any three SQL queries (i) to (iv) based on the tables COMPANY and CUSTOMER given below : Table : COMPANY CID CNAME CITY PRODUCTNAME 111 SONY DELHI TV 222 NOKIA MUMBAI MOBILE 333 ONIDA DELHI TV 444 SONY MUMBAI MOBILE 555 BLACKBERRY CHENNAI MOBILE 666 DELL DELHI LAPTOP Table : CUSTOMER CUSTID CID NAME PRICE QTY C01 222 ROHIT SHARMA 70000 20 C02 666 DEEPIKA KUMARI 50000 10 C03 111 MOHAN KUMAR 30000 5 C04 555 RADHA MOHAN 30000 11 (i) SELECT PRODUCTNAME, COUNT(*) FROM COMPANY GROUP BY PRODUCTNAME HAVING COUNT(*)> 2; (ii) SELECT NAME, PRICE, PRODUCTNAME FROM COMPANY C, CUSTOMER CU WHERE C.CID = CU.CID AND CNAME = 'SONY'; (iii) SELECT DISTINCT CITY FROM COMPANY; (iv) SELECT * FROM COMPANY WHERE CNAME LIKE '%ON%';
[3]
Page 4 of 6
Q4.
Write a function searchreplace() in Python which accepts a list L of numbers and a number to be searched. If the number exists, it is replaced by 0 and if the number does not exist, an appropriate message is displayed. Example : L = [10,20,30,10,40] Number to be searched = 10 List after replacement : L = [0,20,30,0,40]
[3]
Q5.
A list contains following record of course details for a University : [Courseₙame, Fees, Duration] Write the following user defined functions to perform given operations on the stack named 'Univ' : (i) Pushelement() - To push an object containing the Courseₙame, Fees and Duration of a course, which has fees greater than 100000 to the stack. (ii) Popelement() - To pop the object from the stack and display it. Also, display "Underflow" when there is no element in the stack. For example : If the lists of courses details are : ["MCA",200000,3] ["MBA",500000,2] ["BA",100000,3] The stack should contain : ["MBA",500000,2] ["MCA",200000,3]
[3]
Section D

Long answer · 5 marks each · 3 of 3 shown

Q1.
ABC Consultants are setting up a secure network for their office campus at Noida for their day-to-day office and web-based activities. They are planning to have connectivity between three buildings and the head office situated in Bengaluru. As a network consultant, give solutions to the questions (i) to (v), after going through the building locations and other details which are given below : NOIDA BRANCH: Building 1, Building 2, Building 3 BENGALURU BRANCH: Head Office Distance between various blocks/locations : Building 1 to Building 3 120 m Building 1 to Building 2 50 m Building 2 to Building 3 65 m Noida Branch to Head Office 1500 km Number of computers : Building 1 25 Building 2 51 Building 3 150 Head Office 10 (i) Suggest the most suitable place to install the server for this organization. Also, give reason to justify your suggested location. (ii) Suggest the cable layout of connections between the buildings inside the campus. (iii) Suggest the placement of the following devices with justification : Switch Repeater (iv) The organization is planning to provide a high-speed link with the head office situated in Bengaluru, using a wired connection. Suggest a suitable wired medium for the same. (v) The System Administrator does remote login to any PC, if any requirement arises. Name the protocol, which is used for the same.
[5]
Q2.
(a) (i) What possible output(s) are expected to be displayed on screen at the time of execution of the following code ? import random S=["Pen","Pencil","Eraser","Bag","Book"] for i in range (1,2): f=random.randint(i,3) s=random.randint(i+1,4) print(S[f],S[s],sep=":") Options : (I) Pencil:Book (II) Pencil:Book Eraser:Bag (III) Pen:Book Bag:Book (IV) Bag:Eraser (ii) The table Bookshop in MySQL contains the following attributes : Bcode Integer Bₙame String Qty Integer Price Integer Note the following to establish connectivity between Python and MySQL on a 'localhost' : Username is shop Password is Book The table exists in a MySQL database named Bstore. The code given below updates the records from the table Bookshop in MySQL. Statement 1 - to form the cursor object. Statement 2 - to execute the query that updates the Qty to 20 of the records whose Bcode is 105 in the table. Statement 3 - to make the changes permanent in the database. import mysql.connector as mysql def updatebook(): mydb=mysql.connect(host="localhost", user="shop",passwd="Book",database="Bstore") mycursor=_____ # Statement 1 qry= "update Bookshop set Qty=20 where Bcode=105" __________ # Statement 2 __________ # Statement 3 OR (b) (i) Predict the output of the code given below : text="LearningCS" L=len(text) ntext="" for i in range (0,L): if text[i].islower(): ntext=ntext+text[i].upper() elif text[i].isalnum(): ntext=ntext+text[i-1] else: ntext=ntext+'' print(ntext) (ii) The table Bookshop in MySQL contains the following attributes : Bcode Integer Bₙame String Qty Integer Price Integer Note the following to establish connectivity between Python and MySQL on a 'localhost' : Username is shop Password is Book The table exists in a MySQL database named Bstore. The code given below reads the records from the table Bookshop and displays all the records : Statement 1 - to form the cursor object. Statement 2 - to write the query to display all the records from the table. Statement 3 - to read the complete result of the query into the object named BDetails, from the table Bookshop in the database. import mysql.connector as mysql def Displaybook(): mydb=mysql.connect(host="localhost", user="shop",passwd="Book",database="Bstore") mycursor=______ # Statement 1 mycursor.execute("_____") # Statement 2 BDetails=_____ # Statement 3 for i in BDetails: print(i)
[5]
Page 5 of 6
Q3.
(a) Write a point of difference between append (a) and write (w) modes in a text file. Write a program in Python that defines and calls the following user defined functions : (i) AddTeacher() : It accepts the values from the user and inserts record of a teacher to a csv file 'Teacher.csv'. Each record consists of a list with field elements as Tᵢd, Tname and desig to store teacher ID, teacher name and designation respectively. (ii) SearchTeacher() : To display the records of all the PGT (designation) teachers. OR (b) Write one point of difference between seek() and tell() functions in file handling. Write a program in Python that defines and calls the following user defined functions : (i) AddDevice() : The function accepts and adds records of the peripheral devices to a csv file 'peripheral.csv'. Each record consists of a list with field elements as Pᵢd, Pₙame and Price to store peripheral device ID, device name, and price respectively. (ii) CountDevice() : To count and display number of peripheral devices, whose price is less than Rs. 1000.
[5]
Section E

Long answer · 4 marks each · 2 of 2 shown

Q1.
The ABC Company is considering to maintain their salespersons records using SQL to store data. As a database administrator, Alia created the table Salesperson and also entered the data of 5 Salespersons. Table : Salesperson SID SNAME AGE SAMOUNT REGION S001 SHYAM 35 20000 NORTH S002 RISHABH 30 25000 EAST S003 SUNIL 29 21000 NORTH S004 RAHIL 39 22000 WEST S005 AMIT 40 23000 EAST Based on the data given above, answer the following questions : (i) Identify the attribute that is best suited to be the Primary Key and why ? (ii) The Company has asked Alia to add another attribute in the table. What will be the new degree and cardinality of the above table ? (iii) Write the statements to : (a) Insert details of one salesman with appropriate data. (b) Change the Region of salesman 'SHYAM' to 'SOUTH' in the table Salesperson. OR (Option for part iii only) (iii) Write the statement to : (a) Delete the record of salesman RISHABH, as he has left the company. (b) Remove an attribute REGION from the table.
[4]
Q2.
Atharva is a programmer, who has recently been given a task to write a Python code to perform the following binary file operation with the help of a user defined function/module : Copyₙew() : to create a binary file newᵢtems.dat and write all the item details stored in the binary file, items.dat, except for the item whose itemᵢd is 101. The data is stored in the following format : itemᵢd:[itemₙame,amount] import ______ # Statement 1 def Copyₙew(): f1=_______ # Statement 2 f2=_______ # Statement 3 itemᵢd=int(input("Enter the item id")) itemdetail=______ # Statement 4 for key in itemdetail: if ________: # Statement 5 pickle.______ # Statement 6 f1.close() f2.close() He has succeeded in writing partial code and has missed out certain statements. Therefore, as a Python expert, help him to complete the code based on the given requirements : (i) Which module should be imported in the program ? (Statement 1) (ii) Write the correct statement required to open the binary file "items.dat". (Statement 2) (iii) Which statement should Atharva fill in Statement 3 to open the binary file "newᵢtems.dat" and in Statement 4 to read all the details from the binary file "items.dat". OR (Option for part iii only) (iii) What should Atharva write in Statement 5 to apply the given condition and in Statement 6 to write data in the binary file "newᵢtems.dat".
[4]
Page 6 of 6