Skip to content
← 2023

Computer Science · 2023 · Set 91/1

CBSE Class 12 Computer Science 2023 — Set 91/1

CBSE Class XII Board 2023 · Set 91/1

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/1

Series/Set: 91/1Roll 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. "Identifiers are names used to identify a variable, function in a program".
[1]
Q2.
Which of the following is a valid keyword in Python?
  • (a) false
  • (b) return
  • (c) non_local
  • (d) none
[1]
Q3.
Given the following Tuple Tup=(10, 20, 30, 50) Which of the following statements will result in an error?
  • (a) print(Tup[0])
  • (b) Tup.insert(2,3)
  • (c) print(Tup[1:2])
  • (d) print(len(Tup))
[1]
Q4.
Consider the given expression: 5<10 and 12>7 or not 7>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.partition(" ") print(A)
  • (a) ('Amrit Mahotsav', '@', '75')
  • (b) ['Amrit', 'Mahotsav', '@', '75']
  • (c) ('Amrit', 'Mahotsav @ 75')
  • (d) ('Amrit', ' ', 'Mahotsav @ 75')
[1]
Q6.
Which of the following mode keeps the file offset position at the end of the file?
  • (a) r+
  • (b) r
  • (c) w
  • (d) a
[1]
Page 1 of 7
Q7.
Fill in the blank. .............. function is used to arrange the elements of a list in ascending order. (a) sort() (b) arrange() (c) ascending() (d) asort()
[1]
Q8.
Which of the following operators will return either True or False? (a) += (b) != (c) = (d) *=
[1]
Q9.
Which of the following statement(s) would give an error after executing the following code? stud="Murugan":100, "Mithu":95 # Statement 1 print(stud[95]) # Statement 2 Stud["Murugan"]=99 # Statement 3 print(Stud.pop()) # Statement 4 print(Stud) # Statement 5 (a) Statement 2 (b) Statement 3 (c) Statement 4 (d) Statement 2 and 4
[1]
Q10.
Fill in the blank. ............. is a number of tuples in a relation. (a) Attribute (b) Degree (c) Domain (d) Cardinality
[1]
Q11.
The syntax of seek() is: fileobject.seek(offset[,referencepoint]) What is the default value of referencepoint? (a) 0 (b) 1 (c) 2 (d) 3
[1]
Q12.
Fill in the blank: .............. clause is used with SELECT statement to display data in a sorted form with respect to a specified column. (a) WHERE (b) ORDER BY (c) HAVING (d) DISTINCT
[1]
Q13.
Fill in blank: .............. is used for point-to-point communication or unicast communication such as radar and satellite. (a) INFRARED WAVES (b) BLUETOOTH (c) MICROWAVES (d) RADIOWAVES
[1]
Q14.
What will the following expression be evaluated to in Python? print(4+3*5/3-5%2) (a) 8.5 (b) 8.0 (c) 10.2 (d) 10.0
[1]
Q15.
Which function returns the sum of all elements of a list? (a) count() (b) sum() (c) total() (d) add()
[1]
Q16.
Fetchall() method fetches all rows in a result set and returns a: (a) Tuple of lists (b) List of tuples (c) List of strings (d) Tuple of strings
[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): To use a function from a particular module, we need to import the module. Reason (R): import statement can be written anywhere in the program, before using a function from that module.
[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): A stack is a LIFO structure. Reason (R): Any new element pushed into the stack always gets positioned at the index after the last existing element in the stack.
[1]
Section B

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

Q1.
Atharva is a Python programmer working on a program to find and return the maximum value from the list. The code written below has syntactical errors. Rewrite the correct code and underline the corrections made. def maxₙum(L): max=L(0) for a in L: if a > max max=a return max
[2]
Q2.
(a) Differentiate between wired and wireless transmission. OR (b) Differentiate between URL and domain name with the help of an appropriate example.
[2]
Q3.
(a) Given is a Python list declaration: Listofnames=["Aman", "Ankit", "Ashish", "Rajan", "Rajat"] Write the output of: print(Listofnames[-1:-4:-1]) (b) Consider the following tuple declaration: tup1=(10,20,30,(10,20,30),40) Write the output of: print(tup1.index(20))
[2]
Q4.
Explain the concept of "Alternate Key" in a Relational Database Management System with an appropriate example.
[2]
Q5.
(a) Write the full forms of the following: (i) HTML (ii) TCP (b) What is the need of Protocols?
[2]
Page 3 of 7
Q6.
(a) Write the output of the code given below: def shortsub(lst,n): for i in range(0,n): if len(lst)>4: lst[i]=lst[i]+lst[i] else: lst[i]=lst[i] subject=['CS', 'HINDI', 'PHYSICS', 'CHEMISTRY', 'MATHS'] shortsub(subject, 5) print(subject) OR (b) Write the output of the code given below: a=30 def call(x): global a if a%2==0: x+=a else: x-=a return x x=20 print(call(35), end="#") print(call(40), end="@")
[2]
Q7.
(a) Differentiate between CHAR and VARCHAR data types in SQL with appropriate example. OR (b) Name any two DDL and any two DML commands.
[2]
Section C

Short answer · 3 marks each · 5 of 5 shown

Q1.
(a) Consider the following tables - LOAN and BORROWER: Table: LOAN LOANNO BNAME AMOUNT L-170 DELHI 3000 L-230 KANPUR 4000 Table: BORROWER CUSTNAME LOANNO JOHN L-171 KRISH L-230 RAVYA L-170 How many rows and columns will be there in the natural join of these two tables? OR (b) Write the output of the queries (i) to (iv) based on the table, WORKER given below: TABLE: WORKER WID FNAME LNAME CITY STATE 102 SAHIL KHAN KANPUR UTTAR PRADESH 104 SAMEER PARIKH ROOP NAGAR PUNJAB 105 MARY JONES DELHI DELHI 106 MAHIR SHARMA SONIPAT HARYANA 107 ATHARVA BHARDWAJ DELHI DELHI 108 VEDA SHARMA KANPUR UTTAR PRADESH (i) SELECT FNAME, CITY FROM WORKER ORDER BY STATE DESC; (ii) SELECT DISTINCT(CITY) FROM WORKER; (iii) SELECT FNAME, STATE FROM WORKER WHERE LNAME LIKE 'HA%'; (iv) SELECT CITY, COUNT(*) FROM WORKER GROUP BY CITY;
[3]
Q2.
(a) Write the definition of a Python function named LongLines() which reads the contents of a text file named 'LINES.TXT' and displays those lines from the file which have at least 10 words in it. For example, if the content of 'LINES.TXT' is as follows: Once upon a time, there was a woodcutter He lived in a little house in a beautiful, green wood. One day, he was merrily chopping some wood. He saw a little girl skipping through the woods, whistling happily. The girl was followed by a big gray wolf. Then the function should display output as: He lived in a little house in a beautiful, green wood. He saw a little girl skipping through the woods, whistling happily. OR (b) Write a function countDwords() in Python to count the words ending with a digit in a text file "Details.txt". Example: If the file content is as follows: On seat2 VIP1 will sit and On seat1 VVIP2 will be sitting Output will be: Number of words ending with a digit are 4
[3]
Q3.
(a) Write the outputs of the SQL queries (i) to (iv) based on the relations COMPUTER and SALES given below: Table: COMPUTER PRODID PRODNAME PRICE COMPANY TYPE P001 MOUSE 200 LOGITECH INPUT P002 LASER PRINTER 4000 CANON OUTPUT P003 KEYBOARD 500 LOGITECH INPUT P004 JOYSTICK 1000 IBALL INPUT P005 SPEAKER 1200 CREATIVE OUTPUT P006 DESKJET PRINTER 4300 CANON OUTPUT Table: SALES PRODID QTYSOLD QUARTER P002 4 1 P003 2 2 P001 3 2 P004 2 1 (i) SELECT MIN(PRICE), MAX(PRICE) FROM COMPUTER; (ii) SELECT COMPANY, COUNT(*) FROM COMPUTER GROUP BY COMPANY HAVING COUNT(COMPANY) > 1; (iii) SELECT PRODNAME, QTYSOLD FROM COMPUTER C, SALES S WHERE C.PRODID=S.PRODID AND TYPE = 'INPUT'; (iv) SELECT PRODNAME, COMPANY, QUARTER FROM COMPUTER C, SALES S WHERE C.PRODID=S.PRODID; OR (b) Write the command to view all databases.
[3]
Page 4 of 7
Q4.
Write a functions EOReplace() in Python, which accepts a list L of numbers. Thereafter, it increments all even numbers by 1 and decrements all odd numbers by 1. Example: If Sample Input data of the list is: L=(10,20,30,40,35,55) Output will be: L=(11,21,31,41,34,54)
[3]
Q5.
(a) A list contains following record of customer. [Customerₙame, Room Type] Write the following user defined functions to perform given operations on the stack name 'Hotel': (i) PushCust() - To Push customer' names of those customers who are staying in 'Delux' Room Type. (ii) PopCust() - To Pop the names of customers from the stack and display them. Also, display "Underflow" when there are no customers in the stack. For example: If the lists with customer details are as follows: ["Siddarth", "Delux"] ["Rahul", "Standard"] ["Jerry", "Delux"] The stack should contain Jerry Siddharth The output should be: Jerry Siddharth Underflow OR (b) Write a function in Python, Push(Vehicles) where, Vehicle is a dictionary containing details of vehicles - (CarName: Maker). The function should push the name of car manufactured by "TATA" (including all the possible cases like Tata, TaTa, etc.) to the stack. For example: If the dictionary contains the following data: Vehicle="Santro":"Hyundai","Nexon":"TATA","Safari":"Tata" The stack should contain Safari Nexon
[3]
Section D

Long answer · 5 marks each · 3 of 3 shown

Q1.
Quickdev, an IT based firm, located in Delhi is planning to set up a network for its four branches within a city with its Marketing department in Kanpur. As a network professional, give solutions to the questions (i) to (v), after going through the branches locations and other details which are given below: DELHI BRANCH: Branch A, Branch B, Branch C, Branch D KANPUR BRANCH: Marketing Dep. Distance between various branches is as follows: Branch A to Branch B 40 m Branch A to Branch C 80 m Branch A to Branch D 65 m Branch B to Branch C 30 m Branch B to Branch D 35 m Branch C to Branch D 15 m Delhi Branch to Kanpur 300 km Number of computers in each of the branches: Branch A 15 Branch B 25 Branch C 40 Branch D 115 (i) Suggest the most suitable place to install the server for the Delhi branch with a suitable reason. (ii) Suggest an ideal layout for connecting all these branches within Delhi. (iii) Which devices will you suggest, that should be placed in each of these branches to efficiently connect all the computers within these branches? (iv) Delhi firm is planning to connect to its Marketing department in Kanpur which is approximately 300 km away. Which type of network out of LAN, WAN or MAN will be formed? Justify your answer. (v) Suggest a protocol that shall be needed to provide help for transferring of files between Delhi and Kanpur branch.
[5]
Page 5 of 7
Q2.
(a) What possible output(s) are expected to be displayed on screen at the time of execution of the following program: import random M=[5,10,15,20,25,30] for i in range(1,3): first=random.randint(2,5)-1 sec=random.randint(3,6)-2 third=random.randint(1,4) print(M[first],M[sec],M[third],sep="#") (i) 10#25#15 20#25#25 (ii) 5#25#20 25#20#15 (iii) 30#20#20 20#25#25 (iv) 10#15#25# 15#20#10# (b) The code given below deletes the record from the table employee which contains the following record structure: Ecode - String Eₙame - String Sal - Integer City - String Note the following to establish connectivity between Python and MySQL: Username is root Password is root The table exists in a MySQL database named emp The details (Ecode,Eₙame,Sal,City) are the attributes of the table. Write the following statements to complete the code: Statement 1 - to import the desired library. Statement 2 - to execute the command that deletes the record with Ecode as 'E101'. Statement 3 - to delete the record permanently from the database. import ______ as mysql #Statement 1 def delete(): mydb=mysql.connect(host="localhost",user="root", passwd="root",database="emp") mycursor=mydb.cursor() ______ # Statement 2 ______ # Statement 3 print("Record deleted") OR (a) Predict the output of the code given below: def makenew(mystr): newstr=" " count=0 for i in mystr: if count%2!=0: newstr=newstr+str(count) else: if i.lower(): newstr=newstr+i.upper() else: newstr=newstr+i count+=1 print(newstr) makenew("No@1") (b) The code given below reads the following records from the table employee and displays only those records who have employees coming from city 'Delhi': Ecode - String Eₙame - String Sal - Integer City - String Note the following to establish connectivity between Python and MySQL: Username is root Password is root The table exists in a MySQL database named emp. The details (Ecode,Eₙame,Sal,City) are the attributes of the table. Write the following statements to complete the code: Statement 1 - to import the desired library. Statement 2 - to execute the query that fetches records of the employees coming from city 'Delhi'. Statement 3 - to read the complete data of the query (rows whose city is Delhi) into the object named details, from the table employee in the database. import ______ as mysql # Statement 1 def display(): mydb=mysql.connect(host="localhost",user="root", passwd="root",database="emp") mycursor=mydb.cursor() ______ # Statement 2 details = ______ # Statement 3 for i in details: print(i)
[5]
Q3.
(a) Write one difference between CSV and text files. Write a program in Python that defines and calls the following user defined functions: (i) COURIERADD(): It takes the values from the user and adds the details to a csv file 'courier.csv'. Each record consists of a list with field elements as cid, sₙame, Source, destination to store Courier ID, Sender name, Source and destination address respectively. (ii) COURIERSEARCH(): Takes the destination as the input and displays all the courier records going to that destination. OR (b) Why is important to close a file before exiting? Write a program in Python that defines and calls the following user defined functions: (i) AddBook(): Takes the details of the books and adds them to a csv file 'Book.csv'. Each record consists of a list with field elements as bookID, Bₙame and pub to store book ID, book name and publisher respectively. (ii) SearchBook(): Takes publisher name as input and counts and displays number of books published by them.
[5]
Section E

Long answer · 4 marks each · 2 of 2 shown

Q1.
The school has asked their estate manager Mr. Rahul to maintain the data of all the labs in a table LAB. Rahul has created a table and entered data of 5 labs. LABNO LABNAME INCHARGE CAPACITY FLOOR L001 CHEMISTRY Daisy 20 I L002 BIOLOGY Venky 20 II L003 MATH Preeti 15 I L004 LANGUAGE Daisy 36 III L005 COMPUTER Mary Kom 37 II Based on the data given above answer the following questions: (i) Identify the columns which can be considered as Candidate keys. (ii) Write the degree and cardinality of the table. (iii) Write the statements to: (a) Insert a new row with appropriate data. (b) Increase the capacity of all the labs by 10 students which are on 'I' Floor. OR (Option for part (iii) only) (iii) Write the statements to: (a) Add a constraint PRIMARY KEY to the column LABNO in the table. (b) Delete the table LAB.
[4]
Page 6 of 7
Q2.
Shreyas is a programmer, who has recently been given a task to write a user defined function named writebin() to create a binary file called Custfile.dat containing customer information - customer number (cₙo), name (cₙame), quantity (qty), price (price) and amount (amt) of each customer. The function accepts customer number, name, quantity and price. Thereafter, it displays the message 'Quantity less then 10 ... Cannot SAVE', if quantity entered is less than 10. Otherwise the function calculates amount as price*quantity and then writes the record in the form of a list into the binary file. import pickle def writebin(): binfile=______ # Statement 1 while true: cₙo=int(input("enter customer number")) Cₙame=input("enter customer name") qty=int(input("enter qty")) price=int(input("enter price")) if ______ # Statement 2 print("Quantity less than 10..Cannot SAVE") else: amt=price * qty cdetail=[cₙo,cₙame,qty,price,amt] ______ # Statement 4 ______ # Statement 5 ______ # Statement 6 (i) Write the correct statement to open a file 'Custfile.dat' for writing the data of the customer. (ii) Which statement should Shreyas fill in Statement 2 to check whether quantity is less than 10. (iii) Which statement should Shreyas fill in Statement 3 to write data to the binary file and in Statement 4 to stop further processing if the user does not wish to enter more records. OR (Option for part (iii) only) (iii) What should Shreyas fill in Statement 5 to close the binary file named Custfile.dat and in Statement 6 to call a function to write data in binary file?
[4]
Page 7 of 7