[go: up one dir, main page]

0% found this document useful (0 votes)
182 views62 pages

Kvs Pb i Cs 202425 Solutions

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 62

KENDRIYA VIDYALAYA SANGATHAN: BHUBANESWAR REGION

FIRST PRE-BOARD EXAMINATION 2024-25


CLASS XII - COMPUTER SCIENCE (083)
MARKING SCHEME
Time allowed: 3 Hours Maximum Marks: 70

SECTION-A (21 x1=21M)


1 True 1

(1 mark for correct answer)

2 a) KENDRIYA-vidyalaya@Sangathan 1
(1 mark for correct answer)
3 (b) False 1

(1 mark for correct answer)

4 @aaa 1

(1 mark for correct answer)

5 (b) (1,2,[1,3.5],3) 1

(1 mark for correct answer)

6 c. True@False 1
(1 mark for correct answer)
7 a.0 1

(1 mark for correct answer)

8 (d) Statements 2 and 4 1

(1 mark for correct answer)

9 True 1

(1 mark for correct answer)

10 b. del COLOR["Red"] 1
(1 mark for correct answer)
11 (c) file object 1
(1 mark for correct answer)

12 (iii) PYTHON#0#0 1

(1 mark for correct answer)

13 (b) describe 1

(1 mark for correct answer)

14 (c) Cardinality 1

(1 mark for correct answer)

15 d)DELETE FROM emp; 1

(1 mark for correct answer)

16 Alter Table 1

(1 mark for correct answer)

17 a. PAN 1

(1 mark for correct answer)

18 (a) VoIP 1

(1 mark for correct answer)

19 Modem 1
(1 mark for correct answer)
20 a. Both A and R are true and R is the correct explanation for A. 1

(1 mark for correct answer)

21 a. Both A and R are true and R is the correct explanation for A. 1

(1 mark for correct answer)

SECTION-B (7 x 2 =14M)

22 def Calc(a): #def 2

s=m=n=0 #local variable


for i in (0,a): #indentation and range function missing

if i%2==0:

s=s+I

elif i%5==0: #elif and colon

m=m+i

else:

n=n+i

print(s,m,n) #indentation

Calc(15)

(1/2 mark for each error)

23 i. def, for ( or any two examples) 2


ii. list , dictionary
(1 mark for each correct answer)
24 a del(D["Mumbai"]) or D.pop("Mumbai”) 2

b. print(S.split())

OR

L1.insert(1,100)

L1.sort()

(1 mark for each correct answer)

25 (a) 30 @ 2
MAX value of BEG and END are 2 and 4
(1 mark for each correct answer and 1 mark for maximum value)
26 Degree: The number of attributes or columns in a relation is called the Degree of 2
the relation.
Attribute: An attribute is a specification that defines a property of an object
(column / fields of a relation) Example: Any valid example to show degree and
attribute.
(2 mark for correct answer)
Or

Foreign Key: Foreign Key is a non-key attribute derived from primary key of
some other table. A table can have 0 or more foreign keys.

(2 mark for correct answer)

27 DELETE is used for deleting records from a table. DROP is used to delete the 2
entire schema of any database object like table.

e.g. DELETE FROM STUDENT WHERE ROLL = 5;

DROP TABLE STUDENT;

(2 mark for correct answer)

Or

SUM() and AVG ()-which work only with numeric data


MAX(),MIN(),COUNT()-which work with numeric data and Non-Numeric Data
(2 mark for correct answer)

28 Star topology 2

In Star topology all the devices are connected to a central hub/node.

In Star topology if the central hub fails then the whole network fails.

Bus Topology
In Bus topology each device in the network is connected to a single cable which
is known as the backbone

In Bus topology the failure of the network cable will cause the whole network to
fail.

(2 mark for correct answer)

Or

(i) POP3 -POST OFFICE PROTOCOL 3


URL -UNIFORM RESOURCE LOCATOR
(ii) Give one difference between XML and HTML.

HTML(Hyper Text Markup Language):

Hyper Text Markup Language (HTML) is a language which is used to design


standardized Web Pages, so that the Web contents can be read and under stood
from any computer using web browser.

Basic structure of every web page is designed using HTML. HTML uses tags to
define the way page content should be displayed by the web browser. Web
pages are stored as .html or .htm files.

Extensible Markup Language (XML): Extensible Markup Language is a markup


language and file format for storing, transmitting, and reconstructing arbitrary
data. It defines a set of rules for encoding documents in a format that is both
human-readable and machine-readable.

(1 mark for each correct answer)

SECTION-C (3 x 3 = 9 M)

29 def display_lines(): 3

fin = open('Poetry.txt','r')

count=0

lst=fin.readlines()

for line in lst:


l = line.strip().split()

if l[0]=='It':

count = count+1

print(count)

fin.close()

½ mark for opening file in correct mode

½ mark for readlines function

½ mark for loop

½ mark for strip and split function

½ mark for condition and increment

½ mark for display and close

Other working code is also allowed

Or

def Transfer (oldfile, newfile):

fin = open(oldfile, "r")

fout =open(newfile, "w")

while True:

text= fin.readline( )

if len(text) != 0:

if text[e] != "#":

fout.write(text)

fin.close()

fout.close()
Transfer("source.txt", "destination.txt")

(½ mark for correct function header)

(½ mark for correctly opening the file)

(½ mark for correctly reading from the file)

( ½ mark for checking condition)

(1 mark for correctly copying data from one file to another)

30 def Push_record(): # (1½ mark for correct push element) 3

for i in List:

if i[2]=="Delhi":

Record.append(i)

print(Record)

def Pop_record(): # (1½ mark for correct push element)

while True:

if len(Record)==0:

print('Empty Stack')

break

else:

print(Record.pop())

OR

N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]

def PushElement(S,N):

S.append(N)
def PopElement(S):

if S!=[ ]:

return S.pop()

else:

return None

ST=[]

for k in N:

if k%7==0:

PushElement(ST,k)

while True:

if ST!=[ ]:

print(PopElement(ST),end=" ")

else:

break

1- Mark for Push and 2-Mark for Pop functions.

31 (i)MCODE unique values (1 mark) 3


(ii) Degree = 4 (after removing one column) (1/2 mark)
Cardinality = 7 (after 2 more record added) (1/2 mark)
iii. mysql>alter table MOBILES add GST int; (1 mark)
OR
(i) mysql>update MOBILES set GST=(PRICE*0.18) (1 mark)
(ii) mysql>insert into MOBILES values(‘M06’,’iPHONE13’,’APPLE’,110000,’2022-03-
01’);
(1 mark)
(iii) mysql>delete from MOBILES where MODEL=’NARZO50’; (1 mark)

SECTION-D (4 x 4 = 16 M)
32 I. TypeError exception raised when an operation or function is applied to an
object of inappropriate type,

ii.def get_numeric_input(prompt):

while True:

try:

value = float(input(prompt))

return value

except ValueError:

print("Error: Invalid input. Please Input a valid number.")

except:

print("Some Error Ocurred")

n1 = get_numeric_input("Input the first number: ")

n2 = get_numeric_input("Input the second number: ")

result = n1 * n2

print("Product of the said two numbers:", result)

(or any suitable code)

(3x 1 mark for each correct part – try, except, except)

OR

i.The raise keyword is used to manually raise an exception like exceptions are
raised by Python itself. That means, as a programmer can force an exception to
occur through raise keyword. It can also pass a custom message to your
exception handling module.

ii.a = int( input("Enter value for a :"))

b = int( input("Enter value for b :"))


try:

if b == 0:

raise ZeroDivisionError # raising exception using raise keyword

print(a/b)

except ZeroDivisionError:

print("Please enter non-zero value for b.")

(or any suitable code)

(3x 1 mark for each correct part – try, except, except)

33 import csv #( ½ mark for import csv) 4


def SEARCH(): #(1 ½ mark for correct definition)

with open("empdata.csv",'r', newline='\r\n') as fh:


ereader=csv.reader(fh)
for r in ereader:
if int(r[2])>25000:
print(r[0],r[1],r[2],r[3])
break
else:
print("Employee Data not found")

def COUNTROW(): #(1 ½ for correct definition of function)


with open("empdata.csv ",'r', newline='\r\n') as fh:
sreader=csv.reader(fh)
count=0
for r in sreader:
count+=1
print("total record = ",count)
fh.close()
#main program (1/2 marks of functions calling)
SEARCH()

COUNTROW()

34 i. Select distinct Qty from garment; 4


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 1200 and 2000;

(1 mark for each correct answer)

35 def ChecknDisplay():

import mysql.connector as mycon

mydb=mycon.connect(host="localhost",user="root",

passwd="school123",database="COMPANY")

mycur=mydb.cursor()

eid=input("Enter EmpID : ")

nm=input("Enter EmpName : ")

s=input("Enter Salary: ")

dept=input("Enter Department : ")

query="INSERT INTO EMPLOYEES VALUES ({},'{}',{},’{}’)"

query=query.format(eid,nm,s,dept)

mycur.execute(query)

mydb.commit()

mycur.execute("select * from EMPLOYEES where salary>50000")

for rec in mycur:

print(rec)

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

(½ mark for correct creation of first query)

(½ mark for correctly executing the first query with commit)

(½ mark for correctly executing the second query)

(½ mark for correctly displaying the data)

SECTION-E (2 x 5 = 10 M)

36 i.Binary file: 5
Extension is .dat
Not human readable
Stores data in the form of 0s and 1s
CSV file
Extension is .csv
Human readable
Stores data like a text file
(1 mark for correct answer)
ii.import pickle

def AddStudents():
F= open("STUDENT.DAT",'wb') #1 statement to open the binary file to write
data
while True:
Rno = int(input("Rno :"))
Name = input("Name : ")
Percent = float(input("Percent :"))
L = [Rno, Name, Percent]
c. pickle.dump(L,F)
Choice = input("enter more (y/n): ")
if Choice in "nN":
break
F.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly inputting the data)
(½ mark for correctly writing the record in the file)
(½ mark for correctly closing the file, or ½ mark if the file was opened using
with)
def GetStudents():
Total=0
Countrec=0
Countabove75=0
with open("STUDENT.DAT","rb") as F:
while True:
try:
R = pickle.load(F)
Countrec+=1
Total+=R[2]
if R[2] > 75:
print(R[1], " has percent =",R[2])
Countabove75+=1
except:
break

if Countabove75==0:

print("There is no student who has percentage more than 75")

F.close()

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

(½ mark for correctly reading the data)

(½mark for checking condition in the file)

(½ mark for correctly closing the file)

37 a. Most suitable place to install the server is HR center, as this center has 5
maximum number of computers.

b.
.

c. Switch

d. Repeater may be placed when the distance between 2 buildings is more than
70 meter.

e. WAN, as the given distance is more than the range of LAN and MAN.

(1 mark for correct answer)


KENDRIYA VIDYALAYA SANGATHAN CHANDIGARH REGION
PRE-BOARD 1 - EXAMINATION - 2024-25
CLASS XII COMPUTER SCIENCE (Code: 083)
MARKING SCHEME

Time allowed: 3 Hours Maximum Marks: 70


Q No. SECTION A (21X1=21) Marks
1. TRUE (1)
(1 mark for correct answer)
2. (A) @ LLOWORLD
(1)
(1 mark for correct answer)
3. (C)
(1)
(1 mark for correct answer)
4. (A) ['N', 'tion', 'l']
(1)
(1 mark for correct answer)
5. o onn (1)
(1 mark for correct answer)
6. (B) False
(1)
(1 mark for correct answer)
7. (B) print(dict['name', 'age'])
(1)
(1 mark for correct answer)
8. (B) del D1["Name"]
(1)
(1 mark for correct answer)
9. (C) 3
(1)
(1 mark for correct answer)
10. file.seek(0) ( OR file.seek(0,0) )
(1)
(1 mark for correct answer)
11. False
(1)
(1 mark for correct answer)
12. (A) 25#45% (1)
(1 mark for correct answer)
13. Alter (or Alter Table) (1)
(1 mark for correct answer)

Page: 1/11
14. (C) Details of all students whose name contains ' Singh '
(1)
(1 mark for correct answer)
15. (D) CHAR
(1)
(1 mark for correct answer)
16. (A) total()
(1)
(1 mark for correct answer)
17. (C) VoIP
(1)
(1 mark for correct answer)
18. (A) Modem
(1)
(1 mark for correct answer)
19. Circuit Switching
(1)
(1 mark for correct answer)
20. (C) A is True but R is False.
(1)
(1 mark for correct answer)
21. (C) A is True but R is False.
(1)
(1 mark for correct answer)

Q No. SECTION B (7 X 2 =14) Marks


22. List object - Mutable object [1,2]
Tuple object - Immutable (1,2)
(1 mark for correct difference)
(2)
(½ x 2 = 1 Mark for selecting correct objects)

23. (I) Identity operators: is, not is

(II) Membership operators: in, not in (2)

(½ x 4 = 2 Marks for each correct operator)


24. (I)
A) L1+L2
OR
B) L1.reverse() (2)
(1 mark for correct answer)

Page: 2/11
(II)
A) L1.extend(L2)
OR
B) L2.clear()
(1 mark for correct answer)
25. (A), (B) and (C)
(1 Mark)
(2)
Minimum and maximum possible values of the variable b: 1,6
(½ x 2 = 1 Mark)
26.

(2)

(½ mark each for correcting 4 mistakes)

27. (I)
A) CHECK
OR
B) PRIMARY KEY
(1 mark for correct answer)
(2)
(II)
A) ALTER TABLE STUDENT DROP PRIMARY KEY;
OR
B) ALTER TABLE STUDENT ADD PRIMARY KEY (S_ID);
(1 mark for correct answer)
28. A)
(1 mark for correct Advantage)
(1 mark for correct Disadvantage)
(2)
OR

Page: 3/11
B) HTTPS: Hyper Text Transfer Protocol Secure.

HTTPS is a security protocol that encrypts data sent between a web


browser and a website..
(1 mark for correct expansion)
(1 mark for correct usage)

Q No. SECTION C (3 X 3 = 9) Marks


29. (A)

def show():
f=open("story.txt",'r')
data=f.read()
words=data.split()
for word in words:
if '@gmail' in word:
print(word,end=' ')
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)
(1 mark for correctly displaying the desired words) (3)
OR
(B)
def display_long_words():
with open("story.txt", 'r') as file:
data=file.read()
words=data.split()
for word in words:
if len(word)==5:
print(word,end=' ')
(½ 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)
(1 mark for correctly displaying the desired words)

Page: 4/11
30. (A)
(I)
def push_book(Books, new_book):
Books.append(new_book)
(II)
def pop_book(Books): if not
BooksStack:
print("Underflow")
else:
return(Books.pop())
(III)
def peep(Books): if not
Books: print("None")
else:
print(Books [-1])
(3x1 mark for correct function body; No marks for any function header as it
was a part of the question)
OR
(B)

(3)

(1 1/2 for each function)

Page: 5/11
31. (A) ND-*34

OR
(3)
(B) 1 @2 @3 @
1 @2 @
1@

(1 mark for each correct line of output)


(deduct ½ mark for not printing @/#)

Q No. SECTION D (4 X 4 = 16) Marks


32. (A)
(i) SELECT BID, SUM(UPrice) FROM PRODUCT group by BID;
(ii) DESC PRODUCT;
(iii) SELECT avg(rating) from PRODUCT;
(iv) SELECT PName, UPrice, Rating FROM PRODUCT ORDER BY Rating DESC;
(4 x 1 mark for each correct query)
OR

(4)
(B) 4 x 1 mark for each correct answer

Page: 6/11
33. (I)
def show():
import csv
f=open("country.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
for i in records:
if int(i[1])>5000000:
print(i)
f.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records) (4)

(II)
def Count_records():
import csv
f=open("country.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
count=0
for i in records:
count+=1
print(count)
f.close()

Page: 7/11
(½ 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)
Note (for both parts (I) and (II)):
(i) Ignore import csv as it may be considered the part of the
complete program, and there is no need to import it in individual
functions.
(ii) Ignore next(records, None) as the file may or may not have the
Header Row.
34. (I) Select * from FACULTY natural join COURSES where Salary<12000;
Or
Select * from FACULTY, COURSES where Salary<12000 and
facuty.f_id=courses.f_id;
(II) Select * from courses where fees between 20000 and 50000;
(III) Update courses set fees=fees+500 where CName like
'%Computer%';
(IV)
(A) Select FName, LName from faculty natural join courses where
Came="System Design"; (4)
Or
Select FName, LName from faculty, courses where Came="System
Design" and facuty.f_id=courses.f_id;

OR

(B) Select * from FACULTY, COURSES;

(4x1 mark for each correct query)


35. def AddAndDisplay():
import mysql.connector as mycon
mydb=mycon.connect(host="localhost",user="root",
passwd="Pencil",database="SUPPLY")
mycur=mydb.cursor()
no=int(input("Enter Item Number: "))
nm=input("Enter Item Name: ")
pr=float(input("Enter price: "))
qty=int(input("Enter qty: "))
query="INSERT INTO EDUCATION VALUES (4)
({},'{}',{},{})"query=query.format(no,nm,pr,qty)
mycur.execute(query)
mydb.commit()
mycur.execute("select * from EDUCATION where
price>150")
for rec in mycur:
print(rec)

Page: 8/11
(½ 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)
(½ mark for correct creation of first query)
(½ mark for correctly executing the first query with commit)
(½ mark for correctly executing the second query)
(½ mark for correctly displaying the data)

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


36. (I) (5)
import pickle

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:

Page: 9/11
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)
37. (I) ADMIN Block as it has maximum number of computers. (5)
(1 mark for correct answer)

(II) In each building to connect computers.


(1 mark for correct answer)

(III)

Page: 10/11
(or Any other correct layout)
Cable: Coaxial cable
(½ mark for correct layout + ½ mark for correct table type)

(IV) There is no requirement of the Repeat as the optical fibre cable used for
the network can carry the data to much longer distances than within the
campus.
(1 mark for correct answer)

(V) (A) a) Video Conferencing


OR
(B) LAN
(1 mark for correct answer)

Page: 11/11
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
MARKING SCHEME
Class: XII Session: 2024-25
Computer Science (083)
Time allowed: 3 Hours Maximum Marks: 70
Q.NO SECTION A (21 X 1=21) MA
RKS
1 False 1
2 (a) ['India is ', 'n the M', ' ', 'n'] 1
3 (a) #THONPROGRAM 1
4 (a) ('Programmingis ', 'My', ' junoon') 1
5 2sm 1
6 (d) print(T1.insert(2,3)) 1
7 (c)print(dict1([“Dhoni”,”Rohit”]) 1
8 (b) The statement 2 will insert the element 1 at index -3 1
9 (c) 3 1
10 (c) a 1
11 (a) The first matching except block encountered from top to bottom 1
12 (a)30 60#10$ 1
13 Alter 1
14 (c)details of all employee whose name second last character is S 1
15 (d) CHAR 1
16 (a)1 1
17 (c) SMTP 1
18 (d)repeater 1
19 (b) Circuit Switching 1
20 (d) A is false but R is True 1
21 (c)A is True but R is False 1
Q No SECTION B (7 X 2 =14) Mar
ks
22 (a)Logical operator-and, or (b) <,>.== ,etc any two correct logical operator ½*4
=2
23 Non default argument must appear before default argument 2
Correct definition : def CalculateInterest(Principal, Time ,Rate=.06,):
1M forcorrect explanation and 1M for correct example
24 (a) (i) lst1.remove(20) (ii) str1.replace("That", "This") 1+1
OR OR
(a) dict1.update(dict2) then dict1.clear() 1+1
25 (a) – Possible output is 30 - 40 -50- 1+1
1 mark for correct minimum value assign to BEGIN and LAST
1 mark for correct output
26 def Prime_Series(low, high): ½
primes = [] mar
for i in range(low, high + 1): k for
flag = 0 each
if i < 2: corr
continue ectio
if i == 2: n=2
primes.append(2)
continue
for x in range(2, i):
if i % x == 0:
flag = 1
break
if flag == 0:
primes.append(i)
return primes
low=int(input("Lower range value: "))
high=int(input("High range value: "))
print(Prime_Series())
27 (I) (a) Primary key (1M) 1Mf
OR or
(b) Not null each
(II) (a)ALTER TABLE emp DROP COLUMN empcontact; (1M) part
OR =(2
(b) ALTER TABLE BSTORE ADD PRIMARY KEY (B_ID); M)
28 1 Mark for any correct difference 2M
OR
VOIP: Voice Over Internet Protocol, SMTP: Simple Mail Transfer Protocol
SLIP: Serial Line Internet Protocol ,TCP/IP: Transmission Control Protocol/Internet Protocol
( ½ Marks each for correct expansion)

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


No. ks
29 (a) 3M

(b)

30 (A) def PUSH(HS, D): 3


for name, salary in D.items():
if salary > 75000:
HS.append(name)
def POP(HS):
if HS:
return HS.pop()
return 'None'
def PEEK(HS):
return HS[-1] if HS else 'None'
OR
OddNumbers = []
def PUSH_ODD(N):
for num in N:
if num % 2 != 0: # Check if the number is odd
OddNumbers.append(num) # Push odd numbers into the stack
def pop_odd():
if OddNumbers: # Check if the stack is not empty
return OddNumbers.pop() # Pop the topmost element
else:
return "Empty" # if stack is empty
def Disp_odd():
if OddNumbers: # Check if the stack is not empty
for num in OddNumbers: # Display each element
print(num, end=' ')
else:
print("STACK IS EMPTY") # If the stack is empty
31 {2: 0, 3: 0, 5: 0, 1: 0} 3
{2: 0, 3: 0, 5: 0, 1: 0}
OR
26 # 2
{0: 0, 2: 4, 4: 8, 13: 15}
Q Section-D ( 4 x4 = 16 Marks) Mar
No. ks
32 (a) 4
(I) SELECT M_name, SUM(M_qty) FROM MSTORE GROUP BY M_name HAVING
SUM(M_qty) >= 3;
(II) SELECT M_company, MAX(M_price), MIN(M_price) FROM MSTORE GROUP BY
M_company;
(III) SELECT M_company, M_name FROM MSTORE WHERE M_price BETWEEN 10000
AND 35000;
(IV) SELECT M_id, M_company FROM MSTORE WHERE M_company not like “_n%”;
OR
(b)OUTPUT OF QUERIES
(I) M_ID M_NAME M_PRICE
MB004 Unite 3 5500
MB006 SelfieEx 20350
(II) Nokia:
 MB003: 12,500 → 13,750
 MB008: 30,000 → 33,000
Oppo:
 MB006: 18,500 → 20,350
(III) M_NAME TOTAL_PRICE
Galaxy 35000
N1100 46750
SelfieEx 20350
Unite 3 30500
(IV) M_COMPANY M_PRICE
Micromax 5500
Nokia 33000
Nokia 13750
Oppo 20350
Samsung 20000
Samsung 15000
Sony 25000

33 (I) 4
def show():
import csv
f=open("Employee.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
for i in records :
if int(i[2])>50000:
print(i)
f.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records)
(II)
import csv
def Count_records():
f=open("Employee.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
count=0
for i in records:
count+=1
print(count)
f.close()
34 (a) 4
(i)Select w_id,firstname,address,city from from workers where city=”newyork”;
(ii)select *from workers order by lastname;
(iii)select firstname,lastname,salary+benefits as “total_salary”from workers,desig where
workers.w_id=desig.w_id and designation=”clerk”;
(iv)select min(salary)from desig group by desig having designation=”managers” or
designation=”clerk”;
(b)
OUTPUT OF NATURAL JOIN
4
import mysql.connector as mycon
def BOOK_ADD_DISP();
mydb=mycon.connect(host="localhost",user="root", passwd="",database="booktore")
mycur=mydb.cursor()
35 no=int(input("Enter Book id: "))
nm=input("Enter Book Name: ")
pr=float(input("Enter Book price: "))
qty=int(input("Enter qty: "))
query="INSERT INTO bookdetails VALUES ({},'{}',{},{})"
query=query.format(no,nm,pr,qty)
mycur.execute(query)
mydb.commit()
mycur.execute("select * from bookdetails where price>450")
for I in mycur:
print(I)

(½ 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)
(½ mark for correct creation of first query)
(½ mark for correctly executing the first query with commit)
(½ mark for correctly executing the second query)
(½ mark for correctly displaying the data)

QUE SECTION E (2 X 5 = 10) Mar


No. ks
36 (I) 5
(II)

(III)

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

37 (i) Block B 1+1


Justification- Block B has maximum number of computers. Reduce traffic. 1+1
+1=5
(ii)one marks for correct layout
(iii) (a) between D and A blocks (b) in all the blocks (1/2 marks for each correct answer)
(iv) WAN
(v) Firewall
12PB24CS04
KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION
PRE-BOARD EXAMINATION
CLASS: XII 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
“Dictionaries in Python are mutable but Strings are immutable.”
True
2 str="R and Data Science" 1
z=str.split()
newstr="=".join([z[2].upper(),z[3],z[2]+z[3],z[1].capitalize()])
newstr is equal to
a) 'DATA=Science=DataScience=And' b) 'DATA=DataScience=And'
c) 'DATA=Science=And' d) 'DATA=Science==DataScience=And'
(a) 'DATA=Science=DataScience=And'
3 Consider the given expression: 1
True and not AAA and not True or True
Which of the following will be correct output if the given expression is evaluated
with AAA as False?
(a) True (b) False (c) NONE (d) NULL
(a) True
4 What shall be the output of the following statement? 1
“TEST”.split(‘T’,1)
(a) [ ‘ ‘, ’ ES ’ ,’ ‘ ] (b) [ ‘T’, ’ ES ’ ,’T’] (c) [ ‘ ‘, ‘ EST ’] (d) Error
(c) [ ' ', 'EST' ]
5 What shall be the output for the execution of the following statement? 1
“ANTARTICA”.strip(‘A’)
(a). NTRCTIC (b). [‘ ‘, ‘NT’, ‘RCTIC’, ‘ ‘] (c). NTARTIC (d). Error
(c) NTARTIC
6 Consider The following: t=(12,13,14,16,[2,3]) 1

1
What changes will be made in t after the execution of the following statement?
t.append(4)
(a) t=(12,13,14,16,[2,3],4) (b) t= (12,13,14,16,[2,3,4])
(c) t=(4,12,13,14,16,12,3) (d) It will give an error
(d) It will give an error
7 What will be the output? 1
test = {1:'A', 2:'B', 3:'C'}
del test[1]
test[1] = 'D'
del test[2]
print(len(test))
(a) 0 (b) 1 (c) 2 (d) Error
8 Predict the output of following code snippet: 1
Lst = [10,20,30,40,50,60,70,80,90]
print(Lst[::3])

[10, 40, 70]


9 Fill in the blanks: 1
------------------command is used to remove attribute from the table in SQL
(i) Update (ii) Remove (iii) Alter (iv) Drop

(iii) Alter
10 Which of the following options is the correct Python statement to read and display 1
the first 10 characters of a text file “poem.txt” ?
(a) F=open(‘poem.txt’) print(F.load(10))
(b) F=open(‘poem.txt’) print(F.reader(10))
(c) F=open(‘poem.txt’) print(F.read(10))
(d) F=open(‘poem.txt’,) print(F.readline(10))
(c) F = open('poem.txt') print(F.read(10))
11 When will the else part of try-except-else be executed? 1
a) always b) when an exception occurs
c) when no exception occurs d) when an exception occurs in to except block
c) when no exception occurs
12 Find and write the output of following python code: 1
a=100
def show():
global a
a=-80 def
invoke(x=5):
global a
a=50+x
show()
invoke(2)

2
invoke()
print(a)

55
13 Fill in the blank: __________command is used for changing value of a column in a 1
table in SQL.
(a) update (b) remove (c) alter (d) drop
(a) update
14 What will be the output of the query? 1
SELECT * FROM products WHERE product_name LIKE 'BABY%';
(a) Details of all products whose names start with 'BABY'
(b) Details of all products whose names end with 'BABY'
(c)Names of all products whose names start with 'BABY'
(d)Names of all products whose names end with 'BABY'
15 To fetch the multiple records from the result set you may use-- method in SQL? 1
a) fetch() b) fetchmany() c) fetchmultiple () d) None of the mentioned
b) fetchmany()
16 Which function is used to display the total no of records from a table in a database? 1
(a) total() (b) total(*) (c) count(*) (d) count()
(c) count(*)
17 Fill in the blank: is a communication medium, classified as long-distance high speed 1
unguided medium.
(a) Optical fiber (b) Microwave (c) Satellite Link (d)WIMAX
(c) Satellite Link

18 A system designed to protect unauthorized access to or from a private network is 1


called-------------.
(a) Password (b) Firewall (c) Access wall (d) Network Security
(b) Firewall
19 Which of the following establishes PAN? 1
(a) Bluetooth (b) WWW (c) Telephone (d) Modem
(a) Bluetooth
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): CSV (Comma Separated Values) is a file format for data storage 1
that looks like a text file.
Reason (R): The information is organized with one record on each line and each
field is separated by a comma.
(A) Both A and R are true and R is the correct explanation for A.
21 Assertion(A). Data conversion is necessary during reading and writing in text file 1
Reasoning.(R) Binary files store data in a binary format, which can be directly

3
read and written without the need the data conversion
(B) Both A and R are true and R is not the correct explanation for A.
Q No Section-B ( 7 x 2=14 Marks) Marks
22 How are list different from dictionaries. Write two points. 2
Access Method: Lists use indices; dictionaries use keys.
Purpose: Lists store ordered collections; dictionaries store data as key-value
pairs for efficient retrieval.
23 Give two examples of each of the following: 2
(I) Membership operators (II) Identity operators
Membership Operators-in , not in
Identity operators-is, is not

24 Given a list L=[10,9,8,7,6] 2


(Answer using builtin functions only)
(I) A) Write a statement to arrange the list in descending order and store it in
another list L1..
L = [10, 9, 8, 7, 6]
L1 = sorted(L, reverse=True)
OR
B) To display the first three elements.
L = [10, 9, 8, 7, 6]
first_three = L[:3]
(II) A) Write a statement to display the total number of elements in the list.
L = [10, 9, 8, 7, 6]
total_elements = len(L)
OR
B) Write a statement to reverse the elements of the list and store it in another list
L1.
L = [10, 9, 8, 7, 6]
L1 = L[::-1]

25 What possible outputs are expected to be displayed on screen at the time of execution 2
of the program from the following code? Select correct options from below.
import random arr=['10','30','40','50','70','90','100']
L=random.randrange(1,3)
U=random.randrange(3,6)
for i in range(L,U+1):
print(arr[i],"$",end="@")
a)30 $@40 $@50 $@70 $@90
b)30 $@40 $@50 $@70 $@90 $@
c) 30 $@40 $@70 $@90 $@
d) 40 $@50 $@
b,d
26 2
Sona has written the following code to check whether the number is divisible by3.

4
She could not run the code successfully. Rewrite the code and underline each
correction done in the code.
x=10
for i range in (a):
if i%3=0:
print(i)
else: pass
x = 10
for i **in** range(x):
if i % 3 **==** 0:
print(i)
else:
pass
27 (I) A) Differentiate ORDER BY and GROUP BY with an example. 2
The ORDER BY clause is used to sort the result set (the rows returned by a
query) in either ascending (ASC) or descending (DESC) order based on one or
more columns.
The GROUP BY clause is used to group rows that have the same values in
specified columns. It is typically used with aggregate functions like COUNT(),
SUM(), AVG(), etc., to perform operations on each group of rows.
OR
B) Classify the following statements into DDL and DML a)delete b)drop table
c)update d)create table
DDL Commands: DROP TABLE, CREATE TABLE (altering the structure of
database objects).
DML Commands: DELETE, UPDATE (modifying the data within tables)
(II)
A) What do you understand by VARCHAR datatype in a table? Give a suitable
example and differentiate the same with the data type CHAR.
VARCHAR is more flexible and space-efficient for variable-length data, while
CHAR is best suited for fixed-length data where space usage consistency is
important.
OR
B) Categorize the following commands as Group by /Math function: count(),
pow(), round(), avg()
Group by Functions: COUNT(), AVG()
Math Functions: POW(), ROUND()

5
28 A) Expand the following terms: i)MAN ii)HTML 2
MAN: Metropolitan Area Network
HTML: HyperText Markup Language
OR
B) What is URL ?
A URL (Uniform Resource Locator) is the address used to access resources on
the internet. It specifies the location of a web resource (like a webpage, an image,
or a file) and the method to retrieve it. URLs are used by browsers to find and
display the requested resources.
Q No. Section-C ( 3 x 3 = 9 Marks) Marks
29 A) Write a function linecount() in python which read a file ‘data.txt’ and count 3
number of lines starts with character ‘P’.
def linecount():
count = 0
open('data.txt', 'r')
for line in file:
if line.startswith('P'):
count += 1
return count
OR
B) Write a function in python to count number of words ending with ‘n present in a
text file “ABC.txt” If ABC.txt contains “A story of a rich man And his son”, the
output of the function should be Count of words ending with ‘n’ is 2

def count_words_ending_with_n(file_name):
# Open the file in read mode
with open(file_name, 'r') as file:
content = file.read() # Read the content of the file
# Split the content into words
words = content.split()
# Count words that end with 'n' (case insensitive)
count=0
for word in words
if word.lower().endswith('n'))
count=count+1
print(f"Count of words ending with 'n' is “,count)

30 A) A list, items contain the following record as list elements [itemno, itemname, 3
stock]. Each of these records are nested to form a nested list.
Write the following user defined functions to perform the following on a stack
reorder .
i. Push(items)- it takes the nested list as its argument and pushes a list object
containing itemno and itemname where stock is less than 10

6
ii. Popitems() -It pops the objects one by one from the stack reorder and also
displays a message ‘Stack empty’ at the end.
items=[[101,'abc',8],[102,'gg',12],[103,'tt',5],[104,'yy',15]]
reorder=[]
def Push(items):
for i in items:
if i[2]<10:
reorder.append([i[0],i[1]])
Push(items)
reorder [[101, 'abc'], [103, 'tt']]
def Popitems():
while len(reorder):
print(reorder.pop())
else:
print("Stack empty")
Popitems()
OR
(B) Write a function RShift(Arr) in Python, which accepts a list Arr of numbers and
places all even elements of the list shifted to left.
Sample Input Data of the list Arr= [10,21,30,45,12,11],
Output Arr = [10, 30, 12, 21, 45, 11]
def RShift(Arr):
# Separate even and odd elements
even_elements = [num for num in Arr if num % 2 == 0]
odd_elements = [num for num in Arr if num % 2 != 0]
# Combine even elements followed by odd elements
Arr[:] = even_elements + odd_elements
return Arr

31 Predict the output of the following code: 3

d = {"apple": 15, "banana": 7, "cherry": 9}

str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]
print(str2)

15@
7@

7
9@

OR

Predict the output of the following code:


mylist = [2,14,54,22,17]
tup = tuple(mylist)
for i in tup:
print(i%3, end=",")

2,2,0,1,2,

Q No. Section-D ( 4 x 4 = 16 Marks) Marks


32 Consider the table EMPLOYEE as given below 4
pid surname firstname gender city pincode basicsalary

1 Sharma Geeta F Udhamwara 182141 50000

2 Singh Surinder M Kupwara 193222 75000


Nagar

3 Jacob Peter M Bhawani 185155 45000

4 Alvis Thomas M Ahmed 380025 50000


Nagar

5 Mohan Garima M Nagar 390026 33000


Coolangetta

6 Azmi Simi F NewDelhi 110021 40000

7 Kaur Manpreet F Udhamwara 182141 42000


A) Write the SQL Queries for (i) to (iv) based on ITEMS table
(i) Display the SurNames, FirstNames and Cities of people residing in Udhamwara
city.
SELECT SurName, FirstName, City FROM ITEMS WHERE City =
'Udhamwara';
(ii) Display the Person Ids (PID), cities and Pincodes of persons in descending
order of Pincodes.
SELECT PID, City, Pincode FROM ITEMS ORDER BY Pincode DESC;
(iii) Display the First Names and cities of all the females getting Basic salaries
above 40000.
SELECT FirstName, City FROM ITEMS WHERE Gender = 'Female' AND
BasicSalary > 40000;
(iv) Display the highest Basic Salary among all male staff.
SELECT MAX(BasicSalary) AS HighestSalary FROM ITEMS

8
WHERE Gender = 'Male';
OR
B) Write the output
(I) Select city, sum(basicsalary) as Salary from EMPLOYEE group by city;
city Salary
------------------------------------
Udhamwara 92000
Kupwara Nagar 75000
Bhawani 45000
Ahmed Nagar 50000
Nagar Coolangetta 33000
NewDelhi 40000

(II) Select * from EMPLOYEE where surname like '%Sharma%';


pid surname firstname gender city pincode basicsalary

1 Sharma Geeta F Udhamwara 182141 50000

(III) Select surname,firstname,city from EMPLOYEE where basicsalary between


47000 and 55000;
Surname firstname city
--------------------------------------------------
Sharma Geeta Udhamwara
Alvis Thomas Ahmed Nagar

(IV) Select max(basicsalary) from EMPLOYEE;

max(basicsalary)
----------------------
75000

33 A csv file "furdata.csv" contains the details of furniture. Each record of the file 4
contains the following data:
● Furniture id
● Name of the furniture
● Price of furniture
For example, a sample record of the file may be:
[‘T2340’, ‘Table’, 25000]
Write the following Python functions to perform the specified operations on this

9
file:
a. add() – To accept and add data of a furniture to a CSV file furdata.csv. Each
record consists of a list with field elements as fid, fname, fprice to store furniture
id, furniture name and furniture price respectively
b. search() – To display the records of the furniture whose price is more than
10000.
import csv
# Function to add furniture data to the CSV file
def add():
with open('furdata.csv', 'a', newline='') as file:
writer = csv.writer(file)
fid = input("Enter Furniture ID: ")
fname = input("Enter Furniture Name: ")
fprice = float(input("Enter Furniture Price: "))
record = [fid, fname, fprice]
writer.writerow(record)
print("Furniture record added successfully!")

# Function to search and display furniture with price more than 10000
def search():
with open('furdata.csv', 'r') as file:
reader = csv.reader(file)

print("\nFurniture with price greater than 10000:")


found = False
for row in reader:
if float(row[2]) > 10000:
print(f"Furniture ID: {row[0]}, Name: {row[1]}, Price: {row[2]}")
found = True
if not found:
print("No furniture found with price greater than 10000.")

34 Write the output of the SQL commands for (i) to (iv) on the basis of 4
tables BOOKS and ISSUES.
Table: BOOKS
Book_id BookName AuthorName Publisher Price Qty

L01 Maths Raman ABC 70 20

L02 Science Agarkar DEF 90 15

L03 Social Suresh XYZ 85 30

L04 Computer Sumita ABC 75 7

10
L05 Telugu Nannayya DEF 60 25

L06 English Wordsworth DEF 55 12


Table: ISSUES
Book_id Qty_issued

L02 13

L04 5

L05 21

(I) To display complete details (from both the tables) of those Books whose quantity
issued is more than 5.
Select * from BOOKS, ISSUES where Qty>5 and
BOOKS.Book_id=ISSUES.Book_id;
(II) To display the details of books whose quantity is in the range of 20 to 50 (both
values included).
Select * from BOOKS where Qty between 20 and 50;
(III) To increase the price of all books by 50 which have "DEF” in their PUBLISHER
names.
Update BOOKS set Price=Price+50 where Publisher like '%DEF%';
(IV) (A) To display names (BookName and AuthorName) of all books.
Select BookName, AuthorName from BOOKS;
OR
(B) To display the Cartesian Product of these two tables.
Select * from BOOKS, ISSUES;
35 A table, named STUDENT, in SCHOOL database, has the following structure: 4

Field Type

Rollno integer

Name string

Clas integer

Mark integer

Write the following Python function to perform the specified operation:


AddStudent(): To input details of a student and store it in the table STUDENT.
The function should then retrieve and display all records from the STUDENT
table where the Mark is greater than 80.

Assume the following for Python-Database connectivity:


Host: localhost, User: root, Password:root

11
import mysql.connector
def AddStudent():
mydb = mysql.connector.connect(host="localhost",user="root",
password="root",database="SCHOOL")
cursor = mydb.cursor()
rollno = int(input("Enter Roll No: "))
name = input("Enter Name: ")
clas = int(input("Enter Class: "))
mark = int(input("Enter Mark: "))
query = "INSERT INTO STUDENT (Rollno, Name, Clas, Mark) VALUES
(%s, %s, %s, %s)"
values = (rollno, name, clas, mark)
cursor.execute(query, values)
mydb.commit()
print("Student record added successfully!")
# Retrieve and display all records where Mark is greater than 80
cursor.execute("SELECT * FROM STUDENT WHERE Mark > 80")
results = cursor.fetchall()
# Display the results
if results:
print("\nStudents with marks greater than 80:")
for row in results:
print(f"Rollno: {row[0]}, Name: {row[1]}, Class: {row[2]}, Mark:
{row[3]}")
else:
print("No students found with marks greater than 80.")

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


36 Riya is a student of class 12.Her teacher assigned a task to Riya to create a Binary 5
file named ‘Book.dat’ to store the details of books available in the department. The
structure of “Book.dat” is
[BookNo,Book_Name,Author,Price]
For maintaining all records of books,Riya wants to write the following user defined
functions:
I) createFile() - to input data for a record and add to the binary file ‘Book.dat’.
(II) CountRec(Author)- to accept the Author name as parameter and count and
return the number of books by the given Author stored in the binary file
“Book.dat”.
(III) displayAbove() to read the data from the binary file and display the data of all
those books whose price is above 1000.
As a Python expert, help her to achieve this task.
import pickle
# Function to create the binary file and add book records
def createFile():
with open('Book.dat', 'ab') as file:
while True:
book_no = int(input("Enter Book Number: "))

12
book_name = input("Enter Book Name: ")
author = input("Enter Author Name: ")
price = float(input("Enter Price: "))
book_record = [book_no, book_name, author, price]
pickle.dump(book_record, file)
cont = input("Do you want to add another record? (yes/no): ").lower()
if cont != 'yes':
break

# Function to count the number of books by a given author


def CountRec(author):
count = 0
with open('Book.dat', 'rb') as file:
while True:
book_record = pickle.load(file)
if book_record[2].lower() == author.lower():
count += 1
break
print("The file does not exist.")
return count

# Function to display books with price above 1000


def displayAbove():
with open('Book.dat', 'rb') as file:
print("Books with price above 1000:")
found = False
while True:
book_record = pickle.load(file)
if book_record[3] > 1000:
print(book_record)
found = True
break
if not found:
print("No books found with price above 1000.")

37 Vidya for all is an NGO. It is setting up its new campus at Jaipur for its web-based 5
activities. The campus has four buildings as shown in the diagram below

Centre to centre distance between various buildings as per architectural drawings


(in Mtrs.) is as follows:

Main building to Resource building 120m

Main building to Training building 40m

Main building to Accounts building 135m

13
Resource building to Training building 125m

Resource building to Accounts building 45m

Training building to Accounts building 110m

Number of computers in each building are as follows:


Main building 15

Resource building 25

Training building 250

Training building 10

(I) Suggest a cable layout of connection among the buildings.


(II) Suggest the most suitable place to house the server for this NGO. Also provide a
suitable reason for your suggestion.
(III) Suggest the placement of the following devices with justification:
(a) Repeater (b)Hub/Switch
(IV) Write any one advantage of bus topology
(V) A) Expand MODEM
OR
B) Expand WLL
I)

Main Finance

Resource Training

II)Training building-maximum no. of computers


III)a)Repeater-can be placed between the buildings where distance is more
than100m
b) hub- in all the buildings
IV)It is easy to connect or remove devices in this network without affecting
any other devices.
V)MODEM Modulator-Demodulator
OR
WLL-Wireless in Local Loop

14
*************************************

15
केन्द्रीय विद्यालय सं गठन, कोलकाता सं भाग
KENDRIYA VIDYALAYA SANGATHAN, KOLKATA REGION
प्रथम प्री-बोर्ड परीक्षा / 1st PRE-BOARD EXAMINATION- 2024-25
कक्षा /CLASS- XII अविकतम अं क /MAX MARKS- 70
विषय /SUB- Computer Science (083) समय /TIME- 03 घं टे / Hours
MARKING SCHEME
Q No. SECTION A (21X1=21) Marks
1. True (1 mark for correct answer) (1)
2. (D) copy#THON (1 mark for correct answer) (1)
3. ( C) 5.0 (1 mark for correct answer) (1)
4. (B) ['', 'nsp', 'rat', 'onal ', 'dea'] (1 mark for correct answer) (1)
5. (A) Aabtsi (1 mark for correct answer) (1)
6. (B) False (1 mark for correct answer) (1)
7. (B) print(my_dict['apple', 'banana']) (1 mark for correct answer) (1)
8. (A) cursor.rowcount (1 mark for correct answer) (1)
9. (C) 3 (1 mark for correct answer) (1)

10. file.seek(0) ( OR file.seek(0,0) ) (1 mark for correct answer) (1)


11. True (1 mark for correct answer) (1)
12. (C) 12#15% (1 mark for correct answer) (1)
13. (B) Count(*) (1 mark for correct answer) (1)
14. (A) Details of all products whose names start with 'App' (1 mark for correct answer) (1)
15. (D) CHAR (1 mark for correct answer) (1)
16. (B) count() (1 mark for correct answer) (1)
17. (C) FTP (1 mark for correct answer) (1)
18. (A) Repeater (1 mark for correct answer) (1)
19. (B) Circuit Switching (1 mark for correct answer) (1)
20. (C) A is True but R is False. (1 mark for correct answer) (1)

21. (C) A is True but R is False. (1 mark for correct answer) (1)

Q No. SECTION B (7 X 2 =14) Marks


22. A mutable object can be updated whereas an immutable object cannot be
updated. (1 mark for correct difference)
The pop() function removes the last element or the element based on the index
(2)
given. remove() function removes the first occurrence of the specified element.

23. i) - (subtraction operator)

ii) John#Peter#Vicky (2)

(1 x 2= 2 Marks for each correct answer)


Page: 1/10
24. (I)
A) L1.count(4)
OR
(2)
B) L1.sort()
(1 mark for correct answer)
(II)
A) L1.extend(L2)
OR
B) L2.reverse()
(1 mark for correct answer)
25. (B), (C)
(½ x 2 = 1 Mark) (2)
Minimum and maximum possible values of the variable x: 1,3
(½ x 2 = 1 Mark)
26. def Prime_Series(low, high) #CORRECTION 1
primes = [ ]
for i in range(low, high + 1):
flag = 0
if i < 2:
continue
if i == 2: (2)
primes.append(2)
continue
for x in range(2, i):
if i % x == 0:
flag = 1
break #CORRECTION 2
if flag == 0:
primes.append(x)
return primes #CORRECTION 3
low=int(input("Lower range value: "))
high=int(input("High range value: ")
print(Prime_Series(low,high)) #CORRECTION 4

½ marks for each correction (Corrections are marked bold and underlined)

Page: 2/10
27. (I)
A) UNIQUE
OR
B) NOT NULL
(1 mark for correct answer) (2)

(II)
A) ALTER TABLE MOBILE DROP PRIMARY KEY;
OR
B) ALTER TABLE MOBILE ADD PRIMARY KEY (M_ID);
(1 mark for correct answer)
28. (2)
Any correct difference. (1 mark for each correct difference)

OR
B) TCP/IP: Transmission Control Protocol / Internet Protocol
(1 mark for correct expansion)
A Gateway serves as a point of entry and exit for network traffic between two
networks and can provide security like a firewall from any attack on the network.

(1 mark for any correct usage/significance)

Page: 3/10
Q No. SECTION C (3 X 3 = 9) Marks
29. (A)

def show():
f=open("Email.txt",'r')
data=f.read()
words=data.split() for
word in words:
if '@gov' in word:
print(word,end=' ')
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)
(1 mark for correctly displaying the desired words)
OR (3)
(B)
def display_long_words():
with open("Friends.txt", 'r') as file:
data=file.read()
words=data.split()
for word in words:
if len(word)<6:
print(word,end=' ')
(½ 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)
(1 mark for correctly displaying the desired words)

30. (A) (3)


(I)
def push_book(BooksStack, new_book):
BooksStack.append(new_book)
(II)
def pop_book(BooksStack):if
not BooksStack:
print("Underflow")
else:
return(BookStack.pop())

Page: 4/10
(III)
def peep(BooksStack):if
not BooksStack:
print("None")
else:
print(BookStack[-1])
(3x1 mark for correct function body; No marks for any function header as itwas a
part of the question)
OR
(B)
def Push_Bright(StudRec):
admno=StudRec.keys()
tot=0
for k in admno:
tot=sum(StudRec[k])
if tot>350:
BRIGHT.append({k:tot})
print(BRIGHT)
return
def Pop_Bright():
if BRIGHT==[]:
print("Stack is Empty")
for k in range(len(BRIGHT)-1, -1, -1):
print(BRIGHT.pop())
"""
else:
print("Stack is Empty")
"""
return
#__main___
StudRec={101:[80,90,80,70,90], 102:[50,60,45,50,40], 103:[90,90,99,98,90]}
BRIGHT=[]
Push_Bright(StudRec)
Pop_Bright()

(1/2 for defining the function)


(1/2 for giving correct condition)
(1/2 mark for correctly adding data to stack)
(1/2 mark for correctly popping data on the stack)
(1/2 mark for correctly displaying the data with none)
(1/2 mark for function call statements)

Page: 5/10
31. (A) 15@
7@
9

OR
(B) 1 #2 # 3# (3)

1 #2 #3 #
1#

(1 mark for each correct line of output)


(deduct ½ mark for not printing @/#)

Q No. SECTION D (4 X 4 = 16) Marks


32. (A)
(I) select Product, sum(Quantity) from orders group by product
having sum(Quantity)>=5;
(II) select * from orders order by Price desc;
(III) select distinct C_Name from orders;
(IV) select sum(price) as total_price from orders where Quantity IS NULL;
(4 x 1 mark for each correct query)
OR
(B) (4)
(I)
C_Name | Total_Quantity
|
Jitendra |1
Mustafa |2
Dhwani |1

(II)

O_Id | C_Name | Product | Quantity | Price


| | | |
1002 | Mustafa | Smartphone | 2 | 10000
1003 | Dhwani | Headphone | 1 | 1500

(III) O_Id | C_Name | Product | Quantity | Price


| | | |
1001 | Jitendra | Laptop |1 | 12000
1002 | Mustafa | Smartphone |2 | 10000
1003 | Dhwani | Headphone |1 | 1500

(IV)
MAX(Price)
12000
(4 x 1 mark for each correct output)

Page: 6/10
33. import csv
def AcceptStock():
(4)
fob=open("stock.csv",'a',newline='')
wob=csv.writer(fob)
headings=["Stock No.", "Name of the Stock", "Stock Price", "Quantity"]
wob.writerow(headings)
ch='y'
while ch.upper()=='Y':
stockno=int(input("Enter the Stock No. "))
sname=input("Enter the stock name: ")
price=float(input("Enter the stock price: "))
qty=int(input("Enter the stock quantity: "))
data=[stockno,sname,price,qty]
wob.writerow(data)
ch=input("Have you any more records to enter(y/n): ")
fob.close()
return
def StockReport():
fob=open('stock.csv','r')
rob=csv.reader(fob,delimiter=',')
data=list(rob)
print(data[0]) # to be used as header

print("STOCK REPORT ")


print("*"*80)
for rec in data[1::]: # rec[0] is be the header
print("Stock No: ", rec[0])
print("Stock Name: ", rec[1])
print("Stock Price: ", rec[2])
print("Stock Quantity: ", rec[3])
print("Stock Total Price: ", float(rec[2])*int(rec[3]))
print("*"*80)
fob.close()
AcceptStock()
StockReport()

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


(½ mark for correctly creating the reader object)(½

Page: 7/10
mark for correct use of counter)
(½ mark for correctly displaying the counter)
Note (for both parts (I) and (II)):
(i) Ignore import csv as it may be considered the part of the complete program,
and there is no need to import it in individualfunctions.
(ii) Ignore next(records, None) as the file may or may not have the Header Row.

34. (i) SELECT SNAME, QTY, PRICE, STOCK.TCODE, TNAME FROM STOCK NATURAL JOIN
TRADERS ;
(or any alternative query)
(ii) SELECT * FROM STOCK WHERE PRICE BETWEEN 35000 AND 50000;
(iii) SELECT SCODE, SNAME, QTY*PRICE as ‘TOTAL PRICE’ FROM STOCK
WHERE BRAND=’NEC’ OR BRAND=’HP’ ORDER BY QTY*PRICE ASC;
(iv) SELECT STOCK.TCODE, TNAME, CITY, SUM(QTY) FROM STOCK JOIN TRADERS
ON STOCK.TCODE=TRADERS.TCODE GROUP BY TCODE; (4)

(1 mark for each correct query. ½ mark if the query is right partially)

35. def AddAndDisplay():


import mysql.connector as mycon
mydb=mycon.connect(host="localhost",user="root",
passwd="Pencil",database="ITEMDB")mycur=mydb.cursor()
no=int(input("Enter Item Number: "))
nm=input("Enter Item Name: ")
pr=float(input("Enter price: "))
qty=int(input("Enter qty: "))
query="INSERT INTO stationery VALUES ({},'{}',{},{})" (4)
query=query.format(no,nm,pr,qty)
mycur.execute(query)
mydb.commit()
mycur.execute("select * from stationery where price>120")
for rec in mycur:
print(rec)

(½ 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) (½ mark for correct creation of first query)
(½ mark for correctly executing the first query with commit)(½ mark for correctly
executing the second query)
(½ mark for correctly displaying the data)

Page: 8/10
Q No. SECTION E (2 X 5 = 10) Marks

36. (a) Any one point of difference (1 mark for the difference) (5)
import pickle
def AddStudents():
F= open("STUDENT.DAT",'wb')
while True:
Rno = int(input("Rno :"))
Name = input("Name : ")
Percent = float(input("Percent :"))
L = [Rno, Name, Percent]
pickle.dump(L,F)
Choice = input("enter more (y/n): ")
if Choice in "nN":
break
F.close()
def GetStudents():
Total=0
Countrec=0
Countabove75=0
with open("STUDENT.DAT","rb") as F:
while True:
try:
R = pickle.load(F)
Countrec+=1
Total+=R[2]
if R[2] > 75:
print(R[1], " has percent =",R[2])
Countabove75+=1
except:
if Countabove75==0:
print("No student has percentage more than 75")
print("average percent of class = ", Total / Countabove75)
AddStudents()
GetStudents()

Page: 9/10
37. i) Development because it contains more number of computers (
ii) Surajpur centre has multiple blocks and firewall ensures security. So it is required. 5
It allows or block unwanted attacks. )
Firewall prevents unauthorized access to or from a private network. (Any correct answer)
iii)

iv) a) Switch/Hub – In every block to interconnect the devices within every block
b) Router -In development block because server is going to be placed here
v) (A) Satellite
OR
(B) LAN

(1 mark for each correct answer)

Page: 10/10

You might also like