MS CS Agra PB1 2024-25
MS CS Agra PB1 2024-25
MARKING SCHEME
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.
1. False (1)
3. (D)True (1)
PAGE NO. 1 OF 11
(1 mark for correct answer)
5. (A) () (1)
(1 mark for correct answer)
14. (C) Display name of students whose name has ‘ar’ anywhere in name. (1)
(1 mark for correct answer)
PAGE NO. 2 OF 11
18. (D) REPEATER (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)
22. “in” operator results in True/False after checking a value in a range of (2)
values. (1 mark for correct answer)
“ONE” & [1,2,3] (1/2 mark for each correct answer)
PAGE NO. 3 OF 11
elif Y<10:
for m in range(5,0,-1):
print(“thank you”)
(1/2 mark for each correct answer)
29. (3)
PAGE NO. 4 OF 11
(1/2 mark for correct opening of file)
(1/2 mark for correctly reading from the file)
(1 mark for any correct logic & it’s code)
(1/2 mark for printing correct output)
OR
(II)
def Pop_Emp(Emp_Stack):
if not Emp_Stack:
print("Underflow")
else:
return(Emp_Stack.pop())
(III)
def Peep(Emp_Stack):
if not Emp_Stack:
print("None")
else:
PAGE NO. 5 OF 11
print(Emp_Stack[-1])
(3x1 mark for correct function body; No marks for any function header as it
was a part of the question)
OR
(B)
(I)
def Push_State(D_STATE):
for I in D_STATE:
if len(D_STATE[I])<10:
STATE.append(D_STATE[I])
(II)
def Pop_State():
if not STATE:
print("Empty")
else:
return(STATE.pop())
(III)
def Disp_State():
if not STATE:
print("None")
else:
print(STATE [-1:-len(STATE)-1:-1])
(3x1 mark for correct function body; No marks for any function header as it
was a part of the question)
PAGE NO. 6 OF 11
OUTPUT : (22,44,66)
(3 marks for correct line of output)
(deduct ½ mark for not printing parentheses/comma)
Q. No. Section-D ( 4 x 4 = 16 Marks) Marks
PAGE NO. 7 OF 11
for i in records:
if int(i[2])>200000:
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_City():
f=open("Population.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. Write SQL commands for the following queries (i) to (iv) based on the (4)
relations TRAINER & COURSE given below:
PAGE NO. 8 OF 11
I. SELECT * FROM TRAINER WHERE CITY IS ”CHENNAI”;
II. SELECT CITY, COUNT(*) FROM TRAINER GROUP BY CITY;
III. SELECT * FROM COURSE WHERE FEES > 12000 AND
CNAME LIKE “%A”;
IV. (A) SELECT T.TNAME, C.CNAME FROM TRAINER T,
COURSE T WHERE T.TID=C.TID AND C.FEES<10000;
OR
(B) SELECT * FROM TRAINER, COURSE;
(4X1 mark each for correct QUERY)
PAGE NO. 9 OF 11
(½ mark for correctly displaying the data)
Q. No. SECTION E (2 X 5 = 10 Marks) Marks
F=open(“TEST.DAT”,”ab”)
pickle.dump(REC, F)
F.close()
(II)
import pickle
def UpdateMM(Sub):
file=open(“TEST.DAT”,”rb”)
while True:
try:
rec = pickle.load(file)
if rec[1] == Sub:
rec[2]+=10
file.seek(-len(rec))
pickle.dump(rec, file)
print(“Max. Marks updated”)
except EOFError:
break # End of file reached
(III)
import pickle
def DisplayAvgMarks(Sub):
PAGE NO. 10 OF 11
sum=count=0
try:
with open('TEST.DAT', 'rb') as file:
while True:
try:
rec = pickle.load(file)
if rec[1] == Sub: # Check the subject
sum+=rec[3]
count+=1
except EOFError:
print(“Average marks of “, Sub, “ are : “, sum/count)
break # End of file reached
except FileNotFoundError:
print("No Test data found. Please add Test data first.")
***************
PAGE NO. 11 OF 11