Class 12 Computer Science Sample Paper Set 4
Class 12 Computer Science Sample Paper Set 4
Join School of Educators' exclusive WhatsApp, Telegram, and Signal groups for FREE access
to a vast range of educational resources designed to help you achieve 100/100 in exams!
Separate groups for teachers and students are available, packed with valuable content to
boost your performance.
Additionally, benefit from expert tips, practical advice, and study hacks designed to enhance
performance in both CBSE exams and competitive entrance tests.
Don’t miss out—join today and take the first step toward academic excellence!
COMPUTER SCIENCE
All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one
of the choices in such questions.
Section A
1. State true or false: [1]
A dictionary can contain keys of any valid Python types.
2. Which of the following command is used to remove the table definition and all data? [1]
a) Choose b) Drop
c) Create d) Select
3. User can write Python script using [1]
a) 1 b) 3
c) 2 d) 0
7. For readline(), a line is terminated by [1]
a) 'n\' b) '\n'
a) String b) Tuple
c) Dictionary d) List
9. Which operator tests the column for the absence of data (i.e., NULL value)? [1]
a) Push b) Pop
c) Pump d) Pull
13. Write an SQL statement to create a PRIMARY KEY constraint on the "P_Id" column of table Persons, when the [1]
table is already created.
14. A ________ is a network point that acts as an entrance to another network. [1]
a) Hub b) Repeater
c) Gateway d) Bridge
15. Which of the following operator cannot be used with string data type? [1]
a) * b) in
c) / d) +
16. A relational database consists of a collection of ________. [1]
a) Attributes b) Tuples
c) Keys d) Relations
17. Which of the following is not the possible ways of data exchange? [1]
a) Multiplex b) Simplex
c) Half-duplex d) Full-duplex
18. Frequency is measured in [1]
a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.
a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.
a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.
t1= (4, 7, 8, 9)
t2=(0, 4, 3)
i. >>>t=t1+t2
>>>print(t)
ii. >>>t=t1*t2
>>>print(t)
25. Consider the table MobileStock with following fields [2]
M_Id, M_Name, M_Qty, M_Supplier
Write the Python code to fetch all records with fields M_Id, M_Name and M_Supplier from database Mobile.
26. Find the errors. State reasons. [2]
for Name in [Amar, Shveta, Parag]
IF Name[0] = 'S' :
print(Name)
OR
Explain the term bubble sorting.
27. Considering the following definition of dictionary MULTIPLEX, write a method in python to search and display [2]
all the content in a pickled file CINEMA.DAT, where MTYPE key of the dictionary is matching with the value
'Comedy'.
MULTIPLEX = {'MNO' : ________, 'MNAME' : ________, 'MTYPE' : ________}
OR
Write a function in Python to count the number of lowercase and uppercase characters in a text file "Book.txt".
28. How can we import a module in Python? [2]
Section C
29. Explain the use of global keywords used in a function with the help of a suitable example. [3]
OR
Write definition of a method EvenSum(NUMBERS) to add those values in the list of NUMBERS, which are not odd.
30. Tanya Khanna is using a table Employee. It has the following columns: [3]
Admno., Name, Agg, Stream
[column Agg contains Aggregate marks]
She wants to display highest Agg obtained in each Stream.
She wrote the following statement :
SELECT Stream, MAX(Agg) FROM Employee ;
But she did not get the desired result. Rewrite the above query with necessary changes to help her get the desired
output.
OR
How to create a database?
31. Write a function that takes a sorted list and a number as an argument. Search for the number in the sorted list [3]
using binary search.
OR
Find the errors in code given below:
i. def minus(total, decrement)
output = total - decrement
print(output)
return (output)
ii. define check()
N = input ('Enter N:')
i=3
answer = 1 + i * * 4/N
Return answer
iii. def alpha(n, string = 'xyz', k = 10) :
return beta(string)
return n
def beta (string)
return string == str(n)
print(alpha("Valentine's Day"):)
print(beta (string = 'true'))
print(alpha(n=5, "Good-bye") :)
Section D
32. Write a program to implement a stack for these book details (book no., book name). That is, now each item node [4]
of the stack contains two types of information - a book no. and its name. Just implement Push and display
operations.
OR
Write the Push operation of stack containing person names. Notice that the name should only accept characters,
spaces and period (.) except digits. Assume that Pname is a class instance attribute.
33. Write one difference between CSV and text files. [4]
Write a program in Python that defines and calls the following user defined functions:
i. COURIER_ADD () : 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 name, Source, destination to store Courier ID, Sender
name, Source and destination address respectively.
ii. COURIER_SEARCH () : Takes the destination as the input and displays all the courier records going to that
destination.
34. What do you understand by Candidate Keys in a table? Give a suitable example of Candidate keys from a table [4]
containing some meaningful data.
OR
Give output for following SQL queries as per given table(s) :
Table: Books
Table: Issued
Book_Id Quantity_Issued
T0001 4
C0001 5
F0001 2
Paediatrics unit 40
Neurology unit 50
Orthopedics unit 80
i. Suggest the most suitable location for the main server of this institution to get efficient connectivity.
ii. Suggest the cable layout for effective network connectivity of the building having a server with all the other
buildings.
iii. Suggest a device to be installed in each of these building for connecting computers installed within the
building out of the following:
Gateway
Modem
Switch
iv. Suggest the topology of the network and network cable for efficiently connecting in each of the building one
of the following: Topologies: Bus Topology, Star Topology, Network Cable: Single Pair Telephone Cable,
Coaxial Cable, Ethernet Cable.
37. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), Which are based on the table. [5]
Table: CUSTOMER
CNO CNAME ADDRESS
Table: TRANSACTION