केन्द्रीय विद्यालय संगठन
प्रथम प्री बोर्ड परीक्षा-2024-25
KENDRIYA VIDYALAYA SANGATHAN
AGRA REGION
First - Pre Board Examination-2024-25
XII ( COMPUTER SCIENCE)
Max. Time – 3 hours Max. Marks – 70
-3 – 70
Instructions:-
●This question paper contains 37 questions.
●All questions are compulsory. However, internal choices have been provided in
some questions. Attempt only one of the choices in such questions
●The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.
Section-A (21 x 1 = 21 Marks) Mar
Q. No.
ks
1. State True or False: (1)
As a Dictionary is mutable, both Key & Value are also mutable.
2. Identify the output of the following code snippet: (1)
remark = "SQL - Structured Query Language"
note = remark[2:18].split()
print(note)
(A) ['L', '-', 'Structured', 'Qu']
(B) ['L', '-', 'Structured', ' ']
PAGE NO. 1 OF 14
(C) ['L', '-', 'Structured', 'Q']
(D) 'L – Structured Q'
3. Write the output of the following python expression: (1)
print ((4>5) and (2!=1) or (4<9))
(A) Run Time Error
(B) Logical Error
(C) False
(D) True
4. What is the output of the expression? (1)
STR=”trip@split”
print(STR.rstrip(“t”))
(A) rip@spli
(B) trip@spli
(C) rip@split
(D) rip@spli
5. What will be the output of the following code snippet? (1)
gist=”Old is Gold”
X=gist.partition(“s”)
print(X[-1:-3])
(A) ()
(B) (' Gold')
(C) (' Gold', 'is')
(D) None of the above
6. What will be the output of the following code? (1)
MainList = ["One", ["2", "3"], "4"]
PAGE NO. 2 OF 14
CheckList = [ MainList[1] ]
print(CheckList)
(A) [“2”]
(B) [“2”, ”3”]
(C) [ [“2”,”3”] ]
(D) Syntax Error
7. If “dict” is a dictionary as defined below, then which of the (1)
following statements will raise an exception?
dict = {'Rose': 10, 'Lily': 20, 'Sunflower': 30}
(A) dict.get('Sunflower')
(B) print(dict['Rose', 'Lily'])
(C) dict['Rose']=40
(D) print(str(dict))
8. Identify the invalid python statement from the following: (1)
(A) t=(100)
(B) t=tuple()
(C) t=(100,)
(D) None of the above
9. Choose the correct statement from the following about a primary (1)
key column:
(A) Cannot have NULL values and can have UNIQUE values.
(B) Can have NULL as well as UNIQUE values.
(C) Cannot have NULL and cannot have UNIQUE values.
(D) Can have NULL but not UNIQUE values.
10. Consider the following python statement: (1)
F=open(“TEST.txt”)
PAGE NO. 3 OF 14
Which of the following is an invalid statement in python?
(A) F.seek(0)
(B) F.write(“PASS”)
(C) F.read()
(D) None of the above
11. State whether the following statement is True or False: (1)
“More than one exception is not allowed in a single try
block.”
12. What will be the output of the following code: (1)
Local=100
def Update(Global=0):
global Local
Local += Global
print(Local, ”#”, Global)
Update(50)
Update()
13. Which SQL command can decrease Cardinality of a Relation? (1)
14. What will be the output of the query? (1)
“SELECT name FROM student WHERE name like ‘%ar%’;
(A) Display name of students whose name ends with ‘ar’.
(B) Display details of students whose name ends with ‘ar’.
(C) Display name of students whose name has ‘ar’ anywhere in
name.
(D) Display details of students whose name has ‘ar’ anywhere in
PAGE NO. 4 OF 14
name.
15. Ms. Meera(a database administrator) is thinking to create a column (1)
in a table in which she wants to give the DATA TYPE in such a
manner that column contains maximum of 20 characters but
memory of ONLY of the actual values/characters entered by the
user is occupied. Which data type she should prefer for the column
from the following?
(A) LONG
(B) CHAR
(C) VARCHAR
(D) DATE
16. Which one of the following SQL clauses is always used in the end (1)
of any SQL query?
(A) WHERE
(B) ORDER BY
(C) HAVING
(D) GROUP BY
17. Which protocol is used for downloading & uploading files over the (1)
Internet?
(A) HTTP
(B) VoIP
(C) FTP
(D) SMTP
18. Which network device is used to make coming weak signals into (1)
strong and then forward?
(A) HUB
(B) SWITCH
(C) MODEM
(D) REPEATER
PAGE NO. 5 OF 14
19. ________________ is the structure/arrangement of computers (1)
connected in a network.
Q20 and Q21 are Assertion (A) and Reason(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.
20. Assertion(A): Default arguments in a function are used to assign values (1)
to such parameters in which values are not passed at the time of
function call.
Reason(R): It is mandatory to have default values to all parameters
coming on right side of any default parameter in the function header.
21. Assertion(A): A column size may be updated in an already created (1)
relation.
Reason(R): The size of the column may be increased by using
UPDATE SQL command.
Section-B ( 7 x 2=14 Marks) Mar
Q. No.
ks
22. What is the use of “in” operator? Identify from the following in which (2)
“in” operator may be used:-
“ONE”, (1), [1,2,3], 23
`23. Consider the following python code snippet: (2)
for C in range(1,10): # Statement-1
if C>5: # Statement-2
PAGE NO. 6 OF 14
print(C ,end="") # Statement-3
break # Statement-4
Write the output of the above code in the following 2 cases:
1. Statement-4 is a comment &
2. Statement-4 is not a comment.
24. Consider the given below Lists L1 & L2 and answer the following (2)
using built-in function only:
L1 = [10, 10, 20, 10, 30, 20]
L2 = [0, 1, 2, 1, 2, 0, 1]
1. (a) Write python command to delete last element from list L2.
OR
(b) Write python command to count 20 from list L1.
2. (a) Write python command to add [1, 0, 2] in the end of list L2.
OR
(b) Write python command to sort list L1 in ascending order.
25. What possible outputs(s) are expected to be displayed on screen at (2)
the time of execution of the program from the following code? Also
specify the maximum values that can be assigned to each of the
variables BEG and END.
(A) 30@
PAGE NO. 7 OF 14
(B) 10@20@30@40@50@
(C) 20@30
(D) 40@30@
26. Rewrite the following code in Python after removing all syntax (2)
error(s). Underline each correction done in the code.
Y=integer(input(“Enter 1 or 10”))
if Y==10
for Y in range(1,11):
print(Y)
elseif Y<10:
for m in range(5,0,-1):
print(thank you)
27. 1. (a) What constraint should be applied on a table column so that (2)
value entered by the user in that column must be in a specified
range of values not outside it?
OR
(b) What constraint should be applied on a table column so that
the column must not have NULL values & duplicate values?
2. (a) Write the SQL command to list the names of all the tables
already created in the database.
OR
(b) Write the SQL command to list the details(all column names,
data type, size, constraint) of a table “PLAYER”.
28. (A) Expand MODEM. Write the use of MODEM in networking. (2)
PAGE NO. 8 OF 14
OR
(B) Expand XML. Write one benefit of XML over HTML.
Section-C ( 3 x 3 = 9 Marks) Mar
Q. No.
ks
29. Write a function COUNTLINES_ET() in python to read lines from a (3)
text file REPORT.TXT and COUNT those lines which are starting
either with ‘E’ and ‘T’ respectively. And display the Total count
separately.
For example: if REPORT.TXT consists of
“ENTRY LEVEL OF PROGRAMMING CAN BE LEARNED FROM
PYTHON. ALSO, IT IS VERY FLEXIBLE LANGUGAE. THIS WILL BE
USEFUL FOR VARIETY OF USERS.”
Then, Output will be:
No. of Lines with E: 1
No. of Lines with T: 1
OR
Write a function SHOW_TODO() in python to read contents from a
text file XYZ.TXT and display those lines which have occurrence of
the word ‘‘TO’’ or ‘‘DO’’.
For example : If the contents of the file are:
“THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF
HARD WORK. WE ALL ARE EXPECTED TO DO HARD WORK.
PAGE NO. 9 OF 14
AFTER ALL, EXPERIENCE COMES FROM HARDWORK.”
The function should display lines:
THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE
RESULT OF HARD WORK.
WE ALL ARE EXPECTED TO DO HARD WORK.
30. (A) A stack named Emp_Stack that contains records of Employees. (3)
Each Employee record is represented as a list containing
[Emp_No, Emp_Name, Salary]
Write the following user-defined functions in Python to perform the
specified operations on the stack Emp_Stack:
(I) Push_Emp(Emp_Stack, New_Emp): This function takes the
stack Emp_Stack and a new employee record New_Emp as
arguments and pushes the new employee record onto the
stack.
(II) Pop_Emp(Emp_Stack): This function pops the topmost
employee record from the stack and returns it. If the stack is
already empty, the function should display "Underflow".
(III) Peep(Emp_Stack): This function displays the topmost
element of the stack without deleting it. If the stack is empty,
the function should display 'None'.
OR
(B) A dictionary named D_STATE contains the record in the following
format:
{ Country : State }
Also, a stack name STATE(a list) will store the names of the states.
PAGE NO. 10 OF 14
Define the following functions with the given specifications:
(I) Push_State(D_STATE): It takes the dictionary as an
argument and pushes all the states in the stack STATE whose
state name is less than 10 characters.
(II) Pop_State(): This function pops the topmost state from the
stack STATE and returns it. Also, if the stack is already
empty, the function should display "Empty".
(III) Disp_State(): To display all elements of the stack STATE
without deleting them. If the stack is empty, the function
should display 'None'.
31. Predict the output of the following code: (3)
Msg="CompuTer"
Msg1=””
for I in range(0, len(Msg)):
if Msg[I].isupper():
Msg1=Msg1+Msg[I].lower()
elif I%2==0:
Msg1=Msg1+'*'
else:
Msg1=Msg1+Msg[I].upper()
print(Msg1)
OR
tuple1 = (11, 22, 33, 44, 55 ,66)
list1 =list(tuple1)
PAGE NO. 11 OF 14
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)
Section-D ( 4 x 4 = 16 Marks) Mar
Q. No.
ks
32. Consider the table SURGERY as given below: (4)
SID SNAME FEES STARTDATE OTNO
S301 HEART 15000 2021-11-15 302
S302 LIMBS 9000 2021-10-20 NULL
S303 LEVER 10000 2023-07-02 301
S304 KIDNEY 5000 2024-08-01 NULL
S305 STOMOCH 18000 2024-03-25 302
(A) Write SQL queries for the following:
I. To display contents of SURGERY table sorted by STARTDATE in
descending order.
II. To display the sum of FEES of all the SURGERYs for which the
OTNO is NULL.
III. To display the SURGERY ID & FEES of SURGERYs whose
name starts with “D”.
IV. To display the no. of SURGERYs whose FEES is less than 12000
and OTNO is not “301”.
OR
(B) Write the output of the given below SQL queries:-
PAGE NO. 12 OF 14
I. SELECT DISTINCT OTNO FROM SURGERY;
II. SELECT OTNO, COUNT(*), MIN(FEES) FROM SURGERY
GROUP BY OTNO HAVING COUNT(OTNO)>1;
III. SELECT SNAME FROM SURGERY WHERE FEES>=15000
ORDER BY SNAME;
IV. SELECT AVG(FEES) FROM SURGERY WHERE FEES
BETWEEN 15000 AND 19000;
33. A csv file "Population.csv" contains the population data of various cities. (4)
Each record of the file contains the following data:
● ID of the city
● Name of the city
● Population of the city
● Area(in sq. mtrs.) of the city
For example, a sample record of the file may be:
[‘C001’, ‘Jaipur’, 697000, 5000]
Write the following Python functions to perform the specified operations
on this file:
(I) Read all the data from the file in the form of a list and display
all those records for which the population is more than
200000.
(II) Count & display the number of cities whose data is stored in
the file.
34. Write SQL commands for the following queries (i) to (iv) based on (4)
the relations TRAINER & COURSE given below:
PAGE NO. 13 OF 14
I. Display all details of Trainers who are living in city CHENNAI.
II. Count and Display the number of Trainers in each city.
III. Display the Course details which have Fees more than 12000
and name ends with ‘A’.
IV. (A) Display the Trainer Name & Course Name from both tables
where Course Fees is less than 10000.
OR
(B) Display the Cartesian Product of above two tables.
35. A table, named PRODUCT, in PRO_DB database, has the following (4)
structure:
Attribute Name Data Type
PID int(6)
PNAME Varchar(20)
COMPANY Varchar(20)
PRICE Float
Write the following Python function to perform the specified operation:
AddNewProduct(): To input details of Product and store it in the table
PRODUCT. The function should then retrieve and display all records
PAGE NO. 14 OF 14
from the PRODUCT table where the Price is less than 250.
Assume the following for Python-Database connectivity:
(Host: localhost, User: root, Password: Time)
SECTION E (2 X 5 = 10 Marks) Mar
Q. No.
ks
36. Manan, an Exam in-charge of a college is planning to keep record (5)
of various Tests which are going to be held. For this, he wants the
following information of each Test to be stored:
TestId – integer
Subject – string
MaxMarks – integer
ScoredMarks – integer
You, as a programmer of the college, have been assigned to do this
job for Manan. A binary file named “TEST.dat” has some records of
the structure [TestId, Subject, MaxMarks, ScoredMarks]
(I) Write a function named NewTest() to input the data of a TEST
and append it in TEST.dat binary file.
(II) Write a function named UpdateMM(Sub) that will update the
MaxMarks of Tests by 10 of Subject entered as argument in
function.
(III) Write a function in Python named DisplayAvgMarks(Sub)
that will accept a subject as an argument and read the
contents of TEST.dat. The function will calculate & display the
Average of the ScoredMarks of the passed Subject on screen
37. “VidyaDaan” an NGO is planning to setup its new campus at Nagpur for (5)
PAGE NO. 15 OF 14
its web-based activities. The campus has four(04) UNITS as shown
below:
Distances between above UNITs are given as under:
UNIT-1 UNIT-2 DISTANCE(In mtrs.)
ADMIN TRAINING 65
ADMIN RESOURCE 120
ADMIN FINANCE 100
FINANCE TRAINING 60
FINANCE RESOURCE 40
TRAINING RESOURCE 50
No. of Computers in various UNITs are:
UNIT NO. OF COMPUTERS
ADMIN 150
FINANCE 25
TRAINING 90
RESOURCE 75
I. Suggest an ideal cable layout for connecting the above UNITs.
II. Suggest the most suitable place i.e. UNIT to install the server for
the above NGO.
III. Which network device is used to connect the computers in all
PAGE NO. 16 OF 14
UNITs?
IV. Suggest the placement of Repeater in the UNITs of above
network.
V. (A) NGO is planning to connect its Regional Office at Kota,
Rajasthan. Which out of the following wired communication, will
you suggest for a very high-speed connectivity?
(a)Twisted Pair cable (b) Ethernet cable (c) Optical Fiber
OR
(B) What type of network (PAN, LAN, MAN, or WAN) will be set
up among the computers connected in the NAGPUR campus?
***************
PAGE NO. 17 OF 14