12 CS RevisionPapers2025

Download as pdf or txt
Download as pdf or txt
You are on page 1of 86

अनक्र

ु म ांक/ROLL NO सेट/SET : 01

केंद्रीय विद्य लय सांगठन ,जयपरु सांभ ग


KENDRIYA VIDYALAYA SANGATHAN, JAIPUR REGION
PRACTICE PAPER-I
कक्ष / CLASS :XII
विषय /SUB : कांप्यूटर विज्ञ नां (83) /COMPUTER SCIENCE (83)
अधिकतम अिधि / Time Allowed :03 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 the case of MCQ, the text of the correct answer should also be written.
Q Question Marks
No
SECTION A
1 State True or False: 1
“In a Python loops can also have else clause”
2 What is the output of the following code?
Text = 'Happy hour12-3'
L= " "
for i in range(len(Text)):
if Text[i].isupper():
L=L+Text[i].lower()

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) [1,2] (b) [1,3] (c)[2,3] (d)[3,1]

9 Which of the following is not a tuple in python? 1

(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.

(a) SMTP (b) POP (c) HTTP (d) FTP

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

A list named employeesalary stores salary of employees. Write the Python


command to import the required module and (using built-in function) to display
the most common salary value from the given list.
25 What possible outputs are expected to be displayed on the screen at the time of 2
execution of the program from the following code?
import random
temp=[10,20,30,40,50,60]
c=random.randint(0,4)
for i in range(0, c):
print(temp[i],”#”)
a) 10#20# b) 10#20#30#40#50#
c) 10#20#30# d) 50#60#
26 Explain the following with help of example. 2
1. Primary Key
2. Candidate key
27 Ms. Rajni has just created a table named “Customer” containing columns 2
Cname, Department and Salary.
After creating the table, she realized that she has forgotten to add a
primary key column in the table. Help her in writing an SQL command to
add a primary key column Custid of integer type to the table Customer.
Thereafter, write the command to insert the following record in the
table: Custid- 555
Cname- Nandini
Department: Management
Salary- 45600
OR
Manish is working in a database named CCA, in which he has created a table
named “DANCE” containing columns danceID, Dancename,
no_of_participants, and category.
After creating the table, he realized that the attribute, category has to be
deleted from the table and a new attribute TypeCCA of data type string has
to be added. This attribute TypeCCA cannot be left blank. Help Manish to
write commands to complete both the tasks.
28 (i) Expand the following terms: 1+1=2
XML, SMTP
(ii) Give the difference between XML and HTML.

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.

POP()- Pop and display the content of the stack.

Example: If the content of the list is as follows:


L=[87, 98, 65, 21, 54, 78, 59, 64, 32, 49]
Then the output of the code should be: 49 59 21 65 87

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

G101 Saree 1250 100 C03


G102 Lehang a 2000 100 C02
G103 Plazzo 750 105 C02
G104 Suit 2000 250 C01
G105 Patiala 1850 105 C01
Table: Cloth
CCode CName
C01 Polyester
C02 Cotton
C03 Silk
C04 Cotton- Polyester

Write SQL queries for the following:


i. Display unique quantities of garments.
ii. Display sum of quantities for each CCODE whose numbers of
records are more than 1.
iii. Display GNAME, CNAME, RATE whose quantity is more than
100.
iv. Display average rate of garment whose rate ranges from 1000
to 2000 (both values included)
35 Kishan wants to write a program in Python to insert the following record in the 4
table named Flight in MYSQL database KV:
● Flno (Flight number)-varchar
● Source (source)- varchar
● Destination (Destination)-varchar
● Fare (fare)-integer
Note the following to establish connectivity between Python and MySQL:
● User name-root
● Password – KVS@123
● Host-localhost
The values of fields Flno,Source,Destination and Fare has to be accepted
from the user. Help Kishan to write the program in Python.
OR
Suman has created a table named Game in MYSQL database Sports:
● GID (Game ID)-integer
● Gname( Game name)-varchar
● No_of_Participants (number of participants)- integer
Note the following to establish connectivity between Python and
MySQL:
● Username: root
● Password: KVS@123
● Host: localhost
Suman, now wants to display the records of students whose number of
participants are more than 10, Help Suman to write the program in Python.
SECTION-E
36 Write a program in Python that defines and calls the following functions: 5
Insert() – To accept details of clock from the user and stores it in a csv file
‘watch.csv’. Each record of clock contains following fields – ClockID,
ClockName, YearofManf, Price. Function takes details of all clocks and
stores them in file in one go.
Delete() – To accept a ClockID and removes the record with given ClockID
from the file ‘watch.csv’. If ClockID not found then it should show a relevant
message. Before removing the record it should print the record getting
removed.
37 Superior Education Society is an educational Organization. It is planning to 1*5=5
setup its Campus at Nagpur with its head office at Mumbai. The Nagpur
Campus has 4 main buildings – ADMIN, COMMERCE, ARTS and SCIENCE.
You as a network expert have to suggest the best network related solutions
for their problems raised in a to e, keeping in mind the distances between
the buildings and other given parameters:

Shortest distances between various buildings:


ADMIN to COMMERCE - 55 m
ADMIN to ARTS - 90 m
ADMIN to SCIENCE - 50 m
COMERCE to ARTS - 55 m
COMMERCE to SCIENCE - 50
ARTS to SCIENCE - 45 m
MUMBAI Head Office to NAGPUR Campus – 850 KM
Number of Computers installed at various buildings are as follows:
ADMIN – 110
COMMERCE – 75
ARTS – 40
SCIENCE – 12
MUMBAI Head Office – 20
a. Suggest the most appropriate location of the server inside the
Nagpur Campus to get the best connectivity for maximum number
of computers. Justify your answer.
b. Suggest and draw the cable layout to efficiently connect various
buildings within the Nagpur campus for connecting the computers.
c. Which of the following will you suggest to establish the online face-
to-face communication between the people in the ADMIN office of
Nagpur Campus and Mumbai Head office?
i. Cable TV
ii. E-mail
iii. Video Conferencing
iv. Text Chat
d. Suggest the placement of following devices with appropriate reasons:
i. Switch/Hub
ii. Repeater
e. Suggest the device/software to be installed in Nagpur Campus
to take care of data security and unauthorized access.
OR
Which network type is formed between Nagpur office to Mumbai
head office.
KENDRIYA VIDYALAYA SANGATHAN
JAIPUR REGION
PRACTICE PAPER-I
CLASS XII
SUBJECT: COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70
MARKING SCHEME

Que Question Marks


s
No
SECTION A
1 True 1
2 (A)hAPPY#HOUR1122#33 1
3 (b) False 1
4 (a)['Question paper ', '0', '', '-', '3'] 1
5 True 1
6 (d) ("f","o","obar") 1
7 True 1
8 (a)[1,2] 1
9 (c ) (10) 1
10 (b) It returns the byte position of the file pointer as an integer. 1
11 b. Error 1
12 c. global b 1
13 (b) DELETE 1
14 b. distinct 1
15 b. 10 digits 1
16 (b) aggregate functions 1
17 (b) POP-POST OFFICE PROTOCOL 1
18 a. PAN 1
19 message 1
20 (A) 1
21 (A) 1
SECTION - B
22 Mutable: Can be changed (e.g., lists, dictionary). 2
Immutable: Cannot be changed (e.g., tuples, string).
23 (18, 36, 54) 2
24 Write the Python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
(i) L1.insert(3,400)
(ii) message.endswith('.')
OR
import statistics
print( statistics.mode(employeesalary) )
25 a) 10#20# or b) 10#20#30#40#50# or c) 10#20#30# 2
26 Primary Key: A unique identifier for a table, ensuring no duplicate or NULL values. 2
(Example: StudentID)
Candidate Key: A set of columns that can uniquely identify records, from which the
primary key is selected. (Example: StudentID, aadhar no, admission no. etc)
27 Alter table customer add custid integer primary key; 2
Insert into customer
values(‘Nandini’,’Management’,45600,555);
OR
Alter table dance drop category;
Alter table dance add typecca varchar(10) not null;
28 (i) eXtensible Markup Language, Simple Mail Transfer Protocol 1+1=2
(ii) HTML( Hyper text mark Up language)
We use pre-defined tags
Static web development language – only focuses on how data
looks
It use for only displaying data, cannot transport data
Not case sensitive XML (Extensible Markup Language)
we can define our own tags and use them
Dynamic web development language – as it is used for
transporting and storing data
Case sensitive
OR
(i) Baud is the number bits carrying in one second.
(ii) https (Hyper Text Transfer Protocol Secure) is the protocol that
uses SSL (Secure Socket Layer) to encrypt data being transmitted
over the Internet. Therefore,
https helps in secure browsing while http does not.
SECTION - C
29 def countH(): 3
f=open(‘Para.txt’,’r’)
rec=f.readlines()
count=0
for line in rec:
if line[0]==’H’:
count+=1
print(‘The line count =’,count)
f.close()
( ½ mark for correctly opening and closing the file
½ for correct loop
1 for correct condition
½ for correct if statement
½ for correctly incrementing count
)

Note: Any other relevant and correct code may be marked


OR
def countmy():
f=open(‘DATA.TXT’,’r’)
rec=f.read()
words=rec.split()
for w in words:
if w==’my’:
count+=1
print(‘my occurs’,count,’times’)
f.close()
( ½ mark for correctly opening and closing the file
½ for correct loop
1 for correct condition
½ for correct if statement
½ for correctly incrementing count
30 def PUSH(S): 3
for i in L:
if i%2! =0:
S.append(i)
return(S)
def POP ():
num=len(S)
while len(S)!=0:
dele=S.pop()
print(dele)
num=num-1
else:
print("empty")

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

केंद्रीय विद्य लय सांगठन ,जयपुर सांभ ग


KENDRIYA VIDYALAYA SANGATHAN, JAIPUR REGION
PRACTICE PAPER-II
कक्ष / CLASS :XII
विषय /SUB : कांप्यूटर विज्ञ नां (83) /COMPUTER SCIENCE (83)
अविकतम अिवि / Time Allowed :03 Hours अविकतम अांक Maximum Marks : 70
स म न्य वनर्दे श / General Instructions

1. This question paper contains five sections, Section A to E.


2. All questions are compulsory.
3. Section A has 21 questions (1 to 21) carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions (22 to 28) carrying 02 marks each.
5. Section C has 03 Short Answer type questions (29 to 31) carrying 03 marks each.
6. Section D has 04 Long Answer type questions (32 to 35) carrying 04 marks each.
7. Section E has 02 questions (36 to 37) carrying 05 marks each.
8. All programming questions are to be answered using Python Language only.
9. In case of MCQ, text of the correct answer should also be written.

SECTION-A (21*1=21 Marks)


Q.No Question Marks
1. State True or False 1
“continue keyword skips remaining part of an iteration in a loop”
2. Select the correct output of the code: 1
>>> St=”Computer”
>>> print(St[4:])
(a) “Comp” (b) “pmoC” (c) “uter” (d) “mput”
3. 1
print(True or not True and False)
Choose one option from the following that will be the correct output after
executing the above python expression.
a) False b) True c) or d) not
4. Given the following dictionaries 1
dict_stud = {"rno" : "53", "name" : ‘Rajveer Singh’}
dict_mark = {"Accts" : 87, "English" : 65}
Which statement will merge the contents of both dictionaries?
(a) dict_stud + dict_mark (b) dict_stud.add(dict_mark)
(c) dict_stud.merge(dict_mark) (d) dict_stud.update(dict_mark)
5. Consider a declaration L=(1,’Python’,’3.14’) 1
Which of the following represents the data type of L?
(a) list (b) tuple (c) dictionary (d) string
6. Given a tuple tupl=(10,20,30,40,50,60,70,80,90) 1
What will be the output of print (tupl[3:7:2])?
(a) (40,50,60,70,80) (b) (40,50,60,70) (c) [40,60] (d) (40,60)
7. When a Python function does not have return statement then what it returns? 1
(a) int (b) float (c) None (d)Give Error
8. What will the following expression be evaluated to in Python? 1

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))

(c) F=open(‘Notes.txt’) (d) F=open(‘Notes.txt’)


print(F.read(10)) print(F.write(10))
11. Which Python approach is used for object serialization in handling of Binary File? 1
(a) Pickling (b) Un-pickling (c) Merging (d) None of these
12. In the given program, identify which are local and global variables? 1

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

19. Fill in the blank: 1


_______ is the way of connecting the networking devices.
Q20 and Q21 are ASSERTION AND REASONING byased questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A

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.”

The method/function should display:


THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF HARD WORK.
WE ALL ARE EXPECTED TO DO HARD WORK.
30. A) 3
A list of numbers is used to populate the contents of a stack using a function
push(stack, data) where stack is an empty list and data is the list of numbers. The
function should push all the numbers that are even to the stack.

Write the function pop(stack) that removes the top element of the stack on its each
call.

Also write the function calls.


OR

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.

Also write the function calls.

For example:

If the dictionary contains the following data:


EventDetails ={“Marriage”:300, “Graduation Party”:1500,
“Birthday Party”:80, “Get together” :150}
The stack should contain :-

4 | Page
Marriage
Graduation Party

The output should be:


The count of elements in the stack is 2
31. Mohan is a senior clerk in a MNC. He creates a table salary with a set of records to 3
keep ready for tax calculation. After creation of the table, he has entered data of 5
employees in the Employee table.

Based on the table given above write the SQL Queries:


A)
(i) To Display the Emp_Name and Gross_salary of each employee.
(Gross= basic+da+hra+nps)
(ii) To Increase the DA by 3% of respective basic salary of all
employees.
(iii) To Delete the Attribute emp_desig from the table.

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.

SECTION-D (4*4= 16 Marks)


32 A) 1+3=4
i) When is IndexError Exception raised in Python?

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.

For Example: “INDIA”, “NEW DELHI”


“CHINA”, ”BEIJING”
Write python code for these two user defined functions:

(i) AddNewRecord( ): insertion of new records in file.


(ii) ShowRecord( ) : to display all the records from file.

5 | Page
34 Write the SQL queries (i) to (iv) based on the relations SCHOOL and ADMIN given 4
. below:

Write SQL queries for the following:


i) Display total periods subjectwise by framing groups based on subject.
ii) Display minimum experience and maximum code from relation SCHOOL.
iii)Display teachername, gender by joining both tables on the basis of code
ATTRIBUTE and the designation should be “COORDINATOR.
iv)
(A) Display the total number of different subjects in school relation.
OR
(B) To display the total number of Males and Females separately with gender in
ADMIN table.
35 4
. Aarya has created a table named Emp in MySQL:
EmpNo – integer
EmpName – string
Age– integer
Salary – integer
Note the following to establish connectivity between Python and MYSQL:
● Username - root
● Password - tiger
● Host - localhost
● The Emp table exists in a MYSQL database named company.
● The details (EmpNo, EmpName, Age and Salary) are to be accepted
from the user.
Aarya wants to display All Records of Emp relation whose age is greater than 55.
Help Aarya to write program in python
SECTION-E (2*5= 10 Marks)
36 i. What is Binary File? 1+2+
ii. Consider a binary file stock.dat that has the following data: OrderId, 2=5
MedicineName,Qty and Price of all the medicines of wellness medicos, write the
following functions:
a) AddOrder() that can input all medicine orders.
b) DisplayPrice() to display details of all medicine that have Price more than 500.

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

Number of computers installed at various blocks


Block Number of Computers
DEVELOPMENT -- 105
HUMANRESOURCE-- 130
ADM-- 190
LOGISTICS-- 55

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

SECTION-B (2*7=14 MARKS)


22 Valid identifier(s) ½
. (i)Total (iv) great (vi) li1 (viii) _Data *4=
As identifier(s) names may be started with alphabet or underscore. A 2
digit may be there between the name.

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

ii) SELECT MIN(EXPERIENCE), MAX(CODE) FROM SCHOOL;

iii)SELECT TEACHERNAME, GENDER FROM SCHOOL, ADMIN


WHERE
DESIGNATION = ‘COORDINATOR’ AND
SCHOOL.CODE=ADMIN.CODE;
iv)
A) SELECT COUNT(DISTINCT SUBJECT) FROM SCHOOL;
OR
B) SELECT COUNT(), GENDER FROM ADMIN GROUP BY
GENDER;
(1 mark for each correct query)
35 import mysql.connector as cnt 4
. def Emp_Database():
con=cnt.connect(host="localhost", user="root", password="tiger",
database="company")
mycursor= con.cursor()
5|Page
print("Display Employee whose age is more than 55 years:")
mycursor.execute("select * from Emp where age>55”)
EmpRec= mycursor.fetchall()
for rec in EmpRec:
print(rec)
SECTION-E (2*5= 10 Marks)
36 Binary Files- It is usually much smaller than a text file.For image, video 1+2
and audio data this type of file is important and it’s extension is .det or +2=
.dat. Compiler does not need to convert these files as these files are in 5
the machine readable form hence these files consumes less time to
execute and process faster.
(a) import pickle
def AddOrder():
f=open("Stock.dat",'ab')
OrderId=input("Enter Order Id")
MedicineName=input("Enter Medicine Name")
Qty=int(input("Enter Quantity:"))
Price=int(input("Enter Price:"))
data=[OrderId,MedicineName,Qty,Price]
pickle.dump(data,f)
f.close()
AddOrder()
(b)
def DisplayPrice():
f=open("Stock.dat",'rb')
try:
while True:
data=pickle.load(f)
if data[3]>500:
print(data[0],data[1],data[2],data[3],sep="\t")
except:
f.close()
DisplayPrice()
37 i) ADM Block 1*5
Justification- It has maximum number of computers. Reduce traffic. =5
ii) wired medium is UTP/STP cables

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

केंद्रीय विद्य लय सांगठन ,जयपुर सांभ ग


KENDRIYA VIDYALAYA SANGATHAN, JAIPUR REGION
प्रथम प्री बोर्ड परीक्ष / 1ST PRE BOARD EXAMINATION :2024-25
कक्ष / CLASS :XII
विषय /SUB : कांप्यूटर विज्ञ नां (83) /COMPUTER SCIENCE (83)
अधिकतम अिधि / Time Allowed :03 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 the case of MCQ, the text of the correct answer should also be written.

Q. Section-A (21 x 1 = 21 Marks) Mark


1 State True or False: 1
The keys of a dictionary must be of immutable types.
2 Identify the output of the following code snippet: 1
str = "KENDRIYA VIDYALAYA"
str=str.replace('YA','*')
print(str)
(a) KENDRIYA VIDYALAYA (b) KENDRI*A VID*ALAYA
(c) KENDRI* VID*LA* (d) * KENDRI* VID*LA*
3 What will be the output of following expression? 1
(5<10 ) and (10< 5) or (3<18) and not 8<18
(a) True (b) False (c) Error (d) No output
4 What is the output of the expression? 1
St1=”abc@pink@city”
print(St1.split("@"))
(a) (“abc”, “@”, “pink”, “@”, “city”) (b) [“abc”, “@”, “pink”,”@’,”city”]
(c) [“abc”, “pink”, “city”] (d) Error
5 What will be the output of the following code snippet? 1
message= "Satyamev Jayate"
print(message[-2::-2])
6 Which of the following options will not result in an error when performed on types in 1
python where tp = (5,2,7,0,3) ?
(a) Tp[1] = 2 (b) tp.append(2)
(c) tp1 = tp+tp (d) tp.sum( )

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

18 A device that connects networks with different protocols – 1


(a) Switch (b) Hub (c) Gateway (d) Proxy Server
19 Which switching technique follows the store and forward mechanism? 1

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.

Q Section-B ( 7 x 2=14 Marks) Mark


22 What are immutable and mutable types? List immutable and mutable types of 2
python.
23 If given A=2,B=1,C=3, What will be the output of following expressions: 2
(i) print((A>B) and (B>C) or(C>A))
(ii) print(A**B**C)
24 Write the most appropriate list method to perform the following tasks. 2
(I) A) To delete a given element from the list L1.
OR
B) To sort the elements of list L1 in ascending order.
(II) A) To add an element in the beginning of the list L1.
OR
B) To add elements of a list L2 in the end of a list L1.
25 What possible outputs(s) are expected to be displayed on screen at the time of 2
execution of the program from the following code? Also specify the maximum
values that can be assigned to each of the variables FROM and TO.
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO):
print (AR[K],end=”#“)
(i)10#40#70# (ii)30#40#50# (iii)50#60#70# (iv)40#50#70#
26 Rewrite the following code in Python after removing all syntax error(s). Underline 2
each correction done in the code.
p=30
for c in range(0,p)
If c%4==0:
print (c*4)
Elseif c%5==0:
print (c+3)
else
print(c+10)
27 (i) (A) What constraint should be applied on a table column so that duplicate 2
values are not allowed in that column, but NULL is allowed.
OR
Page 3 of 7
(B) What constraint should be applied on a table column so that NULL is not
allowed in that column, but duplicate values are allowed.
(ii)
(A) Write an SQL command to remove the Primary Key constraint from a table,
named MOBILE. M_ID is the primary key of the table.
OR
B) Write an SQL command to make the column M_ID the Primary Key of an
already existing table, named MOBILE.
28 (A) How is it easier to diagnose fault in Star topology than in Bus topology ? 2
OR
(B) Nirmala is a bit confused between the terms Web server and Web browsers.
Help her in understanding both the terms with the help of suitable example.

Q Section-C ( 3 x 3 = 9 Marks) Mark


29 (A) Write a Python function that count the lines start with the word “the” in a file 3
“xyz.txt” and display it at the end.
OR
B) Write a Python function that Count total number of vowels in a file “abc.txt”.
30 (A) Madhuri has a list containing 10 integers. You need to help him create a 3
program
with separate user defined functions to perform the following operations based on
this list.
● Traverse the content of the list and push the ODD numbers into a stack.
● Pop and display the content of the stack.
For Example:
If the sample Content of the list is as follows:
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
13,21,89,35
OR
(B) Saroj have a list of 10 numbers . You need to help him create a program with
separate user defined functions to perform the following operations based on this
list.
● Traverse the content of the list and push the numbers into a stack which are
divisible by 5.
● Pop and display the content of the stack.
For Example:
If the sample Content of the list is as follows:
N=[2,5,10,13,20,23,45,56,60,78]
Sample Output of the code should be:
5,10,20,45,60
31 (A) Predict the output of the Python code given below: 3
def func(n1 = 1, n2= 2):
n1= n1 * n2
n2= n2 + 2
print(n1, n2)
func( )
func(2,3)

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

Q Section-D ( 4 x 4 = 16 Marks) Mark


32 Write SQL queries for (i)to(iv),which are based on the table: ACTIVITY given 4
below:
Table:ACTIVITY
ACode ActivityName ParticipantsNum PrizeMoney ScheduleDate
1001 Relay100x4 16 10000 23-Jan-2004
1002 Highjump 10 12000 12-Dec-2003
1003 ShotPut 12 8000 14-Feb-2004
1005 LongJump 12 9000 01-Jan-2004
1008 DiscussThrow 10 15000 19-Mar-2004
(i) To display the name of all activities with their Acodes in descending order.
(ii) To display sum of PrizeMoney for each of the Number of participants
groupings (as shown in column ParticipantsNum(10,12,16).
(iii) To display the Schedule Date and Participants Number for the activity
Relay100x4.
(iv) To increase PrizeMoney by 500 for High jump activity
OR
Write output for SQL queries(i) to(iii) and query for (iv),which are based on the
table: ACTIVITY:
(i) select count(distinct ParticipantsNum) from ACTIVITY;
(ii) select max(ScheduleDate),min(ScheduleDate) from ACTIVITY;
(iii) select sum(PrizeMoney) from ACTIVITY;
(iv) Write a query to delete the record of Acode 1003.
33 Abhishek is making a software on “Countries & their Capitals” in which various 4
records are to be stored/retrieved in CAPITAL.CSV data file. It consists of some
records. As a programmer, you have to help him to successfully execute the
program.

(A) Write a function in Python named AddNewRec(Country,Capital) to append


following records in the file “CAPITAL.CSV”.
[“FRANCE”,”PARIS”]
[“SRILANKA”,”COLOMBO”]
(B) Write a function in Python named ShowRec( ) that will show all the contents of
CAPITAL.CSV
34 Write SQL commands for the queries (i) to (iii) and output for (iv) & (v) based 4
on a table COMPANY and CUSTOMER .

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.

Q Section-E ( 2 x 5 = 10 Marks) Mark


36 Amit is a manager working in a recruitment agency. He needs to manage the 5
records of various candidates. For this, he wants the following information of each
candidate to be stored: -
Candidate_ID – integer
Candidate_Name – string
Designation – string
Experience – float

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.

Distance between the buildings

Building 1 and 2 20 Meters Building No of computers


1 40
Building 2 and 3 50 Meters
2 45
Building 3 and 4 120 Meters 3 110
4 70
Building 3 and 5 70 Meters
5 60
Building 1 and 5 65 Meters
Building 2 and 5 50 Meters

The Company has now decided to connect network in buildings.


(i)Suggest the most suitable place (i.e. building) to house the server of this
organization. Also give a reason to justify your suggested location.
(ii) Where would you place Hub/Switch? Answer with justification.
(iii) Suggest a cable layout of connection between the buildings (Topology).
(iv) Do you think anywhere Repeaters required in the campus? Why
(v) Suggest a protocol that shall be needed to provide Video Conferencing solution
between Ernakulum Campus and Ranchi Campus.
OR
What type of network (PAN, LAN, MAN, or WAN) will be set up among the
computers connected in the Ernakulum campus?

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.

Q. Section-A (21 x 1 = 21 Marks) Mark


Ans 1 True 1
(1 mark for correct answer)
Ans 2 (c) KENDRI* VID*LA* 1
(1 mark for correct answer)
Ans 3 (b) False 1
(1 mark for correct answer)
Ans 4 (c) [“abc”, “pink”, “city”] 1
(1 mark for correct answer)
Ans 5 tyJvmya 1
(1 mark for correct answer)
Ans 6 (c) tp1 = tp+tp 1
(1 mark for correct answer)
Ans 7 (b) print(my_dict['aman', 'sumit']) 1
(1 mark for correct answer)
Ans 8 (a) pop( ) 1
(1 mark for correct answer)
Ans 9 (c) Roll No 1
(1 mark for correct answer)
Ans10 file.seek(0) ( OR file.seek(0,0) ) 1
(1 mark for correct answer)
Ans11 True 1
(1 mark for correct answer)
Ans12 (a) 20#50@20 1
(1 mark for correct answer)
Ans13 (c) UPDATE 1
(1 mark for correct answer)
Ans14 (b) SELECT * FROM Item ORDER BY IName DESC ; 1
(1 mark for correct answer)
Ans15 (a) For pattern matching 1
(1 mark for correct answer)
Ans16 (c) ALL the values 1
(1 mark for correct answer)
Ans17 (c) Hypertext transfer protocol 1
(1 mark for correct answer)
Ans18 (c) Gateway 1
(1 mark for correct answer)
Ans19 Message Switching technique 1
(1 mark for correct answer)
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
Ans20 (b) Both A and R are true and R is not the correct explanation for A 1
(1 mark for correct answer)
Ans21 (c) A is True but R is False
(1 mark for correct answer)

Q Section-B ( 7 x 2=14 Marks) Mark


Ans Immutable types are those that can never change their value in place. These are : 2
22 integers, float, string, tuple
Mutable types are those whose values can be changed in place. These are : lists,
dictionaries
(1 mark for each correct definition and example)
Ans (i) True 2
23 (ii) 2
(1 mark for each correct answer.)
Ans 2
24 (I) A) L1.remove(4)
OR
B) L1.sort( )
(II) A) L1.insert( )
OR
B) L1.extend(L2)
(1 mark for each correct answer)
Ans (ii)30#40#50# 2
25 Maximum value assigned to FROM is 3
Maximum value assigned to TO is 4
(1 mark for each correct answer)
(½ x 2 = 1 Mark for correct Maximum values)
Ans p=30 2
26 for c in range(0,p):
if c%4==0:
print (c*4)
elif c%5==0:
print (c+3)
else:
print(c+10)
(½ mark each for correcting 4 mistakes)
Ans (I) A) UNIQUE 2
27 OR
B) NOT NULL
(1 mark for correct answer)

(II) A) ALTER TABLE MOBILE DROP PRIMARY KEY;


OR
B) ALTER TABLE MOBILE ADD PRIMARY KEY (M_ID);
(1 mark for correct answer)
28 Ans: Fault diagnosis is easier in Star topology as if there is any problem in a node 2
will affect the particular node only. While in bus topology, if problem exists in
common medium it will affect the entire nodes.
OR
Web Server Web browser
A web server is a computer or a group A web browser is an application used
of computers that hosts or stores to access and view websites.
content of website. Common web browsers include
It processes and delivers web pages Microsoft Internet Explores, Google
of the websites to the users. Chrome etc.
The main job of a web server is to
display the website content
(2 mark for correct answer)

Q Section-C ( 3 x 3 = 9 Marks) Mark


29 (A) 3
Logic:- We need to split all the words of a every line and then check first word of
each line.
def count_the():
F=open(“abc.txt”,”r”)
L=F.readlines()
count=0
for x in L: # read all the lines one by one
L1=x.split() # It will split all the lines into words
if L1[0].lower() == “the” :
count=count+1
print(“total lines are :- “,count)
F.close()
(½ mark for correct function header)
(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
(½ mark for splitting the text into words/character)
(1 mark for correctly displaying the desired counts)
OR
(B)
Read the file character by character
def count_vowels():
F=open(“abc.txt”, “r”)
S=f.read()
Count=0
for x in S:
if x.lower() in “aeiou”:
count=count+1
print(“total number of vowels are :- “, count)
F.close()

(½ mark for correct function header)


(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
(½ mark for checking vowels)
(1 mark for correctly displaying the desired counts)
30 N=[12, 13, 34, 56, 21, 79, 98, 22,35, 38] 3
def PUSH(S,N):
S.append(N)
def POP(S):
if S!=[ ]:
return S.pop()
else:
return None
ST=[ ]
for k in N:
if k%2!=0:
PUSH(ST,k)
while True:
if ST!=[ ]:
print(POP(ST),end=" ")
else:
break
(2x1 mark for correct function body; 1 mark for function calling)
OR
(B) N= [2,5,10,13,20,23,45,56,60,78]
def PUSH(S,N):
S.append(N)
def POP(S):
if S!=[]:
return S.pop()
else:
return None
ST=[]
for k in N:
if k%5==0:
PUSH(ST,k)
while True:
if ST!=[]:
print(POP(ST),end=" ")
else:
break
(2x1 mark for correct function body; 1 mark for function calling)

31 2 4 3
65
OR
47.0
35.0
54.0
26.0
( 3 Mark for correct output, 1 mark for partial correct)

Q Section-D ( 4 x 4 = 16 Marks) Mark


32 i) Select ActivityName, Acode from ACTIVITY order by Acode desc; 4
ii) Select sum(PrizeMoney) from ACTIVITY group by ParticipantsNum;
iii) Select ScheduleDate, ParticipantsNum from ACTIVITY where
ActivityName = ‘Relay 100 x4’;
iv) Update ACTIVITY set PrizeMoney = PrizeMoney + 500 where
ActivityName = “High jump”;

(1 mark for each correct Query.)


OR
(i)
Count(distinct ParticipantsNum)

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()

Ans SQL Two table based question 4


34 (i) SELECT CNAME, PRICE FROM COMPANY, CUSTOMER WHERE
COMPANY.CID = CUSTOMER.CID AND PRICE < 30000;
(ii) SELECT CNAME, PRICE FROM COMPANY, CUSTOMER WHERE
COMPANY.CID = CUSTOMER.CID AND PRICE BETWEEN 20000 AND 35000;
(iii) UPDATE CUSTOMER SET PRICE = PRICE+1000 WHERE NAME LIKE “S%”;
(iv) SELECT PRODUCTNAME,CITY, PRICE FROM COMPANY,CUSTOMER
WHERE COMPANY.CID=CUSTOMER.CID AND PRODUCTNAME=”MOBILE”;
(1 mark for each correct query.)
Ans import mysql.connector as mysql 4
35 con1 = mysql.connect(host = “localhost”, user = “root”, password = “tiger”,
database = “sample”)
mycursor = con1.cursor( )
rno = int(input(“Enter Roll Number : “))
name = input(“Enter the name : “)
DOB = input(“Enter date of Birth : “)
fee = float(input(“Enter Fee : “
query = “INSERT into student values({ }, ‘{ }’, ‘{ }’ , { })”.format(rno,name,DOB,fee)
mycursor.execute(query)
con1.commit( )
print(“Data added successfully”)
con1.close( )
(½ mark for correctly importing the connector object)
(½ mark for correctly creating the connection object)
(½ mark for correctly creating the cursor object)
(½ mark for correctly inputting the data)
(1 mark for correct creation of query)
(½ mark for correctly executing the first query with commit
(½ mark for correctly displaying the data)

Q Section-E ( 2 x 5 = 10 Marks) Mark


Ans (I) import pickle 5
36 def input_candidates():
candidates = [ ]
n = int(input("Enter the number of candidates you want to add: "))
for i in range(n):
candidate_id = int(input("Enter Candidate ID: "))
candidate_name = input("Enter Candidate Name: ")
designation = input("Enter Designation: ")
experience = float(input("Enter Experience (in years): "))
candidates.append([candidate_id, candidate_name, designation,
experience])
return candidates
candidates_list = input_candidates()

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)

(II) import pickle


def update_senior_manager():
updated_candidates = [ ]
try:
with open('candidates.bin', 'rb') as file:
while True:
try:
candidate = pickle.load(file)
if candidate[3] > 10: # If experience > 10 years
candidate[2] = 'Senior Manager'
updated_candidates.append(candidate)
except EOFError:
break # End of file reached
except FileNotFoundError:
print("No candidate data found. Please add candidates first.")
return
with open('candidates.bin', 'wb') as file:
for candidate in updated_candidates:
pickle.dump(candidate, file)
print("Candidates updated to Senior Manager where applicable.")
update_senior_manager()

(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()

(1/2 mark of import pickle)


(1/2 mark for input)
(1/2 mark for opening file in append mode and 1/2 mark for using dump)
(1/2 mark for opening file in read mode and 1/2 mark for using load)
(1 mark for checking the condition and updating the value)
(1 mark for checking the condition and displaying data correctly)
(1 mark for try and except block)
37 Networking based question 5
(i) Server should be installed in Building 3 , As maximum computer is there
(ii) Hub/Switch installed in each and every building to connect computers in each
building.
(iii) Bus/ Star topology
(iv) No repeater is required as distance between building is less than 100 meter.
(v) Voip
OR
LAN (Local Area Network)

(1x5=5 mark for each correct answer)


MARKING SCHEME OF 1st PREBOARD ( KVS RO KOLKATA )
2024-25 ( COMPUTER SCIENCE)
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 ( No marks should be
provided if student does not write the correct choice )

Q No. Section-A (21 x 1 = 21 Marks) Marks

1. State True or False:


(1)
The Python statement print(‘Alpha’+1) is example of TypeError Error

Ans : True
2. What id the output of following code snippet?

country = "GlobalNetwork" (1)


result = "-".join(country.split("o")).upper()
print(result)
(A) GL-BALNETW-RK
(B) GL-BA-LNET-W-RK
(C) GL-BA-LNET-W-RK
(D) GL-BA-LNETWORK

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

What will be the output of the following Python expression?


4.
x=5
y = 10
(1)
result = (x ** 2 + y) // x * y - x
print(result)

(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)

6. What will be the output of the following code?


tuple1 = (1, 2, 3)
tuple2 = tuple1 + (4,)
tuple1 += (5,)
print(tuple1, tuple2) (1)

(A) (1, 2, 3) (1, 2, 3, 4)


(B) (1, 2, 3, 5) (1, 2, 3)
(C) (1, 2, 3, 5) (1, 2, 3, 4)
(D) Error

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.

A. Removes the first element from the list. (1)


B. Removes the element at index x from the list and returns it.
C. Adds a new element at index x in the list.
D. Replaces the element at index x with None.

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:

with open("sample.txt", "w+") as file:


(1)
file.write("Hello, World!") # Write a string to the file
position_after_write = file.______ # Get the position after writing
file.seek(0) # Move the pointer to the beginning
content = file.read(5) # Read the first 5 characters
print(content)

(A) tell
(B) seek
(C) read
(D) write

Ans : (A) tell

11. State whether the following statement is True or False:


In Python, if an exception is raised inside a try block and not handled,
the program will terminate without executing any remaining code in the (1)
finally block.

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)

(A) ALTER TABLE


(B) UPDATE TABLE
(C) MODIFY TABLE
(D) CHANGE TABLE

Ans. (A) ALTER TABLE


14. What will be the output of the query?
SELECT * FROM orders WHERE order_date LIKE '2024-
10-%';
(A) Details of all orders placed in October 2024 (1)
(B) Details of all orders placed on October 10th, 2024
(C) Details of all orders placed in the year 2024
(D) Details of all orders placed on any day in 2024

Ans : (A) Details of all orders placed in October 2024


Which of the following statements about the CHAR and VARCHAR
15.
datatypes in SQL is false?
(A) CHAR is a fixed-length datatype, and it pads extra spaces to match the
specified length. (1)
(B) VARCHAR is a variable-length datatype and does not pad extra spaces.
(C) The maximum length of a VARCHAR column is always less than that of
a CHAR column.
(D) CHAR is generally used for storing data of a known, fixed length.
Ans : ( C )

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)

17. Which protocol is used to send e-mail over internet?


(A) FTP
(B) TCP
(C) SMTP
(D) SNMP (1)
Ans. (C) SMTP
18. Which device is primarily used to amplify and regenerate signals in a
network, allowing data to travel longer distances?
(A) Switch
(B) Router (1)
(C) Repeater
(D) Bridge
Ans : ( C) Repeater
19. Which communication technique establishes a dedicated communication
path between two devices for the entire duration of a transmission, (1)
ensuring a continuous and consistent connection?

Ans : Circuit Switching


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
Assertion (A): Python functions can accept positional, keyword, and default
20. parameters.

Reasoning (R): Default parameters allow function arguments to be assigned (1)


a default value if no argument is provided during the function call.

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

Q No Section-B ( 7 x 2=14 Marks) Marks


Consider the following Python code snippet:
22.
a = [1, 2, 3]
b=a (2)
a.append(4)
c = (5, 6, 7)
d = c + (8,)
a. Explain the mutability of a and c in the context of this code.
b. What will be the values of b and d after the code is executed?

Ans : a) a is a mutable object (a list), meaning its contents can be


changed after it is created. This is demonstrated by the append()
method that adds an element to the list.
c is an immutable object (a tuple). Once created, its contents cannot
be changed. The operation c + (8,) does not modify c but creates a new
tuple.

b)The value of b will be [1, 2, 3, 4], as b references the same list as a,


which was modified by appending 4.
The value of d will be (5, 6, 7, 8), as the expression c + (8,) creates a
new tuple combining c and (8,).

( 1 marks + 1 Marks )

Give examples for each of the following types of operators in Python:


23.
(2)
(I) Assignment Operators

(II) Identity Operators

Ans :

(I) Assignment Operators: ( 1 Marks for Any one of them)

1. Example 1: = (Simple Assignment) Usage: x = 5 (assigns the


value 5 to x)
2. Example 2: += (Add and Assign) : Usage: x += 3 (equivalent to x
= x + 3)

(II) Identity Operators: ( 1 Marks for any one of them )

1. Example 1: is , Usage: x is y (checks if x and y refer to the


same object)
2. Example 2: is not : Usage: x is not y (checks if x and y do
not refer to the same object)

Page: 6/21
If L1 = [10, 20, 30, 40, 20, 10, ...] and L2 = [5, 15, 25, ...], then:
24.
(Answer using builtin functions only)

(I) A) Write a statement to count the occurrences of 20 in L1. (2)


OR
B) Write a statement to find the minimum value in L1.

(II) A) Write a statement to extend L1 with all elements from L2.


OR
B) Write a statement to get a new list that contains the unique elements
from L1.

Ans : I ( A) : count_20 = L1.count(20)


(B) : min_value = min(L1)

II (A) : L1.extend(L2)
(B) : unique_elements = list(set(L1))

( 1 marks for each correct answer , no marks if did not used


any built in function )
25. Identify the correct output(s) of the following code. Also write the minimum
and the maximum possible values of the variable b.
import random
text = "Adventure"
b = random.randint(1, 5)
for i in range(0, b):
print(text[i], end='*') (2)

(A) A* (B) A*D*

(C) A*d*v* (D) A*d*v*e*n*t*u*


Ans :  Minimum possible value of b: 1 ( 1/2 + 1/2 marks)
 Maximum possible value of b: 5

Possible Outputs : (A) and ( C ) ( 1/2 + 1/2 marks )

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] )

Ans : Corrections : ( 1/2 x 4 = 2)


iAdded a colon (:) after the function definition.
ii. Indented the if statement and the return statement for proper
structure.
iii. Put ( ) while calling the function reverse_list( )
iv. Added a comma (,) in the print statement for correct syntax.

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

(II)(A):ALTER TABLE Users DROP CONSTRAINT unique_email;


OR
(B):ALTER TABLE Users ADD CONSTRAINT unique_email UNIQUE
(email);

( 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

(B): · DNS stands for Domain Name System. It translates human-


readable domain names (like www.example.com) into IP addresses that
computers use to identify each other on the network.

( for part A 1/2 + 1/2 )


(for part B 1/2 for correct abbreviation and 1/2 for correct use)

Q No. Section-C ( 3 x 3 = 9 Marks) Marks

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:

(I) push_movie(MovieStack, new_movie): This function takes the stack


MovieStack and a new movie record new_movie as arguments and pushes
the new movie record onto the stack.

(II) pop_movie(MovieStack): This function pops the topmost movie record


from the stack and returns it. If the stack is empty, the function should
display "Stack is empty".

(III) peek_movie(MovieStack): This function displays the topmost movie (3)


record from the stack without deleting it. If the stack is empty, the function
should display "None".

OR

(B) Write the definition of a user-defined function push_odd(M) which


accepts a list of integers in a parameter M and pushes all those integers
which are odd from the list M into a Stack named OddNumbers.

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]

Then the stack OddNumbers should store: [7, 9, 15]

Ans : (A )
def push_movie(movie_stack, new_movie): # 1 mark

movie_stack.append(new_movie)

def pop_movie(movie_stack):

if not movie_stack: # 1 mark

return "Stack is empty"

Page: 10/21
return movie_stack.pop()

def peek_movie(movie_stack):

if not movie_stack: # 1 mark

return "None"

return movie_stack[-1]
OR

(B) def push_odd(M, odd_numbers):

for number in M: # 1mark

if number % 2 != 0:

odd_numbers.append(number)

def pop_odd(odd_numbers):

if not odd_numbers: # 1mark

return "Stack is empty"

return odd_numbers.pop()

def disp_odd(odd_numbers):

if not odd_numbers: # 1mark

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

Predict the output of the following code: (3)


numbers = [10, 15, 20]
for num in numbers:
for j in range(num // 5):
print(j, "+", end="")
print()

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

32. Consider the table ORDERS as given below

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
1005 David Tablet NULL 7000

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;

Ans : (A) ( 1 MARK EACH)


(I) SELECT Product, SUM(Quantity) AS Total_Quantity
FROM ORDERS
GROUP BY Product
HAVING SUM(Quantity) >= 5;

(II)SELECT O_Id, C_Name, Product, Quantity, Price


FROM ORDERS
ORDER BY Price DESC;

(III)SELECT DISTINCT C_Name


FROM ORDERS;

(IV)SELECT SUM(Price) AS Total_Price_Null_Quantity


FROM ORDERS
WHERE Quantity IS NULL;

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)

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
(IV)
MAX(Price)
12000

A CSV file "HealthData.csv" contains the data of a health survey. Each


33. record of the file contains the following data:

 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].

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 life expectancy is greater than 75.

(II) Count the number of records in the file.

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

Sub_ID S_ID SubName Credits


301 201 Mathematics 3
302 202 Science 4
303 203 History 2
304 204 Literature 3
305 205 Physics 4
Computer
306 201 3
Science
Write the following SQL queries:
(I) To display complete details (from both the tables) of those students
whose marks are greater than 70.
(II) To display the details of subjects whose credits are in the range of 2 to 4
(both values included).
(III) To increase the credits of all subjects by 1 which have "Science" in their
subject names.
(IV) (A) To display names (FName and LName) of students enrolled in the
"Mathematics" subject.
(OR)
(B) To display the Cartesian Product of these two tables.

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;

A table, named ELECTRONICS, in the PRODUCTDB database, has the


35. following structure:

Field Type
productID int(11)
productName varchar(20)
price float
stockQty int(11)
(4)
Write the following Python function to perform the specified operation:

AddAndDisplay(): To input details of a product and store it in the table


ELECTRONICS. The function should then retrieve and display all records
from the ELECTRONICS table where the price is greater than 150.
Assume the following for Python-Database connectivity:
Host: localhost
User: root
Password: Electro123

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 )

Q.No. SECTION E (2 X 5 = 10 Marks) Marks


Raj is a supervisor at a software development company. He needs to
36. manage the records of various employees. For this, he wants the following
information of each employee to be stored:
Employee_ID – integer
Employee_Name – string
Position – string
Salary – float (5)
You, as a programmer of the company, have been assigned to do this job for
Raj.
(I) Write a function to input the data of an employee and append it to a binary
file.
(II) Write a function to update the data of employees whose salary is greater
than 50000 and change their position to "Team Lead".
(III) Write a function to read the data from the binary file and display the data
of all those employees who are not "Team Lead".

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

Distance of Bangalore Head Office from Chennai Hub: 1300 km

Number of Computers in Each Building/Office:

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:

 It has the largest number of computers (40), making it the most


central location in terms of the network load.
 The distances to other buildings are relatively short, ensuring
efficient data transfer. (1 Mark)

(II) A switch should be used within each building to connect all


computers. A switch is ideal for creating a local area network (LAN)
and ensures efficient communication between devices in a single
building. ( 1 Mark)

(III) The most efficient cable layout would involve connecting the
buildings as follows:

 OPERATIONS to WAREHOUSE (40 m)


 OPERATIONS to MAINTENANCE (50 m)
 OPERATIONS to CUSTOMER_SUPPORT (90 m)
 WAREHOUSE to MAINTENANCE (45 m)
 WAREHOUSE to CUSTOMER_SUPPORT (60 m)

Page: 20/21
CUSTOMER_SUPPORT

(90 m)

OPERATIONS

/ | \

(40 m) (50 m) (60 m)

/ | \

WAREHOUSE MAINTENANCE

Cable Recommendation: Fiber optic cable is recommended for high-


speed data transfer and reliable communication over distances. It
offers better bandwidth and lower signal degradation over long
distances than copper cables. ( 1/2 + 1/2 mark)

(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.

(1 mark for any correct part solution )

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.

Q No. Section-A (21 x 1 = 21 Marks) Marks


1 State True or False 1
In Python, a dictionary is an ordered collection of items(key:value pairs).
2 State the output of the following 1
L1=[1,2,3] i) [1,3,7]
L2=L1
ii) [2,3,7]
L1.append(7)
L2.insert(2,14) iii) [1,14,3,7]
L1.remove(1) iv) [2,14,3,7]
print(L1)
3 The following expression will evaluate to 1
print(2+(3%5)**1**2/5+2)
i) 5 ii) 4.6 iii) 5.8 iv) 4

4 What is the output of the expression? 1


food=’Chinese Continental’
print(food.split(‘C’))
i) ('', 'hinese ', 'ontinental')
ii) ['', 'hinese ', 'ontinental']
iii) ('hinese ', 'ontinental')
iv) ['hinese ', 'ontinental']
5 What will be output of the following code snippet? 1
Msg=’Wings of Fire!’
print (Msg[-9: :2])
6 What will be the output of the following: 1
T1=(10)
print(T1*10)
i) 10 ii) 100 iii)(10,10) iv(10,)
7 If farm is a t as defined below, then which of the following will cause an exception? 1
farm={‘goat’:5,’sheep’:35,’hen’:10,’pig’:7}
i) print(str(farm))
ii) print(farm[‘sheep’,’hen’])
iii) print(farm.get(‘goat))
iv) farm[‘pig’]=17
8 What does the replace(‘e’,’h’) method of string does? 1
i) Replaces the first occurrence of ‘e’ to ‘h’
ii) Replaces the first occurrence of ‘h’ to ‘e’
iii) Replace all occurrences of ‘e’ to ‘h’
iv) Replaces all occurrences of ‘h’ to ‘e’
9 If a table has 1 primary key and 3 candidate key, how many alternate keys will be in 1
the table.
i) 4 ii) 3 iii)2 iv)1
10 Write the missing statement to complete the following code 1
file = open("story.txt")
t1 = file.read(10)
_________________________#Move the file pointer to the beginning of the file
t2= file.read(50)
print(t1+t2)
file.close()
11 Which of the following keyword is used to pass the control to the except block in 1
Exceptional handling?
i) pass ii) finally iii) raise iv)throw
12 What will be the output of the following code: 1
sal = 5000
def inc_sal(per):
global sal i) 5000%6000$
inc = sal * (per / 100) ii) 5500.0%6000$
sal += inc iii) 5000.0$6000%
inc_sal(10) iv) 5500%5500$
print(sal,end='%')
sal=6000
print(sal,end='$')

13 State the sql command used to add a column to an existing table? 1


14 What will be the output of the following query? 1
Mysql> SELECT * FROM CUSTOMER WHERE CODE LIKE ‘_A%’
A) Customer details whose code’s middle letter is A
B) Customers name whose code’s middle letter is A
C) Customers details whose code’s second letter is A
D) Customers name whose code’s second letter is A
15 Sushma created a table named Person with name as char(20) and address as 1
varchar(40). She inserted a record with “Adithya Varman” and address as “Vaanam
Illam, Anna Nagar IV Street”. State how much bytes would have been saved for this
record.
i)(20,34) ii)(30,40) iii)(14,40) iv)14,34)
16 _____ gives the number of values present in an attribute of a relation. 1
a)count(distinct col) b)sum(col) c)count(col) d)sum(distinct col)
17 The protocol used identify the corresponding url from ip address is _____ 1
a)IP b)HTTP c)TCP d)FTP
18 The device used to convert analog signal to digital signal and vice versa is .. 1
a)Amplifier b)Router c)Modem d)Switch
19 In ___________ switching technique, data is divided into chunks of packets and 1
travels through different paths and finally reach the destination.
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) : A function can have multiple return statements 1
Reason (R) : Only one return gets executed Values are returned as a tuple.
21 Assertion (A) : DROP is a DDL command 1
Reason(R ) : It is used to remove all the content of a database object

Q No. Section-B ( 7 x 2=14 Marks) Marks


22 Differentiate list and tuple with respect to mutability. Give suitable example to 2
illustrate the same .
23 Give two examples of each of the following 2
a) Assignment operators b) Logical operators
24 If L1 = [13,25,41,25,63,25,18,78] and L2= [58,56,25,74,56] 2
(i) A) Write a statement to remove fourth element from L1
Or
B) Write the statement to find maximum element in L2

(ii) (A) write a statement to insert L2 as the last element of L1


OR
(B) Write a statement to insert 15 as second element in L2
25 Identify the correct output(s) of the following code. Also write the minimum and the 2
maximum possible values of the variable Lot

import random
word='Inspiration'
Lot=2*random.randint(2,4)
for i in range(Lot,len(word),3):
print(word[i],end='$')

i) i$a$i$n$ ii) i$n$


iii) i$t$n$ iv) a$i$n$

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.

Q No. Section-C ( 3 x 3 = 9 Marks) Marks


29 (A) Write a function that counts no of words beginning with a capital letter from 3
the text file RatanJi.txt
Example:
If you want to Walk Fast,
Walk Alone.
But - if u want to Walk Far,
Walk Together
Output:
No of words starting with capital letter : 10

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”.

31 Predict the output of the Python code given below: 3


Con1="SILENCE-HOPE-SUCCEss@25"
Con2=""
i=0
while i<len(Con1):
if Con1[i]>='0' and Con1[i]<='9':
Num=int(Con1[i])
Num-=1
Con2=Con2+str(Num)
elif Con1[i]>='A' and Con1[i]<='Z':
Con2=Con2+Con1[i+1]
else:
Con2=Con2+'^'
i+=1
print(Con2)

Q Section-D ( 4 x 4 = 16 Marks) Mar


No. ks
32 Consider the following table named Vehicle and state the query or state the output 4
Table:- Vehicle
VID LicensePlate VType Owner Contact State
Cost
1 MH12AB1234 Car Raj Kumar 65 9876543210 Maharastra
2 DL3CDE5678 Truck Arjith Singh 125 8765432109 New Delhi
3 KA04FG9012 Motor cycle Prem Sharma 9123456789 Karnataka
4 TN07GH3456 SUV Shyad Usman 65 9987654321 Tamil Nadu
5 KA01AB1234 Car Devid jhon 65 9876543210 Karnataka
6 TN02CD5678 Truck Anjali Iyer 125 8765432109 Tamil Nadu
7 AP03EF9012 Motor cycle Priya Reddy 9123456789 Andhra Pradesh
(A)
(i) To display number of different vehicle type from the table vehicle
(ii) To display number of records entered vehicle type wise whose minimum cost is above 80
(iii)To set the cost as 45 for those vehicles whose cost is not mentioned
(iv) To remove all motor cycle from vehicle
OR
(B)
(i) SELECT VTYPE,AVG(COST) FROM VEHICLE GROUP BY VTYPE;
(ii) SELECT OWNER ,VTYPE,CONTACT FROM VEHICLE WHERE OWNER LIKE
“P%”;
(iii)SELECT COUNT(*) FROM VEHICLE WHERE COST IS NULL;
(iv) SELECT MAX(COST) FROM VEHICLE;
33 A CSV file “Movie.csv” contains data of movie details. Each record of the file contains the 4
following data:
1.Movie id
2.Movie name
3.Genere
4.Language
5.Released date
For example, a sample record of the file may be:
["tt0050083",’ ‘12 Angry Men is’,’Thriller’.’Hindi’,’12/04/1957’]
Write the following functions to perform the specified operations on this file
(i) Read all the data from the file in the form of the list and display all those records for
which language is in Hindi.
(ii) Count the number of records in the file.
34 Salman has been entrusted with the management of Airlines Database. He needs to access some 4
information from Airports and Flights tables for a survey. Help him extract the following
information by writing the desired SQL queries as mentioned below.
Table - Airports
A_ID A_Name City IATACode
1 Indira Gandhi Intl Delhi DEL
2 Chhatrapati Shivaji Intl Mumbai BOM
3 Rajiv Gandhi Intl Hyderabad HYD
4 Kempegowda Intl Bengaluru BLR
5 Chennai Intl Chennai MAA
6 Netaji Subhas Chandra Bose Intl Kolkata CCU
Table - Flights
F_ID A_ID F_No Departure Arrival
1 1 6E 1234 DEL BOM
2 2 AI 5678 BOM DEL
3 3 SG 9101 BLR MAA
4 4 UK 1122 DEL CCU
5 1 AI 101 DEL BOM
6 2 6E 204 BOM HYD
7 1 AI 303 HYD DEL
8 3 SG 404 BLR MAA
i) To display airport name, city, flight id, flight number corresponding flights whose
departure is from delhi
ii) Display the flight details of those flights whose arrival is BOM, MAA or CCU
iii) To delete all flights whose flight number starts with 6E.
iv) (A) To display Cartesian Product of two tables
OR
(B) To display airport name,city and corresponding flight number
35 A table named Event in VRMALL database has the following structure: 4

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.

Assume the following values for Python Database Connectivity


Host-localhost, user-root, password-tiger

Q No. Section-E ( 2 x 5 = 10 Marks) Marks


36 Ms Joshika is the Lab Attendant of the school. She is asked to maintain the project 5
details of the project synopsis submitted by students for upcoming Board Exams.
The information required are:
-prj_id - integer
-prj_name-string
-members-integer
-duration-integer (no of months)
As a programmer of the school u have been asked to do this job for Joshika and define
the following functions.
i) Prj_input() - to input data of a project of student and append to the binary
file named Projects
ii) Prj_update() - to update the project details whose member are more than 3
duration as 3 months.
iii) Prj_solo() - to read the data from the binary file and display the data of all
project synopsis whose member is one.
37 P&O Nedllyod Container Line Limited has its headquarters at London and regional 5
office at Mumbai. At Mumbai office campus they planned to have four blocks for HR,
Accts, Logistics and Admin related work. Each block has number of computers
connected to a network for communication, data and resource sharing
As a network consultant, you have to suggest best network related solutions for the
issues/problems raised in (i) to (v), keeping in mind the given parameters

REGIONAL OFFICE MUMBAI

HR ADMIN
London Head
Head Head
Office
Accts Logistics

Distances between various blocks/locations:


Admin to HR 500m
Accts to Admin 100m
Accts to HR 300m
Logistics to Admin 200m
HR to logistics 450m
Accts to logistics 600m
Number of computers installed at various blocks are as follows:
Block No of computers
ADMIN 95
HR 70
Accts 45
Logistics 28
i) Suggest the most appropriate block to place the sever in Mumbai office.
Justify your answer.
ii) State the best wired medium to efficiently connect various blocks within
the Mumbai Office.
iii) Draw the ideal cable layout (block to block) for connecting these blocks
for wired connectivity.
iv) The company wants to conduct an online meeting with heads of regional
office and headquarter. Which protocol will be used for the effective voice
communication?
v) Suggest the best place to house the following
a) Repeater b) Switch
KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION
CLASS: XII SESSION: 2024-25
PREBOARD I MARKING SCHEME
COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70

Q No. Section-A (21 x 1 = 21 Marks) Marks


1 False 1
(1 mark for correct answer)
2 iv) [2,14,3,7] 1
(1 mark for correct answer)
3 ii) 4.6 1
(1 mark for correct answer)
4 ii) ['', 'hinese ', 'ontinental'] 1
(1 mark for correct answer)
5 so ie 1
(1 mark for correct answer)
6 ii) 100 1
(1 mark for correct answer)
7 ii) print(farm[‘sheep’,’hen’]) 1
(1 mark for correct answer)
8 iii) Replace all occurrences of ‘e’ to ‘h’ 1
(1 mark for correct answer)
9 iii)2 1
(1 mark for correct answer)
10 file.seek(0) 1
(1 mark for correct answer)
11 iii) raise 1
(1 mark for correct answer)
12 ii) 5500.0%6000$ 1
(1 mark for correct answer)
13 ALTER (or ALTER TABLE) 1
(1 mark for correct answer)
14 iii) Customers details whose code’s second letter is A 1
(1 mark for correct answer)
15 i) (20,34) 1
(1 mark for correct answer)
16 c)count(col) 1
(1 mark for correct answer)
17 a)IP 1
(1 mark for correct answer)
18 c)Modem 1
(1 mark for correct answer)
19 Packet Switching 1
(1 mark for correct answer)
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 A) Both A and B are true and R is the correct explanation for A 1
(1 mark for correct answer)
21 D) A is False B is True 1
Q No. Section-B ( 7 x 2=14 Marks) Marks
22 Difference 1 mark 2
Example ½ mark each
23 a) Assignment Operators = += -= *= **= /= //= %= 2
b) Logical Operators not and or (any two from each)
(1/2 mark for each correct operator)
24 2
(i) A) L1.pop(4)
Or
B) a=max(L2) or print(max(L2)

(ii) (A) L1.append(L2)


OR
(B) L2.insert(1,15)
25 Identify the correct output(s) of the following code. Also write the minimum and the 2
maximum possible values of the variable Lot
Minimum value possible for Lot: 4
Maximum value possible for Lot: 8
Possible outputs are : i) and ii)
26 Identify Primary Key and Candidate Key present if any in the below table name 2
Colleges. Justify
Primary Key: Cid its unique
Candidate Key: Cid, Name, PhoneNumber as they are have unique values

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

Q No. Section-C ( 3 x 3 = 9 Marks) Marks


29 a) Opening and closing file ½ mark 3
Read() ½ mark split() ½ mark
Loop ½ mark upper case checking ½ mark
Output display ½ mark
OR
b)
Opening and closing file ½ mark
Readlines() ½ mark
Loop ½ mark counting no of words ½ mark
Output display ½ mark
30 (1/2 for identifying even numbers) 3
(1/2 mark for correctly adding data to stack)
(1/2 mark for correctly poping data on the stack and 1/2 mark for checking
condition)
(1/2 mark for correctly displaying the data with none)
(1/2 mark for function call statements)
OR
(1 ½ mark for correct function body; No marks for any function header as it
was a part of the question)
31 ILENCE-^OPE-^UCCEs^^^14 correct o/p 3 mark 3

Q Section-D ( 4 x 4 = 16 Marks) Mar


No. ks
32 i) SELECT COUNT(DISTINCT VTYPE) FROM VEHICLE; 4
ii) SELECT VTYPE,COUNT(*) FROM VEHICLE GROUP BY VTYPE HAVING
MIN(COST)>80;
iii) UPDATE VEHICLE SET COST=45 WHERE COST IS NULL
iv) SELECT OWNER ,VTYPE,CONTACT FROM VEHICLE WHERE OWNER LIKE
“P%”;
OR
i)
+---------------------+-----------------+
| VTYPE | AVG(COST) |
+----------------------+-----------------+
| CAR | 65.0000 |
| truck | 125.0000 |
| Moter Cycle | NULL |
| SUV | 65.0000 |
| MOTOR CYCLE | NULL |
+----------------------+-----------------+
ii)
+--------------------+----------------------+------------------+
| OWNER | VTYPE | CONTACT |
+---------------------+----------------------+-----------------+
| Prem Sharma | Moter Cycle | 9987654321 |
| PRIYA REDDY | MOTOR CYCLE | 9123456789 |
+---------------------+----------------------+-----------------+
iii)
+---------------+
| COUNT(*) |
+--------------+
| 2|
+--------------+
iv)
+-----------------+
| MAX(COST) |
+-----------------+
| 125 |
+-----------------+

33 (½ mark for opening in the file in right mode) 4


(½ mark for correctly creating the reader object)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records)
OR
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correct use of counter)
(½ mark for correctly displaying the counter)
34 i) select airports.a_id,city,f_id,F_no from flights,airports where flights.f_id=airports.a_id 4
and departure="DEL";
ii) select * from flights where arrival="bom" or arrival="Maa" or arrival="ccu";
iii) delete from flights where F_no like "6E%";
iv) (A) select * from flights,airports;
OR
(b) select airports.a_id,city,flights.f_id from flights,airports where airports.a_id=flights.a_id;
35 4
#interface code
import mysql.connector as mn
def Input_Disp():
con=mc.connect(host="localhost",user="root",password="tiger",database="VRMALL")
cur=con.cursor()
print("Enter Event Details:")
eid=input("ID:")
ename=input("NAME:")
edate=input("DATE:")
des=input("Description:")
query="insert into Event values("+eid+",'"+ename+"','"+edate+"','"+des+"')"
cur.execute(query)
con.commit()
print("Record Inserted")

print("Details of Event organised in year 2024")


query="select * from Event where eventdate like '2024'"
cur.execute(query)
data=cur.fetchall()
print("ID NAME DATE DESCRIPTION")
for rec in data:
print(rec[0],rec[1],rec[2],rec[3],sep= " ")
con.close()
or any other relavant code
import ½ mark
Connectivity stmt ½ mark
Cursor creation query creation ,execute(), commit ½ mark each
Query creation, cursor execution ½ mark each
Fetching data and display loop ½ mark each
Q No Section-E ( 2 x 5 = 10 Marks) Mark
s
36 #binary file
def Prj_input():
file=open("Projects.dat","ab")
print("Enter Project Details:")
pid=int(input("ID:"))
pname=input("NAME:")
mem=int(input("MEMBERS:"))
dur=int(input("DURATION IN MONTHS:"))
rec=[pid,pname,mem,dur]
pickle.dump(rec,file)
file.close()
print("data inserted")
def Prj_update():
file=open("Projects.dat","rb+")
try:
while True:
pos=file.tell()
rec=pickle.load(file)
5
if rec[2]>3:
rec[3]=3
file.seek(pos)
pickle.dump(rec,file)
except EOFError:
pass
finally:
file.close()
print("Record modified")
def Prj_solo():
file=open("Projects.dat","rb")
try:
print("PROJECT DETAILS")
print("ID NAME MEMBERS DURATION")
while True:
import pickle ½ mark
rec=pickle.load(file)
input and ifclose ½ mark ,insert 1 mark
rec[2]==1:
try except block ½ mark loop ½ mark
print(rec[0],recc[1],rec[2],rec[3],sep=" ")
reading records , updation
file.seek(pos) ½ mark each
try catch block ½ mark
pickle.dump(rec,file)
loop except
½ markEOFError:
fetching and display ½ mark each
37 passi) Server to be placed in ADMIN block as it has maximum number of 5
file.close() computers(70 30 traffic rule)
ii) Coaxial cable/fiber optics
iii) Star topology or any other layout

LOGISTICS
ACCTS

ADMIN

HR

iv) VoIP Voice over internet Protocol


v)
a) Repeater –distance more then 90 m –all
..if fiber optical cable then no repeater
b) Switch- in each block as to connect computers
KENDRIYA VIDYALAYA SANGATHAN: JABALPUR REGION
FIRST PRE-BOARD (2024-25)
CLASS: XII Time allowed: 3 Hours Maximum Marks:70
COMPUTER SCIENCE (083-THEORY)

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.

Q No. Section-A (21x1=21Marks) Marks

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="*")

A) 945$9* B) 945$9 C) 9*945$ D) 9$945*


13. Which type of command is used to delete the structure of the relation? (1)
A) DDL B) DML C) Select D) Cannot delete structure
14. What will the following query show?
(considering a table student with some columns)
SELECT * FROM students WHERE age in (17,19,21);
A) Show tuples of students table with all the age values from 17 to 21 (1)
B) Show tuples of students table only with the age values 17,19,21
C) Show tuples of students table only with the age values other then 17,19,21
D) Show tuples of students table with all the age values outside the range 17 to 21
15. Which of the following is not a data type in Python
A) date B) string C) tuple D) float (1)
16. Which of the following is not an aggregate function?
A) max( ) B) count( ) C) sum( ) D) upper( ) (1)
17. Which of the following protocol helps in e-mail services?
A) FTP B) PPP C) UDP D) MIME (1)
18. In order to cover a long-distance network which of the following device will be (1)
helpful?
A) Modem B) Gateway C) Switch D) Repeater
19. What is SIM & GPRS? (1)
A) Small Information Machine & Global People Research and Science
B) Subscriber Identity Module & General Packet Radio Service
C) Subscriber Information Module & General Public Radio Shrive
D) None of these

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

20. Assertion(A): In a relation of RDBMS, redundancy can be reduced.


Reasoning (R): This can be done with the help of join operations in between
relation. (1)
21. Assertion (A): A function in Python can have any number of arguments.
Reasoning(R): variable length parameter can be used to deal with such number of
arguments. (1)
Q No Section-B (7x2=14 Marks) Marks
22. a) Explain dictionary with example?
b) What is the data type of (i) x=10 (ii) x=10,20 (2)
23. Explain ‘in’ operator and write a small code in Python to show the use of ‘in’ (2)
operator.
24. Consider T=(10,20,30) and L=[60,50,40] answer the question I and II (1)
(I) Write command(s) to add tuple T in list L.
OR
Write command to find and delete element 20 from tuple T
(II) Write command to add 50 in L at position 2. (1)
OR
Write command to delete the variable T.
25. Identify the correct output(s) of the following code and write the minimum and the
maximum possible values of the variable b.
import random
a="ComputerScience"
I=0
while (I<3):
b=random.randint(1,len(a)-1) (2)
print(a[b],end='$')
I+=2

A) C$m$ B) m$p$ C) c$n$ D)c$e$c$


26. Write a function named RECORDS() which can open a binary file named
‘district.dat’ containing the population data of all the districts of a state. The
function will ask for the name of the district to be searched in file and display its (2)
data from the file. [Note: Name of dist. is stored at 0 index of record in district.dat]
27. [I]
A) Benjamin a database administrator created a table with few columns. He
wants to stop duplicating the data in the table. Suggest how he can do so.
OR
B) Consider two tables student (rno, name, class) and marks (rno, mrk_obt,
percent). You as a database administrator how will your stop redundancy of
data in the table students and how the tables students and marks can be
connected with each other (2)
[II]
A) Write an SQL command to change the data type of a column named price
to number (10,2) in a table named stationary
OR
3
B) Write an SQL command to change the values of all the rows of the column
price of table stationary to Null
28. A) Difference between star and mesh topology.
OR (2)
B) Write the full forms of (i) VoLTE (ii) GSM

Q No. Section-C(3x3=9Marks) Marks


29. A) Write a Python function that displays all the words starting from the letter ‘C’
in the text file "chars.txt".
OR (3)
B) Write a Python function that can read a text file and print only numbers stored
in the file on the screen (consider the text file name as "info.txt").
30. A) You have a stack named Inventory that contains records of medicines. Each
record is represented as a list containing code, name, type and price.
Write the following user-defined functions in Python to perform the specified
operations on the stack Inventory:
i. New_In (Inventory, newdata): This function takes the stack Inventory and
newdata as arguments and pushes the newdata to Inventory stack.
ii. Del_In(Inventory): This function removes the top most record from the
stack and returns it. If the stack is already empty, the function should
display "Underflow".
iii. Show_In(Inventory): This function displays the topmost element of the (3)
stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
B) Write the definition of a user-defined function `Push(x)` which accepts a string
in parameter `x` and pushes only consonants in the string `N` into a Stack named
`Consonants`.
Write function Display () to display all element of the stack.

For example: x = “Python”


Then the stack `Consonants’ should store: [‘P’,’y’,’t’,’h’,’n’]
31. Predict the output of the following code:
d={}
V="programs"
for x in V: (3)
if x in d.keys():
d[x]=d[x]+1
else:
d[x]=1
print(d)
OR
Predict the output of the following code:
V="interpreter"
L=list(V)
L1=""
for x in L:
if x in ['e','r']:
L1=L1+x
print(L1)

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

“Note: Consider the table contains the above records.”


A) Write the queries for the following:
i) To display the total quantity sold (qsold) of wsale for qtr number 3.
ii) To display the details of watches in descending order of qty.
iii) To display the total quantity of watches.
iv) To display the wname and maximum qsold from the table watches and
wsale sold in qtr=1
OR
B) Write the output
i) Select sum(price) from watches;
ii) Select * from watched where wname '%e';
iii) Select sum(qty), type from watches group by type;
iv) Select wname, price, qtr from watches, wsold
where watches.id = wsale.wid and watches.type=’Common’;
33. A csv file "candidates.csv" contains the data collected from an online application form
for selection of candidates for different posts, with the following data
• Candidate Name
• Qualification (4)
• Percent_XII
• Percent_Qualification
E.g. [‘Smith Jones’, ‘M Tech’, 80, 76]
Write the following Python functions to perform the specified operations on this file:
a) READ() function which can read all the data from the file and display only records
with Percent_XII more than 75
b) IDENTIFY() function which can find and print the number of such records which are
having Percent_XII not more than 75
34. A school is maintaining the records of his departments and their in-charges in the
following table and wants to see the data according to the following conditions. Study
the following table and write the queries for (i) to (iii) and output for (iv)

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

Q No. Section-A (21x1=21Marks) Marks


1. False (1)
2. (A) C) not (True or False) (1)
3. (B) B) split() (1)
4. (A) C) error (1)
5. B) xlnd (1)
6. D) 2024 (1)
7. B) print(D['Computer']) (1)
8. B) remove deletes the list or tuple from the memory (1)
9. A) 1 (1)
10. B) 100, 10 (1)
11. try …except block (1)
12. A) 945$9* (1)
13. A) DDL (1)
14. B) Show tuples of students table only with the age values 17,19,21 (1)
15. A) date (1)
16. D) upper (1)
17. D) MIME (1)
18. D) Repeater (1)
19. B) Subscriber Identity Module & General Packet Radio Service (1)
20. B) Both A and R are true and R is not the correct explanation for A (1)
21. A) Both A and R are true and R is the correct explanation for A (1)
Q No Section-B(7x2=14 Marks) Marks
22. a) Either definition of dictionary or example of dictionary 1 mark
b) (i) x=10 integer ½ mark (ii) x=10,20 tuple ½ mark
23. Relevant explanation about in operator 1 mark
Eg.
A=”welcome” 1 mark
if ‘e’ in A: example
print(“found a vowel”)
or any code that demonstrate the use of in operator
24. Consider T=(10,20,30) and L=[60,50,40] answer the question I and II
(I)
L.append(T) 1 mark
OR OR
As T is tuple deletion of an element is tuple is not possible due to 1 mark
its immutable nature.(any relevant correct reason)
(II)
L.insert(50,2) 1 mark
OR OR
del T 1 mark

Page:1/5
25.
B) m$p$ C) c$n$ For each correct answer ½ mark

Value of b minimum 1 and maximum 14


½ mark for each minimum and maximum
26. Any relevant code with following marks distribution
½ mark for correct function declaration
1 ½ mark for logic (2)

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 any other correct relevant code

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()

Or any other correct relevant code.


31. {'p': 1, 'r': 2, 'o': 1, 'g': 1, 'a': 1, 'm': 1, 's': 1} 3 marks
(partial marking may be given)
OR
erreer 3 marks (3)
(partial marking may be given)
Q No. Section-D( 4x4=16Marks) Marks
32. A) Write the queries for the following:
i) Select sum(qsold) from wsale where qtr=3;
ii) Select * from watches order by qty desc;
iii) Select sum(qty) from watches;
iv) Select wname, max(qsold) from watches , wsale where
Page:3/5
watches.id=wsale.wid and qtr=1;
iv) OR
B) Write the output
i) Sum(price) (4)
6290
ii)
Id Wname Price Type Qty
W01 High Time 1200 Common 75
W02 Life line 1600 Gents 150
W03 Wave 780 Common 240

iii) sum(qty) type


315 Common
610 Gents
250 Ladies

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)

or any other correct relevant code


34. (I)Select * from departments where date_join < ’01-01-2010’; 1
(II) Select d_name, d_incharge from departments where d_incharge like 1
‘%m%;’
(III) Update departments set grant=grant+1200 where d_no in (‘D99’, ‘D23’) 1
(IV) d_name grant
Primary Null
OR
sum(grant) 1
34000

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy