12 CS RevisionPapers2025
12 CS RevisionPapers2025
12 CS RevisionPapers2025
ु म ांक/ROLL NO सेट/SET : 01
elif Text[i].islower():
L=L+Text[i].upper()
elif Text[i].isdigit():
L=L+(Text[i]*2)
else:
L=L+'#'
print(L)
(A)hAPPY#HOUR1122#33
(B)Happy#hOUR12#3
(C)hAPPY#HOUR112233
(D)Happy Hour11 22 33 #
3 Consider the given expression: 1
17%5==2 and 4%2>0 or 15//2==7.5
Which of the following will be correct output if the given expression is evaluated?
(a)True (b) False (c)None (d)Null
4 Select the correct output of the code: 1
s = "Question paper 2022-23"
s= s.split('2')
print(s)
a. ['Question paper ', '0', '', '-', '3']
b. ('Question paper ', '0', '', '-', '3')
c. ['Question paper ', '0', '2', '', '-', '3']
d. ('Question paper ', '0', '2', '', '-', '3')
5 What will be the output of following code if 1
a = “abcde”
a [1:1 ] == a [1:2]
type (a[1:1]) == type (a[1:2])
6 Select the correct output of the code: 1
a = "foobar"
a = a.partition("o")
print(a)
(a) ["fo","","bar"]
(b) ["f","oo","bar"]
(c) ["f","o","bar"]
(d) ("f","o","obar")
7 State whether the following statement is True or False: 1
An exception may be raised even if the program is syntactically correct.
8 1
Identify the output of the following python code: 1
D={1:"one",2:"two", 3:"three"}
L=[]
for k,v in D.items():
if 'o' in v:
L.append(k)
print(L)
(a) (10,20) (b) (10,) (c) (10) (d) All are tuples.
10 1
Which of the following is the correct usage for tell() of a file
object,………………….?
1
a) It places the file pointer at the desired offset in a file.
b) It returns the byte position of the file pointer as an integer.
c) It returns the entire content of the file.
d) It tells the details about the file.
11 What will be the output of the following Python code snippet? 1
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 > d2
a. True b. False
c. Error d. None
12 Consider the code given below: 1
b=5
def myfun(a):
# missing statement.
b=b*a
myfun(14)
print(b)
Which of the following statements should be given in the blank for #
Missing statement, if the output produced is 70?
a. global a b. global b=70
c. global b d. global a=70
13 Which of the following commands is not a DDL command? 1
1
(a) DROP (b) DELETE (c) CREATE (d) ALTER
14 Which of the following keywords will you use in the following query to 1
display the unique values of the column dept_name?
SELECT --------------------- dept_name FROM Company;
(a)All (b) key (c) Distinct (d) Name
15 What is the maximum width of numeric value in data type int of MySQL. 1
a. 10 digits b. 11 digits
c. 9 digits d. 12 digits
16 SUM(), AVG() and COUNT() are examples of functions. 1
1
a) single row functions
b) aggregate functions
c) math function
d) date function
17 is a standard mail protocol used to receive emails from a remote server 1
to a local email client.
18 Pawan wants to transfer files and photos from laptop to his mobile. He uses 1
Bluetooth Technology to connect two devices. Which type of network will be
formed in this case.
a. PAN b. LAN
c. MAN d. WAN
19 Fill in the blank: 1
In case of switching, message is send in stored and forward manner from
sender to receiver.
Q20 and 21 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
20 Assertion (A): The default argument values in Python functions can be mutable 1
types like lists and dictionaries.
Reason (R): Mutable default arguments retain their state across function calls,
which can lead to unexpected behaviour.
21 Assertion (A): The HAVING clause in MySQL is used to filter records after the 1
GROUP BY operation.
Reason (R): The WHERE clause filters records before grouping, while HAVING
allows for conditions on aggregated data.
SECTION
B
22 Write difference between mutable and immutable property, Explain it with 2
its example.
23 Predict the output of the Python 2
code given below:
T = (9,18,27,36,45,54)
L=list(T)
L1 = [ ]
for i in L:
if i%6==0:
L1.append(i)
T1 = tuple(L1)
print(T1)
24 Write the Python statement for each of the following tasks using 2
BUILT-IN functions/methods only:
(i) To insert an element 400 at the fourth position, in the list L1.
(ii) To check whether a string named, message ends with a full stop/
period or not.
OR
OR
(i) Define the term baud with respect to networks.
(ii) How is http different from https?
SECTION C
29 Write a user – defined function countH() in Python that displays the number 3
of lines starting with ‘H’ in the file ‘Para.txt”. Example , if the file contains:
Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.
Output: The line count should be 2.
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. For example , if the file
“DATA.TXT” contains –
“This is my website. I have displayed my preference in the CHOICE
section.” The countmy( ) function should display the output as:
“my occurs 2 times”
30 3
Aalam has created a list, L containing marks of 10 students. Write a
program, with separate user defined function to perform the following
operation:
3
PUSH()- Traverse the content of the List, L and push all the odd marks into
the stack,S.
31 3
Consider the table ACTIVITY given below:
ACODE ACTIVITYNA PARTICIP PRIZEMONEY SCHEDULED
ME ANTS TE
NUM
1001 Relay Name 16 10000 2004-01-23
1002 High Jump 10 12000 2003-12-12
1003 Shot Put 12 8000 2004-02-14
1005 Long Jump 12 9000 2004-01-01
1008 Discuss Throw 10 15000 2004-03-19
Based on the given table, write SQL queries for the following:
(i) Display the details of all activities in which prize money is more than
9000 (including 9000)
(ii) Increase the prize money by 5% of those activities whose schedule
date is after 1st of March 2023.
(iii) Delete the record of activity where participants are less than 12.
SECTION D
32 You have learnt how to use math module in Class XI. Write a code where you 4
use the wrong number of arguments for a method (say sqrt() or pow()). Use
the exception handling process to catch the ValueError exception.
33 Write a python program to create a csv file dvd.csv and write 10 records in it 4
Dvdid, dvd name, qty, price. Display those dvd details whose dvd price is
more than 25.
34 Consider the following tables and answer the questions a and b: 1*4=4
Table: Garment
GCode GNam e Rate Qty CCode
31 Based on the given table, write SQL queries for the following:
(i) Select * from activity where prizemoney >=9000;
(ii) Update activity set prizemoney=prizemoney*1.05
where scheduledate>’2004-03-01’;
(iii) Delete from activity where participantsnum<12
SECTION-D
32 import math 4
try:
result = math.pow(2, 3, 4, 5) # pow() expects 2 arguments,
# but 4 are provided
except TypeError:
print("TypeError occurred with math.pow()")
else:
print("Result:", result)
try:
result = math.sqrt(9, 2) # sqrt() expects 1 argument,
# but 2 are provided
except TypeError:
print("TypeError occurred with math.sqrt()")
else:
print("Result:", result)
33 import csv 4
f=open("pl.csv","w")
cw=csv.writer(f)
ch="Y"
while ch=="Y":
l=[]
pi=int(input("enter dvd id "))
pnm=input("enter dvd name ")
sp=int(input("enter qty ")) p=int(input("enter
price(in rupees)"))
l.append(pi)
l.append(pnm)
l.append(sp)
l.append(p)
cw.writerow(l)
ch=input("do you want to enter more rec(Y/N): ").upper()
if ch=="Y":
continue
else:
break
f.close()
f=open("pl.csv","r+")
cw=list(csv.reader(f))
for i in cw:
if l[3]>25:
print(i)
f.close()
34
i. SELECT DISTINCT Qty FROM garment;
ii. SELECT SUM(Qty) FROM garment GROUP BY CCode
HAVING COUNT(*)>1;
iii. SELECT GNAME, CNAME, RATE from garment g, cloth c
WHERE g.ccode=c.ccode AND Qty>100;
iv. Select AVG(Rate) FROM garment
WHERE rate BETWEEN 1000 AND 2000;
35 (i) import mysql.connector 4
mycon=mysql.connector.connect(host=’localhost’,
user=’root’, passwd=’KVS@123’,databse=’KV’)
mycur=mycon.cursor()
fn=input(“Enter flight number”) s=input(“Enter
source’)
d=input(“Enter Destination”) f=int(input(“Enter
fare of flight”))
query=”insert into flight values(‘{}’,’{}’, ‘{}’,{}).format(fn,s,d,f)
mycur.execute(query)
mycon.commit()
print(“Data added successfully”)
mycon.close()
½ mark for importing correct module 1 mark for correct connect() ½ mark for
correctly accepting the input 1 ½ mark for correctly executing the query ½ mark
for correctly using commit() )
OR
(i) import mysql.connector
mycon=mysql.connector.connect(host=’localhost’,
user=’root’, passwd=’KVS@123’,databse=’Sports’)
mycur=mycon.cursor()
query=”select * from game
where No_of_Participants>{}”.format(10) mycur.execute(query)
data=mycur.fetchall()
for rec in data:
print(rec)
mycon.close()
(½ mark for importing correct module 1 mark for correct connect()
1 mark for correctly executing the query ½ mark for correctly using fetchall()
1 mark for correctly [15] displaying data)
SECTION - E
36 def Insert(): 5
L=[]
while True:
ClockID = input("Enter Clock ID = ")
ClockName = input("Enter Clock Name = ")
YearofManf = int(input("Enter Year of Manufacture = "))
price = float(input("Enter Price = "))
R = [ClockID, ClockName, YearofManf, price]
L.append(R)
ans = input("Do you want to enter more records (Y/N)=")
if ans.upper()=='N':
break
import csv
fout = open('watch.csv','a',newline='')
W = csv.writer(fout)
W.writerows(L)
fout.close()
print("Records successfully saved")
def Delete():
ClockID = input("Enter Clock ID to be removed = ")
found = False
import csv
fin = open('watch.csv','r')
R = csv.reader(fin)
L = list(R)
fin.close()
for i in L:
If i[0]==ClockID:
found=True
print("Record to be removed is:")
print(i)
Remove(i)
break
if found==False:
print("Record not found")
else:
fout = open('watch.csv','w',newline='')
W = csv.writer(fout)
W.writerows(L)
fout.close()
print("Record Successfully Removed")
Insert() function
½ mark for correct data input and making list
½ mark for correctly opening file
1½ mark for correctly writing
record Delete() function
½ mark for correctly copying data in list
½ mark for correctly identifying record and removing it from the list
½ mark for correctly showing not found message
1 mark for correctly re-writing remaining records
37 a. The most suitable building to house the server is ADMIN building because 1*5=5
it has maximum number of computers and as per 80:20 rule this building
will have the maximum amount of network traffic.
½ mark for correct answer
½ mark for correct justification
b.
1 mark for correct diagram
c. iii. Video Conferencing
1 mark for correct diagram
d.
i. Switch/Hub will be placed in every building to provide network
connectivity to all devices inside the building.
ii. Repeater will not be required as there is not cable running for
more than 100 meters.
½ mark each for each correct reason
e. The device/software that can be installed for data security and to
protect unauthorized access is Firewall.
Or
WAN
1 mark for correct answer
अनुक्रम ांक/ROLL NO
1 | Page
print(2**3**2)
a) 64 b) 256 c) 512 d) 32
9. Which of the following statement(s) would give an error after executing the 1
following code?
S="Welcome to class XII" #Statement 1
print(S) # Statement 2
S="Thank you" #Statement 3
S[0]= '@' #Statement 4
S=S+"Thank you" #Statement 5
(a) Statement 3 (b) Statement 4
(c) Statement 5 (d) Statement 4 and 5
10. Which of the following option is the correct python statement to read and display 1
the first 10 characters of a text file “Notes.txt”?
(a) F=open(‘Notes.txt’) (b) F=open(‘Notes.txt’)
print(F.load(10)) print(F.dump(10))
def change():
n=10
x=5
print( x)
a) n and x both are local variables b) n and x both are global variables
c) n is global and x is local variable d) n is local and x is global variable
13. Fill in the blank: 1
command is used to add a column in a table in SQL.
14. _______Keyword is used to obtain Non-duplicated values in a SELECT query. 1
(a) ALL (b) DISTINCT (c) SET (d) HAVING
15. Which SQL function returns the sum of values of a column of numeric type? 1
(a)total( ) (b)add( ) (c) sum( ) (d) All of these
16 Which of the following is not valid cursor function while performing database 1
operations using python. Here Mycur is the cursor object?
(a) Mycur.fetch() (b) Mycur.fetchone()
(c) Mycur.fetchmany(n) (d) Mycur.fetchall()
17. What Modem does? 1
a) Modulation (b) Demodulation
c) Both Modualtion & Demodulation (d) Not any
18. Fill in the blank: 1
______is the first page that normally view at a website.
(a) First Page (b) Master Page (c) Home Page (d) Login Page
2 | Page
(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): A variable declared as global inside a function is visible outside 1
the function with changes made to it inside the function.
Reasoning (R): global keyword is used to change the value of a global variable.
21. Assertion (A): COUNT(*) function count the number of rows in a relation. 1
Reasoning (R): DISTINCT ignores the duplicate values.
SECTION-B (7 * 2= 14 Marks)
22. Which of the following can be used as valid identifier(s) in Python? 2
(i) Total (ii) @selute (iii) Que$tion (iv) great
th
(v) 4 Sem (vi) li1 (vii) No# (viii) _Data
23. (i)Write the names of any two data types available in python. 1+1=2
(ii)Write any 2 operators name used in python.
24. Write the Python statement for each of the following tasks using BUILT_IN 1+1=2
functions/ methods only:
i) str="PYTHON@LANGUAGE"
(A) To print the above string from index 2 onwards.
OR
(B) To initialize an empty dictionary named as d.
ii) Write the Python statement for each of the following tasks using BUILT_IN
functions/ methods only:
(A) s=”LANGUAGE"
To convert the above string into list.
OR
(B) To initialize an empty tuple named as t.
25. Find possible o/p (s) at the time of execution of the program from the following code? 2
Also specify the maximum values of variables Lower and Upper.
import random as r
AR=[20, 30, 40, 50, 60, 70];
Lower =r.randint(1,3)
Upper =r.randint(2,4)
for K in range(Lower, Upper +1):
print (AR[K],end=”#“)
(i) 10#40#70# (ii) 30#40#50#
(iii) 50#60#70# (iv) 40#50#70#
26. Differentiate between COUNT(* ) and COUNT(COLUMN_NAME) with example. 2
27. (i) 2
A) What constraint should be applied on a table’s column to provide it the
default value when column does not have any value.
OR
B) What constraint should be applied on a table’s column so that NULL
value is allowed in that column and duplicate values are not allowed.
(ii)
A) Write an SQL command to add one more column in previously defined
table, named CELL. Column name is CELL_ID with size 10 of integer
type should be added in the table.
OR
B) Write an SQL command to permanently remove the table CELL from
database.
3 | Page
28. A) Write the full forms of the URL and VoIP and their utility? 2
OR
B) Mention any two differences between IP and MAC address in networking.
SECTION-C (3*3= 9 Marks)
29. A) Write a method /function countlines_et () in python to read lines from a text file 3
report.txt, and COUNT those lines which are starting either with ‘E’ and starting
with ‘T’ respectively. And display the Total count separately.
For example: if REPORT.TXT consists of
“THE PROGRAMMING IS FUN FOR PROGRAMMER.
ENTRY LEVEL OF PROGRAMMING CAN BE LEARNED FROM USEFUL FOR
VARIETY OF USERS.”
Then,
Output will be: No. of Lines with E: 1 No. of Lines with T: 1
OR
B) Write a method/function show_todo():in python to read contents from a text file
abc.txt and display those lines which have occurrence of the word “ TO” or “DO”
For example:
If the content of the file is
“THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF HARD WORK.
WE ALL ARE EXPECTED TO DO HARD WORK.
AFTER ALL EXPERIENCE COMES FROM HARDWORK.”
Write the function pop(stack) that removes the top element of the stack on its each
call.
B)
Write a function in Python push(EventDetails) where EventDetails is a dictionary
containing the number of persons attending the events–
{EventName : NumberOfPersons}.
The function should push the names of those events in the stack named ‘BigEvents’
which have number of persons greater than 200. Also display the count of elements
pushed on to the stack.
Write the function pop(EventDetails) that removes the top element of the stack on
its each call.
For example:
4 | Page
Marriage
Graduation Party
OR
B)
(i) To display the total number of employees in Employee table.
(ii) To display the employees records in descending order of
basic_salary respectively.
(iii) To display the total hra of employees in Employee table.
ii) Give an example code to handle IndexError? The code should display the
message “list index out of range is not allowed” in case of IndexError Exception,
and the message “Some Error occured” in case of any other Exception.
OR
B)
i) When is ZeroDivisionError Exception raised in Python?
ii) Write a function division( ) that accepts two arguments. The function should be
able to catch an exception such as ZeroDivisionError Exception, and the message
“Some Error occured” in case of any other Exception.
33 Aman has recently been given a task on CAPITAL.CSV which contains Country and 2+2=4
. Capital as data for records insertion.
5 | Page
34 Write the SQL queries (i) to (iv) based on the relations SCHOOL and ADMIN given 4
. below:
6 | Page
37 Hitech Info Limited wants to set up their computer network in Bangalore 5
based
campus having four buildings. Each block has a number of computers
that are required to be connected for ease of communication, resource sharing and
data security.
You as a network expert have to suggest answers to these parts (a) to (e) raised
by them.
DEVELOPMENT HUMANRESOURCE
KVS
LOGISTICS ADM
RO
Shortest distances between various blocks Jaipur
Block DEVELOPMENT to Block HUMANRESOURCE -- 50 m
Block DEVELOPMENT to Block ADM-- 75 m
Block DEVELOPMENT to Block LOGISTICS-- 80 m
Block HUMANRESOURCE to Block ADM-- 110 m
Block ADM to Block LOGISTICS 140 m
i) Suggest the most suitable block to host the server. Justify your answer.
ii) Suggest the wired medium and Draw the cable layout (Block to Block) to
economically connect various blocks.
iii) Suggest the placement of the following devices with justification:
(a) Hub/Switch (b)Repeater
iv) Suggest the device that should be placed in the Server building so that they
can connect to Internet Service Provider to avail Internet Services.
v) A) What is the Suggestion for the high-speed wired communication medium
between Bangalore Campus and Mysore campus to establish a data network.
(a) TWP Cable (b)CoAxial Cable (c) OFC (d) UTP Cable
OR
B) What type of network (PAN/ LAN/ MAN/ WAN) will be set up among the
computers connected in the Campus?
----------------*------------*------------------
7 | Page
KENDRIYA VIDYALAYA SANGATHAN, JAIPUR REGION
PRACTICE PAPER-II
Class-XII
Subject: Computer Science (083)
Marking Scheme Cum Model Answer-Sheet
SECTION-A(1*21=21 MARKS)
QN Answer of Question
1. Ans. True, as continue keyword skips remaining part of an iteration in a 1
loop.
2. Ans. (c) “uter”, as it counts from 4 index to last index 1
3. Ans: (b) True, as firstly “not” performed then “And” performed and at last 1
“Or” performed.
True or not True and False
True or False and False
True or False
True
4. Ans. (d) dict_student.update(dict_marks), as we use update method for 1
dictionary merging with syntax dict1.update(dict2)
5. Ans. (b) tuple, as Elements enclosed in parentheses( ) represents by 1
tuple.
6. Ans: (d) (40,60), as this expression will slice the given tuple starting with 1
index position 3 and selecting every second element till index number 7.
7. Ans. (c) None, as it is empty value. 1
8. Ans. (c) 512, as 2**3**2= 2**9=512 is the answer. 1
9. Ans. (b) Statement 4, as string’s individual element can’t assigned new 1
value so S[0]= '@' # Statement 4 give error.
10. Ans. (c) F=open(‘Notes.txt’) 1
print(F.read(10))
As read method in python is used to read at most n bytes from the file
associated with the given file descriptor. If the end of the file has been
reached while reading bytes from the given file descriptor, os.read( )
method will return an empty bytes object for all bytes left to be read.
11. Ans. (a) Pickling, as pickling is used for object serialization in handling 1
of Binary Files.
12. Ans. (d) n is local and x is global variable 1
As n is defined within function body and x is defined outside the function
body.
13. Alter- Add command is used to add a new column in table in SQL. 1
14. Ans. (b) DISTNICT, as DISTNICT Keyword is used to obtain Non- 1
duplicated values in a SELECT query.
15. Ans. (c) sum( ), as it’s used for summation of numeric values in a 1
column.
16. Ans. (a) Mycur.fetch(), as it’s not a valid method for fetching. 1
17. Ans. (c) Both Modualtion & Demodulation, as MODEM does both 1
tasks.
18. Ans. (c) HomePage, as it is the first page that normally view at a 1
website.
19. Ans: Topology is the way of connecting the networking devices. 1
20. Ans: (a) Both A and R are true and R is the correct explanation for A 1
As global variables are accessed anywhere in the program and local
variables are accessed only within the boundary of loop/ condition/
function.
1|Page
21. Ans: b) Both A and R are true and R is not the correct explanation for A 1
Invalid identifier(s)
(ii) @selute (iii) Que$tion (v) 4th Sem (vii) No#
As identifier(s) name does not have any special character except
underscore. Name should not start with digit and not any space is there
in name.
23 i) Names of any two data types available in python: int, float or any other 1+1
. valid datatype in python. =2
ii) Any 2 operators name used in python: Arithmetic, Logical, Relational
or any other valid operator in python.
24 (i)A) str="PYTHON@LANGUAGE" 2
. print(str[2: : ])
OR
B) d=dict( )
(ii)A) s=”LANGUAGE"
l=list(s)
OR
B) t=tuple( )
25 Lower = r.randint(1,3) means Lower will have value 1,2, or 3 2
. Upper =r.randint(2,4) means Upper will have value 2, 3, or 4
So K will be from (1, 2, 3) to (2, 3, 4)
Means if K=1, then upper limit (2,3,4)
If K=2, then upper limit (2,3,4)
If K=3, then upper limit (2,3,4)
So correct answer (ii) 30#40#50#
Maximum values of variables Lower and Upper are 3 and 4.
26 COUNT(*) returns the count of all rows in the table, 2
. whereas COUNT (COLUMN_NAME) is used with Column_Name
passed as argument and counts the number of non-NULL values in
the particular column that is given as argument.
Example:
A MySQL table, sales have 10 rows with many columns, one column
name is DISCOUNT.
This DISCOUNT column has 6 valid values and 4 empty/ null
values. When we run the Following queries on sales table.
SELECT COUNT(*)
FROM sales;
COUNT(*)
10
SELECT
COUNT(DISCOUNT)
FROM sales;
COUNT( DISCOUNT )
6
As in table, there are 10 rows so count(*) gives 10 and discount
column is having 6 valid values with 4 NULL values so it gives 6.
27 i) 1+1
2|Page
. A) Default constraint should be applied on a table’s column to provide =2
it the default value when column does not have any value.
OR
B) Unique constraint should be applied on a table’s column so that
NULL value is allowed in that column and duplicate values are not
allowed.
ii)
A)
SQL command to add one more column in previously defined table,
named CELL. Column name is CELL_ID with size 10 of integral
type should be added in the table
Alter table CELL
ADD CELL_ID(10) int;
OR
DROP table CELL;
28 (A) VOIP-Voice Over Internet Protocol 2
. Utility-VoIP is used to transfer audio (voice) and video over internet
URL- Uniform Resource Locator
Utility-Place for typing website names in web browser.
OR
(B)
IP Address MAC Address
Internet Protocol Address Media Access Control Address
It is 4 bytes address in IPV4 and It is 6 bytes address.
6 bytes address in IPV6
Or any other valid difference between the two.
(1 mark for ANY ONE difference)
SECTION-C (3*3= 9 Marks)
29 A) 3
. def countlines_et():
f=open("report.txt",'r')
lines=f.readlines()
linee=0
linet=0
for i in lines:
if i[0]=='E':
linee+=1
elif i[0]=='T':
linet+=1
print("No.of Lines with E:",linee)
print("No.of Lines with T:",linet)
countlines_et()
OR
B)
def show_todo():
f=open("abc.txt",'r')
lines=f.readlines()
for i in lines:
if "TO" in i or "DO" in i:
print(i)
show_todo()
30 A) 3
.
3|Page
data = [1,2,3,4,5,6,7,8]
stack = []
def push(stack, data):
for x in data:
if x % 2 == 0:
stack.append(x)
def pop(stack):
if len(stack)==0:
return "stack empty"
else:
return stack.pop()
push(stack,Data)
print(pop(stack)
(½ mark should be deducted for all incorrect syntax. Full marks to
be awarded for any other logic that produces the correct result.)
OR
B)
def push(EventDetails):
BigEvents=[]
count=0
for i in EventDetails:
if EventDetails[i]>200:
BigEvents.append(i)
count+=1
print(“The count of elements in the stack is”,count)
def pop(EventDetails):
if len(EventDetails)==0:
return "Dictionary is empty"
else:
return EventDetails.pop()
push(EventDetails)
print(pop(EventDetails))
(½ mark should be deducted for all incorrect syntax. Full marks to
be awarded for any other logic that produces the correct result.)
31 A) 1*3
(i) SELECT EMP_NAME, BASIC+DA+HRA+NPS AS “GROSS =3
SALARY” FROM EMPLOYEE;
(ii)UPDATE EMPLOYEE SET DA=DA+0.03*BASIC;
(iii)ALTER TABLE EMPLOYEE DROP COLUMN EMP_DESIG;
OR
B)
(i) SELECT COUNT(*) FROM EMPLOYEE;
(ii) SELECT * FROM EMPLOYEE ORDER BY basic desc;
(iii) SELECT SUM(hra) FROM EMPLOYEE;
SECTION-D (4*4= 16 Marks)
32 A) 1+3
. i) When the value passed in the index operator is greater than the actual =4
size of the tuple or list, Index Out of Range is thrown by python.
ii)
value=[1,2,3,4]
data=0
try:
data=value[4]
4|Page
except IndexError:
print(“list index out of range is not allowed”, end=’’)
except:
print(“Some Error occurred”, end=’’)
OR
B)
i) When the division or modulo by zero takes place for all numeric types,
ZeroDivisionError Exception is thrown by python.
ii)
def division(x,y):
try:
div=x/y
print(div, end=’’)
except ZeroDivisionError as e:
print(“ ZeroDivisionError Exception occured”, e, end=’’)
except:
print(“Some Error occurred”, end=’’)
33 import csv 2+2
. def AddNewRec(Country,Capital): =4
f=open(“CAPITAL.CSV”,’a’)
fwriter=csv.writer(f)
fwriter.writerow([Country,Capital])
f.close()
def ShowRec():
with open(“CAPITAL.CSV”,”r”) as NF:
NewReader=csv.reader(NF)
for rec in NewReader:
print(rec[0],rec[1])
AddNewRec(“INDIA”, ”NEW DELHI”)
AddNewRec(“CHINA”, ”BEIJING”)
ShowRec()
Output:
INDIA NEW DELHI
C H I N A B E I J IN G
34 i)SELECT SUM (PERIODS), SUBJECT FROM SCHOOL GROUP BY 1*4
. SUBJECT ; =4
DEVELOPMENT HUMANRESOURCE
PMENT
LOGISTICS ADM
iii) (a) Switches in all the blocks since the computers need to be
connected to the network.
(b) Repeaters between ADM and HUMANRESOURCE block & ADM
and Logistics block. The reason being the distance is more than 100m.
iv) Modem should be placed in the Server building
v) (c)OFC-Optical Fiber cable, this connection is high-speed wired
communication medium.
OR LAN will be set up among computers connected in Campus.
6|Page
अनक्र
ु म ांक/ROLL NO सेट/SET : 01
Page 1 of 7
7 If my_dict is a dictionary as defined below, then which of the following statements will 1
raise an exception?
my_dict = {'aman': 10, 'sumit': 20, 'suresh': 30}
(a) my_dict.get('suresh') (b) print(my_dict['aman', 'sumit'])
(c) my_dict['aman']=20 (d) print(str(my_dict))
8 Which of the following can delete an element from a list if the index of the element is 1
given?
(a) pop( ) (b) remove( )
(c) clear( ) (d) all of these
9 Which of the following attributes can be considered as a choice for primary key? 1
(a) Name (b) Street
(c) Roll No (d) Subject
10 Write the missing statement to complete the following code: 1
file = open("abc.txt", "r")
d = file.read(50)
____________________ #Move the file pointer to the beginning of the file
next_data = file.read(75)
file.close()
11 State whether the following statement is True or False: 1
An exception may be raised even if the program is syntactically correct.
12 What will be the output of the following Python code ? 1
v = 50
def Change(n):
global v
v, n = n, v
print(v, n, sep = “#”, end = “@”)
Change(20)
print(v)
(a) 20#50@20 (b) 50@20#50
(c) 50#50#50 (d) 20@50#20
13 Which statement is used to modify data in a table? 1
(a) CHANGE (b) MODIFY (c) UPDATE (d) ALTER
14 How would you return all the rows from a table named "Item" sorted in descending 1
order on the column "IName"?
(a) SELECT * FROM Item SORT 'IName' DESC;
(b) SELECT * FROM Item ORDER BY IName DESC ;
(c) SELECT * FROM Item ORDER IName DESC ;
(d) SELECT * FROM Item SORT BY 'IName' DESC;
15 LIKE clause is used for. 1
(a) For pattern matching (b) For table matching
(c) For inserting similar data in a table (d) For deleting data from a table
16 Count(*) method count 1
(a) NULL values only (b)Empty Values
(c) ALL the values (d) None of these
17 The term HTTP stands for? 1
(a) Hyper terminal tracing program (b) Hypertext tracing protocol
(c) Hypertext transfer protocol (d) Hypertext transfer program
Page 2 of 7
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 parameter having a default value in the function header is known as a 1
default parameter.
Reason:- The default values for parameters are considered only if no value is
provided for that parameter in the function call statement.
21 Assertion :- Both WHERE and HAVING clauses are used to specify conditions.
Reason :- The WHERE and HAVING clauses are interchangeable.
Page 4 of 7
OR
(B) Predict the output of the Python code given below:
T= [“20”, “50”, “30”, “40”]
Counter=3
Total= 0
for I in [7,5,4,6]:
newT=T[Counter]
Total= float (newT) + I
print(Total)
Counter=Counter-1
Page 5 of 7
COMPANY
CID CNAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY MADRAS MOBILE
666 DELL DELHI LAPTOP
CUSTOMER
CUSTID NAME PRICE QTY CID
101 Rohan Sharma 70000 20 222
102 Deepak Kumar 50000 10 666
103 Mohan Kumar 30000 5 111
104 Sahil Bansal 35000 3 333
105 Neha Soni 25000 7 444
106 Sonal Aggarwal 20000 5 333
107 Arjun Singh 50000 15 666
(i) To display those company name along with price which are having price less
than 30000.
(ii) To display the name and price of the companies whose price is between 20000
to 35000.
(iii) To increase the price by 1000 for those customer whose name starts with ‘S’
(iv) To display those product name, city and price which are having product name
as MOBILE.
35 Kabir wants to write a program in Python to insert the following record in the table 4
named Student in MYSQL database, SCHOOL:
- rno(Roll number) – integer
- name(Name) – string
- DOB(Date of Birth) – Date
- Fee – float
Note the following to establish connectivity between Pythonand MySQL:
- Username – root
- Password – tiger
- Host – localhost
The values of fieldsrno, name, DOB and fee has to be accepted from the user.
Help Kabir to write the program in Python.
Page 6 of 7
You, as a programmer of the company, have been assigned to do this job for Amit.
(i) Write a function to input the data of a candidate and append it in a binary file.
(ii) Write a function to update the data of candidates whose experience is more
than 12 years and change their designation to "Sr. Manager".
(iii) Write a function to read the data from the binary file and display the data of all
those candidates who are not "Sr. Manager".
37 PVS Computers decided to open a new office at Ernakulum, the office consist of 5
Five Buildings and each contains number of computers. The details are shown
below.
Page 7 of 7
Kendriya Vidyalaya Sangathan, Jaipur Region
Pre-Board Examination: 2024-25
Marking scheme Set No: 1
Class: XII Subject: Computer Science (083)
Maximum Marks: 70 Period: 3 Hours
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 the case of MCQ, the text of the correct answer should also be written.
31 2 4 3
65
OR
47.0
35.0
54.0
26.0
( 3 Mark for correct output, 1 mark for partial correct)
3
(ii)
Max(ScheduleDate) Min(ScheduleDate)
2004-03-19 2003-12-12
(iii)
Sum(PrizeMoney)
54000
(iv) delete from ACTIVITY where Acode = 1003;
(1 mark for each correct answer.)
Ans Ans: (a) 4
33 import csv
def AddNewRec(Country,Capital):
f=open("CAPITAL.CSV",'a')
fwriter=csv.writer(f,lineterminator="\n")
fwriter.writerow([Country,Capital])
f.close()
(b)
def ShowRec():
with open("CAPITAL.CSV","r") as NF:
NewReader=csv.reader(NF)
for rec in NewReader:
print(rec[0],rec[1])
AddNewRec(“FRANCE”,”PARIS”)
AddNewRec(“SRILANKA”,”COLOMBO”)
ShowRec()
def append_candidate_data(candidates):
with open('candidates.bin', 'ab') as file:
for candidate in candidates:
pickle.dump(candidate, file)
print("Candidate data appended successfully.")
append_candidate_data(candidates_list)
(III)
import pickle
def display_non_senior_managers():
try:
with open('candidates.bin', 'rb') as file:
while True:
try:
candidate = pickle.load(file)
if candidate[2] != 'Senior Manager': # Check if not Senior Manager
print(f"Candidate ID: {candidate[0]}")
print(f"Candidate Name: {candidate[1]}")
print(f"Designation: {candidate[2]}")
print(f"Experience: {candidate[3]}")
print("--------------------")
except EOFError:
break # End of file reached
except FileNotFoundError:
print("No candidate data found. Please add candidates first.")
display_non_senior_managers()
General 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 ( No marks should be
provided if student does not write the correct choice )
Ans : True
2. What id the output of following code snippet?
Ans : A ) GL-BALNETW-RK
3. Identify the output of the following code snippet:
text = "The_quick_brown_fox"
index = text.find("quick")
(1)
result = text[:index].replace("_", "") + text[index:].upper()
print(result)
(A) Thequick_brown_fox
(B) TheQUICK_BROWN_FOX
(C) TheQUICKBROWNFOX
(D) TheQUICKBROWN_FOX
Page: 1/21
Ans : (B) TheQUICK_BROWN_FOX
(A) 0
(B) -5
(C) 65
(D) 265
Ans : ( C ) 65
What will be the output of the following code snippet?
5.
(1)
text = "Python Programming"
print(text[1 : :3])
(A) Ph oai
(B) yoPgmn
(C) yhnPormig
(D) Pto rgamn
Ans : (B)
Ans : C )
7. Dictionary my_dict as defined below, identify type of error raised by statement
my_dict['grape']?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
ValueError (1)
(B) TypeError
(C) KeyError
(D) ValueError
Ans : (C) KeyError
Page: 2/21
What does the list.pop(x) method do in Python?
8.
Ans : B. Removes the element at index x from the list and returns it.
In a relational database table with one primary key and three unique
9. constraints defined on different columns (not primary), how many candidate
keys can be derived from this configuration?
(1)
(A) 1
(B) 3
(C) 4
(D) 2
Ans : C) 4
10. Fill in the blanks to complete the following code snippet choosing the
correct option:
(A) tell
(B) seek
(C) read
(D) write
Ans : False
Page: 3/21
12. What will be the output of the following code?
x=4
def reset():
global x
x=2
print(x, end='&')
def update(): (1)
x += 3
print(x, end='@')
update()
x=6
reset()
print(x, end='$')
(A) 7@2&6$
(B) 7@6&6$
(C) 7@2&2$
(D) Error
Ans : (D) Error : Unbound local variable x in function update()
Which SQL command can modify the structure of an existing table, such as
13. adding or removing columns? (1)
Page: 4/21
16. Which of the following aggregate functions can be employed to determine
the number of unique entries in a specific column, effectively ignoring
duplicates?
(1)
(A) SUM()
(B) COUNT()
(C) AVG()
(D) COUNT(DISTINCT column_name)
Ans : (D) COUNT(DISTINCT column_name)
Ans : (B) Both A and R are true and R is not the correct explanantion
for A
Assertion (A): A GROUP BY clause in SQL can be used without any
21.
aggregate functions.
Reasoning (R): The GROUP BY clause is used to group rows that have the (1)
same values in specified columns and must always be paired
with aggregate functions.
Page: 5/21
Ans : ( C ) A is True , but R is False
( 1 marks + 1 Marks )
Ans :
Page: 6/21
If L1 = [10, 20, 30, 40, 20, 10, ...] and L2 = [5, 15, 25, ...], then:
24.
(Answer using builtin functions only)
II (A) : L1.extend(L2)
(B) : unique_elements = list(set(L1))
Page: 7/21
26. The code provided below is intended to reverse the order of elements in a
given list. However, there are syntax and logical errors in the code. Rewrite
it after removing all errors. Underline all the corrections made.
def reverse_list(lst)
if not lst:
return lst (2)
reversed_lst = lst[::-1]
return reversed_lst
print("Reversed list: " reverse_list[1,2,3,4] )
27. (I)
A) What constraint should be applied to a table column to ensure that all
values in that column must be unique and not NULL?
OR
B) What constraint should be applied to a table column to ensure that it can
have multiple NULL values but cannot have any duplicate non-NULL (2)
values?
(II)
A) Write an SQL command to drop the unique constraint named
unique_email from a column named email in a table called Users.
OR
B) Write an SQL command to add a unique constraint to the email column
of an existing table named Users, ensuring that all email addresses are
unique.
Ans : (I)(A): Use the UNIQUE constraint along with the NOT NULL OR
PRIMARY KEY constraint.
OR
(B): Use the UNIQUE constraint alone, allowing for multiple NULL
values.
Example: column_name INT UNIQUE NULL
( 1 mark each for correct part for each questions any correct example
as an answer is acceptable )
Page: 8/21
28. A) Explain one advantage and one disadvantage of mesh topology in
computer networks.
OR (2)
B) Expand the term DNS. What role does DNS play in the functioning of the
Internet?
Ans :
(A): Advantage of Mesh Topology: High redundancy; if one connection
fails, data can still be transmitted through other nodes.
Disadvantage of Mesh Topology: Complexity and high cost; requires
more cabling and configuration compared to simpler topologies.
OR
29. A) Write a Python function that extracts and displays all the words present in a
text file “Vocab.txt” that begins with a vowel..
OR (3)
B) Write a Python function that extracts and displays all the words
containing a hyphen ("-") from a text file "HyphenatedWords.txt", which
has a three letter word before hypen and four letter word after hypen.
For example : “for-them” is such a word.
Ans : A)
def display_words_starting_with_vowel():
vowels = 'AEIOUaeiou'
with open('Vocab.txt', 'r') as file:
words = file.read().split()
# Loop through the words and check if the first letter is a vowel
for word in words:
if word[0] in vowels:
print(word)
B)
def display_specific_hyphenated_words():
with open('HyphenatedWords.txt', 'r') as file:
words = file.read().split()
# Loop through the words and check if they match the pattern
for word in words:
parts = word.split('-')
# Check if the word is hyphenated and matches the format "XXX-
XXXX"
if len(parts) == 2 and len(parts[0]) == 3 and len(parts[1]) == 4:
print(word)
Page: 9/21
1/2 mark for file opening + 1/2 mark for correct loop +1/2 mark for
correct use of split( ) + 1 mark for correct condition + 1/2 mark for
output
(A) You have a stack named MovieStack that contains records of movies.
30. Each movie record is represented as a list containing movie_title,
director_name, and release_year. Write the following user-defined functions
in Python to perform the specified operations on the stack MovieStack:
OR
Write the function pop_odd() to pop the topmost number from the stack and
return it. If the stack is empty, the function should display "Stack is empty".
Write the function disp_odd() to display all elements of the stack without
deleting them. If the stack is empty, the function should display "None".
For example:
If the integers input into the list NUMBERS are: [7, 12, 9, 4, 15]
Ans : (A )
def push_movie(movie_stack, new_movie): # 1 mark
movie_stack.append(new_movie)
def pop_movie(movie_stack):
Page: 10/21
return movie_stack.pop()
def peek_movie(movie_stack):
return "None"
return movie_stack[-1]
OR
if number % 2 != 0:
odd_numbers.append(number)
def pop_odd(odd_numbers):
return odd_numbers.pop()
def disp_odd(odd_numbers):
return "None"
return odd_numbers
Page: 11/21
31. Predict the output of the following code:
data = [3, 5, 7, 2]
result = ""
for num in data:
for i in range(num):
result += str(i) + "*"
result = result[:-1]
print(result)
OR
Ans : 0*1*2*0*1*2*3*4*0*1*2*3*4*5*6*0*1
( 1 mark for predicting correct output sequence of
numbers + 1 mark for predicting correct placement
of * + 1 mark for removing last * )
OR
0 +1 +
0 +1 +2 +
0 +1 +2 +3 +
( 1 MARK For putting output in three lines + 1 mark for
predicting correct sequence of numbers in each line (
1/2 for incorrect partially correct) + 1 mark for
correct placement of + )
Q No. Section-D ( 4 x 4 = 16 Marks) Marks
Note: The table contains many more records than shown here. (4)
A) Write the following queries:
(I) To display the total Quantity for each Product, excluding Products with
total Quantity less than 5.
(II) To display the ORDERS table sorted by total price in descending order.
(III) To display the distinct customer names from the ORDERS table.
Page: 12/21
(IV) To display the sum of the Price of all the orders for which the quantity
is NULL.
OR
B) Write the output:
(I) SELECT C_Name, SUM(Quantity) AS Total_Quantity FROM ORDERS
GROUP BY C_Name;
(II) SELECT * FROM ORDERS WHERE Product LIKE '%phone%';
(III) SELECT O_Id, C_Name, Product, Quantity, Price FROM ORDERS
WHERE Price BETWEEN 1500 AND 12000;
(IV) SELECT MAX(Price) FROM ORDERS;
OR
(B) ( 1 MARK EACH )
(I)
C_Name Total_Quantity
Jitendra 1
Mustafa 2
Dhwani 1
Alice 1
David NULL
(II)
O_Id C_Name Product Quantity Price
1002 Mustafa Smartphone 2 10000
1004 Alice Smartphone 1 9000
Page: 13/21
(III)
Name of a country
Life Expectancy (average number of years a person is expected to
live)
GDP per capita (Gross Domestic Product per person)
Percentage of population with access to healthcare
(4)
For example, a sample record of the file may be: ['Wonderland', 82.5, 40000,
95].
(I) Read all the data from the file in the form of a list and display all those
records for which the life expectancy is greater than 75.
Ans : (I)
import csv
def read_health_data(filename):
records = []
with open(filename, mode='r') as file:
reader = csv.reader(file)
next(reader) # Skip the header row if present
for row in reader:
country = row[0]
life_expectancy = float(row[1])
gdp_per_capita = float(row[2])
access_to_healthcare = float(row[3])
if life_expectancy > 75 :
records.append([country, life_expectancy, gdp_per_capita,
access_to_healthcare])
return records
Page: 14/21
(II)
def count_records( ):
records = read_health_data(“HealthData.csv”)
return len(records)
Alex has been tasked with managing the Student Database for a High
34. School. He needs to access some information from the STUDENTS and
SUBJECTS tables for a performance evaluation. Help him extract the
following information by writing the desired SQL queries as mentioned
below.
Table: STUDENTS
FNam Mark
S_ID LName Enrollment_Date
e s
201 John Doe 15-09-2020 85
202 Jane Smith 10-05-2019 90 (4)
Johnso
203 Alex 22-11-2021 75
n
204 Emily Davis 30-01-2022 60
Micha
205 Brown 17-08-2018 95
el
Table: SUBJECTS
Ans : ( I )
SELECT * FROM STUDENTS S
JOIN SUBJECTS Sub ON S.S_ID = Sub.S_ID
WHERE S.Marks > 70;
Page: 15/21
(II)
SELECT *
FROM SUBJECTS
WHERE Credits BETWEEN 2 AND 4;
(III)
UPDATE SUBJECTS
SET Credits = Credits + 1
WHERE SubName LIKE '%Science%';
(IV) A:
SELECT FName, LName
FROM STUDENTS S
JOIN SUBJECTS Sub ON S.S_ID = Sub.S_ID
WHERE Sub.SubName = 'Mathematics';
OR
B:
SELECT *
FROM STUDENTS, SUBJECTS;
Field Type
productID int(11)
productName varchar(20)
price float
stockQty int(11)
(4)
Write the following Python function to perform the specified operation:
Ans :
import mysql.connector
def AddAndDisplay():
# Connect to the database
conn = mysql.connector.connect(
host='localhost',
user='root',
password='Electro123',
database='PRODUCTDB'
)
cursor = conn.cursor()
productID = int(input("Enter Product ID: "))
Page: 16/21
productName = input("Enter Product Name: ")
price = float(input("Enter Price: "))
stockQty = int(input("Enter Stock Quantity: "))
cursor.execute("INSERT INTO ELECTRONICS
(productID, productName,
price, stockQty) VALUES (%s,
%s, %s, %s)", (productID,
productName, price, stockQty))
conn.commit()
cursor.execute("SELECT * FROM ELECTRONICS
WHERE price > 150")
records = cursor.fetchall()
print("\nRecords with price greater than 150:")
for record in records:
print(record)
cursor.close()
conn.close()|
(1 Mark for Declaration of correct Connection Object
+ 1 Mark for correct input + 1 marks for correctly
using execute( ) method + 1 marks for showing
output using loop )
Ans : (I)
import pickle
def add_employee(filename):
employee_id = int(input("Enter Employee ID: "))
employee_name = input("Enter Employee Name: ")
position = input("Enter Position: ")
salary = float(input("Enter Salary: "))
new_employee = (employee_id, employee_name, position, salary)
with open(filename, 'ab') as file:
pickle.dump(new_employee, file)
(1/2 mark for input + 1 mark for correct use of dump( ) to add new emp
Page: 17/21
data)
(II)
def update_employee(filename):
employees = []
with open(filename, 'rb') as file:
try:
while True:
employees.append(pickle.load(file))
except EOFError:
pass
for i in range(len(employees)):
if employees[i][3] > 50000:
employees[i] = (employees[i][0], employees[i][1], "Team Lead",
employees[i][3])
with open(filename, 'wb') as file:
for employee in employees:
pickle.dump(employee, file)
(1 mark for correct use of load( ) method to retrieve data + 1/2 mark for
correct loop + 1/2 mark for correct condition within loop )
(III)
def display_non_team_leads(filename):
print("\nEmployees who are not Team Leads:")
with open(filename, 'rb') as file:
try:
while True:
employee = pickle.load(file)
if employee[2] != "Team Lead":
print(f"ID: {employee[0]}, Name: {employee[1]}, Position:
{employee[2]}, Salary: {employee[3]}")
except EOFError:
pass
( 1 mark for correct use of Try except block and 1/2 mark for correct
use of while loop )
Page: 18/21
Interstellar Logistics Ltd. is an international shipping company. They are
37. planning to establish a new logistics hub in Chennai, with the head office in
Bangalore. The Chennai hub will have four buildings - OPERATIONS,
WAREHOUSE, CUSTOMER_SUPPORT, and MAINTENANCE. As a
network specialist, your task is to propose the best networking solutions to
address the challenges mentioned in points (I) to (V), considering the
distances between the various buildings and the given requirements.
(5)
Building-to-Building Distances (in meters):
From To Distance
OPERATIONS WAREHOUSE 40 m
OPERATIONS CUSTOMER_SUPPORT 90 m
OPERATIONS MAINTENANCE 50 m
WAREHOUSE CUSTOMER_SUPPORT 60 m
WAREHOUSE MAINTENANCE 45 m
CUSTOMER_SUPPORT MAINTENANCE 55 m
Location Computers
OPERATIONS 40
WAREHOUSE 20
CUSTOMER_SUPPORT 25
MAINTENANCE 22
BANGALORE HEAD OFFICE 15
Page: 19/21
(I) Suggest the most suitable location for the server within the Chennai hub.
Justify your decision.
(II) Recommend the hardware device to connect all computers within each
building efficiently.
(III) Draw a cable layout to interconnect the buildings at the Chennai hub
efficiently. Which type of cable would you recommend for the fastest and
most reliable data transfer?
(IV) Is there a need for a repeater in the proposed cable layout? Justify your
answer.
(V) A) Recommend the best option for live video communication between the
Operations Office in the Chennai hub and the Bangalore Head Office from
the following choices:
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
(V) B) What type of network (PAN, LAN, MAN, or WAN) would be set up
among the computers within the Chennai hub?
Ans :
(I) The server should be placed in the OPERATIONS building.
Justification:
(III) The most efficient cable layout would involve connecting the
buildings as follows:
Page: 20/21
CUSTOMER_SUPPORT
(90 m)
OPERATIONS
/ | \
/ | \
WAREHOUSE MAINTENANCE
(III) There is no need for a repeater in this layout. The maximum distance
between any two buildings is 90 meters, which is well within the 100-meter
limit for Ethernet cable or fiber optics before requiring a repeater.
( 1 mark )
(IV) A) The best option for live communication between the Chennai
Operations Office and the Bangalore Head Office would be Video
Conferencing. This allows real-time face-to-face meetings and visual
communication across long distances, which is ideal for inter-office
collaboration.
OR
(V) B) The network type in the Chennai hub would be a LAN (Local Area
Network), as all computers are located within a confined geographical
area (the logistics hub) and are connected to each other for data
communication within the same campus.
Page: 21/21
KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION
CLASS: XII SESSION: 2024-25
PREBOARD
COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70
General 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.
import random
word='Inspiration'
Lot=2*random.randint(2,4)
for i in range(Lot,len(word),3):
print(word[i],end='$')
26 Identify Primary Key and Candidate Key present if any in the below table name 2
Colleges. Justify
Streng
Cid Name Location Year AffiUniv PhoneNumber
th
University
St. Xavier's
1 Mumbai 1869 10000 of 022-12345678
College
Mumbai
Loyola University
2 Chennai 1925 5000 044-87654321
College of Madras
Hansraj Delhi
3 New Delhi 1948 4000 011-23456789
College University
Christ Christ
4 Bengaluru 1969 8000 080-98765432
University University
Lady Shri
Delhi
5 Ram New Delhi 1956 2500 011-34567890
University
College
27 (I) 2
(A) What constraint/s should be applied to the column in a table to make it as
alternate key?
OR
(B) What constraint should be applied on a column of a table so that it becomes
compulsory to insert the value
(II)
(A) Write an SQL command to assign F_id as primary key in the table named flight
OR
(B)Write an SQL command to remove the column remarks from the table name
customer.
28 List one advantage and disadvantage of star and bus topology 2
OR
Define DNS and state the use of Internet Protocol.
OR
(B) Write a function that displays the line number along with no of words in it
from the file Quotes.txt
Example :
None can destroy iron, but its own rust can!
Likewise, none can destroy a person, but their own mindset can
The only way to win is not be afraid of losing.
Output:
Line Number No of words
Line 1: 9
Line 2: 11
Line 3: 11
30 (A) There is a stack named Uniform that contains records of uniforms Each record 3
is represented as a list containing uid, uame, ucolour, usize, uprice.
Write the following user-defined functions in python to perform the specified
operations on the stack Uniform :
(I) Push_Uniform(new_uniform):adds the new uniform record onto the stack
(II) Pop_Uniform(): pops the topmost record from the stack and returns it. If
the stack is already empty, the function should display “underflow”.
(III) Peep(): This function diplay the topmost element of the stack without
deleting it.if the stack is empty,the function should display ‘None’.
OR
(a) Write the definition of a user defined function push_words(N) which accept
list of words as parameter and pushes words starting with A into the stack
named InspireA
(b) Write the function pop_words(N) to pop topmost word from the stack and
return it. if the stack is empty, the function should display “Empty”.
Field Type
EventID int(9)
EventName varchar(25)
EventDate date
Description varchar(30)
Write the following Python function to perform the specified operations:
Input_Disp(): to input details of an event from the user and store into the table Event. The
function should then display all the records organised in the year 2024.
HR ADMIN
London Head
Head Head
Office
Accts Logistics
27 (I) 2
(A) UNIQUE ,NOT NULL
OR
(B) NOT NULL (PRIMARY KEY CAN BE GIVEN MARK)
(II)
(A) ALTER TABLE flight ADD PRIMARY KEY(F_id);
OR
(B) ALTER TABLE CUSTOMER DROP REMARKS;
28 STAR Adv DisAdv ½ mark each 2
BUS Adv DisAdv ½ mark each
OR
DNS definition 1 mark, IP purpose 1 mark
LOGISTICS
ACCTS
ADMIN
HR
General 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 carries1 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.
1. State-True or false:
Python interpreter handles semantic errors during code execution. (1)
2. (A) Which of the following will return False:
(B) A) not (True and False) B) True or False (1)
(C) C) not (True or False) D) not (False and False)
3. (A) Which of the following function will help in converting a string to list with
elements separated according to delimiter passed? (1)
(D) A) list( ) B) split( ) C) str( ) D) shuffle( )
4. What is the output of the following?
OCEANS=('pacific','arctic','Atlantic','southern') (1)
print(OCEANS[4])
A) ‘southern’ B) (‘southern’) C) Error D) INDEX
5. What is the output of the following (1)
x="Excellent day"
print(x[1::3])
A) x B) xlnd C) error D) dnlx
6. What can be the possible output of the following code:
def Element(x):
z=""
for y in x:
if not y.isalpha():
z=z+z.join(y) (1)
print(z)
Element("W2e0Py2th4n") #Function Call
A) 2 B) 02 C) 024 D) 2024
7. If D={‘Mobile’:10000, ‘Computer’:30000, ‘Laptop’:75000} then which of the
following command will give output as 30000
A) print(D) B) print(D['Computer'])
C) print(D.values( )) D)print(D.keys( )) (1)
1
8. Which of the following is not correct?
(A) del deletes the list or tuple from the memory
(B) remove deletes the list or tuple from the memory (1)
(C) pop is used to delete an element at a certain position
(D) pop(<index>) and remove(<element>) performs the same operation
9. A relation in a database can have _____ number of primary key(s)?
A) 1 B) 2 C) 3 D) 4 (1)
10. What is the value of ‘p’ and how many characters will be there in the variable
‘data’ in the following statement (1)
with open ("lists.txt","r",encoding="utf-8") as F:
data = F.read(100)
p=F.seek(10,0)
print(p)
A) 10, 100 B) 100, 10 C) 10, 110 D) 110, 10
11. Write the name of block / command(s) can be used to handle the error/exception in (1)
Python.
12. What will be the output of the following code?
def add():
c=1
d=1
while(c<9):
c=c+2 (1)
d=d*c
print(d, end="$")
return c
print(add( ),end="*")
2
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
4
Q No. Section-D( 4x4=16Marks) Marks
32. Consider the tables given below
Watches
Id Wname Price Type Qty
W01 High Time 1200 Common 75
W02 Life line 1600 Gents 150
W03 Wave 780 Common 240
W04 Timer 950 Gents 460
W05 Golden era 1760 Ladies 250
(4)
WSale
Wid QSold Qtr
W01 25 1
W02 23 1
W03 2 1
W04 10 2
W05 12 2
W03 22 3
W04 22 3
W02 23 3
Table: Departments
5
D_No D_name D_Incharge Date_join grant
D94 Physics Binny 12-10-2021 34000
D46 Chemistry Virat 24-12-2010 49500
D78 Biology Jimmy 10-05-2001 79000 (4)
D99 Geography Adams 05-09-2006 62000
D23 Primary Ajay 15-06-2009 Null
(i) To display complete details of those departments where date_join is less then
01-01-2010
(ii) To display the details of departments with the name of incharges containing
m in their name.
(iii) To increase the grant of department by 1200 of D_no either D99 or D23.
(iv) Select d_name, grant from department where grant is null;
OR
Select sum(grant) from department where date_join>’10-10-2020’;
35. Consider a database named ‘DB’ containing a table named ‘Vehicle’ with the following
structure
Field Type
Model char(10)
Make_year Int(4)
Qty Int(3) (4)
Price Number(8,2)
Write the following Python function to perform the following operation as mentioned:
1. Add_Vehicle() - which takes input of data and store it to the table
2. Search_vehicle() – which can search a model given by user and show it on screen
* Assume the following for Python – Database connectivity:
Host: localhost, User: root, Password: root
Q.No. SECTIONE(2X5=10 Marks) Marks
36. Rajiv Kumar is an owner of a company willing to manage the data of his office
employees like their biodata, salary centrally for all his offices located in the state of
Karnataka.
He planned to make a database named ‘company’ with the table ‘staff’ that contains
following structure
- ID–integer(4)
- Name–string(30)
- Designation–string(10)
- Birth_date–date
- Salary-decimal(10,2)
You as his database administrator write the following queries (I) to (IV)
(I) Create a table ‘staff’ with above structure and id as primary key. (2)
(II) Display all the records with designation ‘Sales Executive’ (1)
(III) To change the designation = ‘Assistant’ of all the staff having salary from (1)
15000 to 17000 (both values included)
(IV) To display the total number of records with name ending at letter ‘j’ (1)
37. PK International is an advertising agency who is setting up a new office in Gurgaon in
an area of 2.5 kms with four building Admin, Finance, Development, Organizers. You
have been assigned the task to suggest network solutions by answering the following
questions (i) to (v)
6
No. of computers in the building Distance between buildings
Admin 10 Admin-Finance 96
Finance 10 Admin-Development 58
Development 46 Admin-Organizers 48
Organizers 25 Finance-Development 42
(5)
Finance-Organizers 35
Development-Financers 40
Finance
Organizers
Development
Admin
i) Suggest the most appropriate location of the server inside the above campus.
Justify your choice.
ii) Which hardware device can be used to connect all the computers within each
building?
iii) Draw the cable layout for economic and efficiently connect various buildings
within the campus?
iv) Whether repeater is required for your given cable layout? Yes or No? Justify
your answer.
v) A) Give your recommendation for live visual communication between all the
offices and customer located in different cities
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN or WAN) will be setup
among the computers connected in this campus?
7
KENDRIYA VIDYALAYA SANGATHAN: JABALPUR REGION
PREBOARD-1 (2024-25)
COMPUTER SCIENCE (THEORY)
CLASS: XII Time allowed: 3 Hours Maximum Marks:70
Marking Scheme
General Instructions:
● In case any doubt regarding the answer the evaluator can check by himself/herself and do the
needful
Page:1/5
25.
B) m$p$ C) c$n$ For each correct answer ½ mark
import pickle
def RECORDS():
with open(“district.dat”,”r”) as file:
name=input(“Enter name of district”)
try:
while(1):
a=pickle.load(file)
if a[0]==name:
print(a)
except EOFError:
break
or any relevant correct code
27. (I)
A) Use of Primary key or Any relevant correct answer 1 mark
OR
B) Use of Primary key for rno in students table and use of foreign key in marks
table for connecting the two tables or Any relevant correct answer 1mark
(II)
A) Alter table stationary modify(price number(10,2); 1 mark (2)
OR
B) Update table stationary set price=Null;
28. A) Any 2 correct difference between star and mesh topology - 2 marks
(partial marks can be awarded on partial correct answer). (2)
OR
B) (i) VoLTE Voice over Long Term Evolution 1 mark
(ii) GSM Global System for Mobile communication 1 mark
Q No. Section-C(3x3=9Marks) Marks
29. 1 ½ mark for logic, ½ mark for indentation ½ mark for correct file opening
command , ½ mark for print command
(3)
A) with open( “chars.txt”,”r”) as file:
d=file.read()
WL=d.split()
for w in WL:
if w[0]==’c’ or w[0]==’C’:
print(w)
or any other correct relevant code
OR
A) with open( “info.txt”,”r”) as file:
d=file.read()
for x in d:
if x.isdigit():
print(x)
or any other correct relevant code
Page:2/5
30. 1 ½ mark for logic, ½ mark for indentation ½ mark for variable declaration,
½ mark for print command
A)
Inventory=[]
def New_In(Inventory,newdata):
Inventory.append(newdata)
def Del_In(Inventory):
if len(Inventory)==0:
print(“Nothing to POP”) (3)
else:
Inventory.pop()
def Show_In(Inventory):
for p in range(len(Inventory)-1,-1,-1):
print(Inventory[p])
code=input(“Code”)
name=input(“Name”)
price=input(“Price)
L=[code,name,price]
New_In(Inverntory, L)
Del_In(Inventory)
Show_In(Inventory)
OR
B)
N=””
Consonants=[]
def Push(x):
for p in x:
if p not in [‘a’,’A’,’e’,’E’, ‘i’,’I’,’o’,’O’, ‘u’,’U’] :
N=p
Consonants.append(N)
def Display():
for p in range(len(Inventory)-1,-1,-1):
print(Consonants[p])
Push(“Welcome to stacks”)
Display()
iv)
Wname Price Qtr
High Time 1200 1
Wave 780 3
33. ½ mark correct import statement
½ mark for opening file in correct mode
½ mark for making reader object
½ mark for print statement (4)
2 mark for logic
import csv
def READ():
with open(“candidates.csv”, “r”) as csv_file:
reading=csv.reader(csv_file)
for x in reading:
if x[2]>75 :
print(x)
def IDENTIFY():
count=0
with open(“candidates.csv”, “r”) as csv_file:
reading=csv.reader(csv_file)
for x in reading:
if x[2]<=75 :
count=count+1
print(“number of records less then 75% “ ,count)
Page:4/5
35. import mysql_connector 1 mark
connect=mysql.connector.connect(hostname=”localhost”, user=”root”, for
password=”root”, database=”db”) connect
cur=connect.cursor() ion
string
def Add_Vehicle():
Model = input(“Enter model”) ½
Make_year= input(“Enter year”) mark
Qty= input(“Enter qty”) for
Price =input(“Enter price”) variable
Q=”insert into Vehicle values(‘” + Model +”’,” + Make_year + “,” + Qty declarat
+”,” + Price +”)” ion
cur.execute(Q)
connect.commit()
½ mark
def Search_vehicle(): for
model=input(“Enter model to search”) correct
Q=”select * from Vehicle where Model=’” + model+ ’” function
cur.execute(Q) declarati
for x in cur: on
print(x)
2 marks
for logic
Q.No. SECTIONE(2X5=10 Marks) Marks
36. (I) Create table staff ( ID int(4) primary key, Name char(30), Designation (2)
char(10) , Birth_date date, Salary numeric(10,2));
(II) Select * from staff where designation= ‘Sales Executive’ ; (1)
(III) Update staff set designation =’Assistant’ where salary between 15000 and (1)
17000;
(IV) Select sum(*) from staff where name like “%j”; (1)
37. i) Development building with relevant and correct explanation 1
ii) Switch 1
iii) Any correct relevant layout with same placement of the building 1
iv) Correct & Relevant answer as per the layout given .by the student 1
v) A) Video conferencing
OR 1
B) LAN
Page:5/5