Computer Science PRE BOARD QP 2022 23
Computer Science PRE BOARD QP 2022 23
Computer Science PRE BOARD QP 2022 23
91
SECTION - A
1. Which of the following statements is not correct? 1
a) An element in a dictionary is a combination of key-value pair.
b) A tuple is a mutable data type.
c) We can repeat a key in a dictionary.
d) clear() function is used to delete the dictionary.
a) + b) ** c) > d) and
1 / 11
5. What is the output of the following code? 1
x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)
a) [‘AB’, ‘CD’].
b) [‘ab’, ‘cd’, ‘AB’, ‘CD’].
c) [‘ab’, ‘cd’].
d) no output
6. Suppose the content of a text file “notes.txt” is “The.way to get started is to quit 1
talking and begin doing”, What will be the output of the following Python code?
F=open(“notes.txt”)
F.seek(29)
S=F.read()
print(S)
(a) The.way to get started is to
(b) quit talking and begin doing
(c) The.way to get started is to quit talking and begin doing
(d) gniod nigeb dna gniklat tiuq ot si detrats teg ot yaw eht
2 / 11
11. Which of the following commands can be used to read “n” number of characters 1
from a file using the file object <File>
(a) File.read(n) (b) N=file.read()
(c) File.radline(n) (d) File.readlines()
14. Suppose the content of “rhymes.txt” is Good Morning Madam. What will be the 1
output of the Python code?
F=open(“rhymes.txt”)
L=F.read().split()
for i in L:
if i.lower()==i[: : -1].lower():
print(i)
15. Which operator defines a range of values that a column value must fall within? 1
(a) Between (b) like (c) IN (d) ISNULL
16. In which of the following case a DML command is not executed? 1
a) When a new record is added.
b) When an existing record is modified.
c) When an existing attribute is modified.
d) When records are deleted.
Q17 and 18 are ASSERTION AND REASONING-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
17. Assertion (A): -The readline() method reads one complete line from a text file. 1
Reasoning (R): - The readline() method reads one complete line at a time along
with a newline(\n). It can also be used to read a specified number (n) of bytes of
data from a file but maximum upto newline(\n) character.
3 / 11
18. Assertion (A): - A stack is a linear data structure, that stores elements in First in 1
First out order.
Reasoning (R): - New element is added at one end and the element is removed
from that end only.
SECTION – B
19. Nitish has written a code in python to display all prime numbers between m and n, 2
where m and n have to be input from the user. His code is having errors. Rewrite
the correct code and underline the corrections made.
OR
(b) Out of the following, which is the fastest wired medium of communication?
Coaxial cable, ethernet cable, infrared, microwave, Optical fibre.
4 / 11
24. Find and write the output of the following code: 2
OR
OR
SECTION - C
26. Consider the following tables – Student and Stream
Table- Student
5 / 11
Table-Stream
Streamid Sname
10 Medical
20 NonMedical
30 Commerce
40 Humanties
(a) What will be the output for the following statement? 1
(b) Write the output of the queries (i) to (iv) based on the table student: 2
iii. Select count(*) from student where class = “XII” and streamed = 10;
27. Write a user-defined function to display the total number of words present in the 3
file “quotes.txt”
OR
Write a function countmy() in python to read the text file “data.txt” and count the
number of times “my” occurs in the file.
28. (a) Write the outputs of the SQL queries (i) to (iv) based on the relations Handsets 2
and customer given below:
Table: Handsets
Setcode Setname Touchscreen Phonecost
N1 Nokia 2G N 5000
N2 Nokia 2G Y 8000
B1 Blackberry N 14000
Table: Customer
Custno Setno Custaddress
1 N2 Delhi
2 B1 Mumbai
3 N2 Mumbai
4 N1 Kolkata
5 B1 Delhi
6 / 11
i. SELECT CUSTNO, CUSTADDRESS, SETNAME FROM HANDSETS H, CUSTOMER C
WHERE H.SETCODE = C.SETNO;
29. Write a Python program to input 10 numbers from the user and store it in a list. 3
Add all the elements present at the odd indices of the list.
30. Write a function in Python push(Arr), where Arr is a list of numbers. From this list 3
push all numbers multiple of 6 into a stack implemented by using a list. Display the
stack if it has at least one element, otherwise display an appropriate error
message.
OR
Write a function pop(Arr) in Python where Arr is a stack implemented by a list of
numbers. The function returns the value deleted from the stack.
SECTION - D
31. The company Mega enterprises has 4 wings of buildings as shown in the diagram. 5
W1 W2
W3 W4
Computers in each wing are networked but the wings are not networked. The
company has now decided to connect the wings also.
Center to center distances between Number of computers in each of
various buildings the wings
W3 to W1- 50m
W1 to W2- 60m W1-150
W2 to W4- 25m W2-15
W4 to W3- 170m W3-15
W3 TO W2- 125m W4-24
W1 to W4- 90m
7 / 11
(a) Suggest the most suitable cable layout for the above connections.
(b) Suggest the most appropriate topology of the connection between the wings.
(c) The company wants internet accessibility in all the wings. Suggest a suitable
technology.
(d) Suggest the placement of the following devices with justification if the
company wants minimized network traffic.
(i) Repeater (ii) Hub or switch
(e) The company is planning to link its head office situated in New Delhi with the
offices in the hilly areas. Suggest a way to connect it economically.
8 / 11
OR
(a) Predict the output of the following:-
Find the output of the following code:
def ChangeVal(M,N):
for i in range(N):
if M[i]%5 == 0:
M[i] //=5
if M[i]%3 == 0:
M[i]//=3
L = [25,8,75,12]
ChangeVal(L,4)
for i in L:
print(i, end = "#")
(b) The code given below updates the records of employees by increasing salary
by ₹ 1000 for all those employees who are getting less than 80000. The table
name is emp. Write the following missing statements to complete the code:
33. When do you think binary files should be preferred over text files? 5
Create a CSV file “Groceries” to store information on different items existing in a
shop. The information is to be stored with respect to each item code, name, price,
and qty. Write a program to accept the data from the user and store it
permanently in a CSV file and also display the stored data.
OR
Genesis Infotech plans to develop a computerized system for payroll processing of
all its employees for storing salary details. Develop a Python program which stores
data in “employee.csv”, calculates and displays total salary remitted to its
employee. The details to be stored are [empno, name, salary]
9 / 11
SECTION - E
34 Krishna, working as a computer professional in a hospital, creates a table OPD to
store records of patients registered in the OPD section. A sample of the records is
given below:
Table: OPD
RegNo Name Age Department Dateof_Reg Charges Gender RoomNo
R0123 Arpita 62 Gen. 2022-01-21 500 M 10
Physician
R0124 Jai 22 ENT 2022-10-12 300 M 15
R0125 Kamal 32 Orthopaedic 2022-02-19 500 M 11
(i) If the table “OPD” is to be linked with another table “Registration” in the same 1
database named “Hospital”, then identify the most appropriate column which can
be used as a Foreign key in the “Registration” table.
(ii) What is the cardinality and degree of the given table? 1
(iii) Write the statements to:
(a) Insert the following record into the table: 1
RegNo–R130, Name–Naman, Age–30, Department–ENT, Dateof_Reg–
2022-10-10, Charges–700, Gender–M, Roomno-12
(b) Increase the OPD Charges of the ENT department by ` 200. 1
35. You are a student in CBSE school. Teacher has given a task to write a python code
to create a binary file called school.dat containing student information(in list data
type)- student number, name, marks(out of 100) of each student. This binary file
operation is performed with the help of user defined function addrecord(). You
need to write the code in the missing statement.
10 / 11
student=[]
f=open(______________) #statement 2
ch=’y’
while ch== ‘y’:
stno= int(input(“Enter student number”))
sname=input(“Enter name”)
marks=int(input(“Enter marks”))
s=[stno,sname,marks]
student.________(s) #statement 3
ch=input(“want to add more records(y/n)”)
pickle.___________ #statement 4
f.close()
********************************************************************************
11 / 11