12 CS 2023-24 QP PB Doe1 MS
12 CS 2023-24 QP PB Doe1 MS
of pages - 12 (M)
MARKING SCHEME
PRE-BOARD EXAMINATION (2023-24)
CLASS : XII
SUBJECT: COMPUTER SCIENCE (083)
Time Allowed : 3 hours Maximum Marks : 70
1 XII-COMPUTER SC.-M
8 False 1 mark for 1
correct
answer
10 a . ‘r+’ opens a file for both reading and writing. 1 mark for 1
correct
answer
14 d. 64 1 mark for 1
correct
answer
17 a. Both A and R are true and R is the correct explanation 1 mark for 1
for A. correct
answer
2 XII-COMPUTER SC.-M
19 (i) ½+½+1 2
a. Transmission Control Protocol/Internet protocol
b. Voice over Internet Protocol
ii. Easy to diagnose the fault, if one link fails, network
can still function
easy to install
OR OR
a. Web browser is a software used to access websites. ½+½+1
b. Web server is a www server that responds to the
requests made by web browser.
b.)) Domain name: edustud.nic.in
URL: https://edustud.nic.in/edu/Academic.html
3 XII-COMPUTER SC.-M
OR
def Count():
f=open('chapter.txt','r')
X = f.read()
count = 0
words = X.split()
for i in words:
count += 1
print('total words are: ',count)
f.close()
Count()
22 51.0 ½+½+½+ 2
32.0 ½
13.0
24.0
23 a. random.randint(100,500) 1+1 2
b. L.sort(reverse=True)
OR OR
a. random.randrange(0,10) OR random.randint(0,9)
b. len(str1) 1+1
24 a. 1+1 2
CREATE TABLE CITY ( OR
CITYNAME VARCHAR(20) UNIQUE, 1+1
CITYCODE INTEGER PRIMARY KEY,
TEMPERATURE FLOAT(6,2),
POPULATION INTEGER,
STATE VARCHAR(20) NOT NULL
);
4 XII-COMPUTER SC.-M
OR
a. Natural join is performed when the two table have
one column exactly name. While equi join can be
performed even when there is no matching column
name.
b. DDL- DROP TABLE, ALTER
DML- INSERT INTO, UPDATE
27 a. 2021-07-19 1+1+1 3
b.
FID NAME DATEOFPUR COST DISCOU
CHASE NT
T006 Console 2019-11-17 15000 12
Table
c. DATEOFPURCHASE
2019-11-17
2020-03-10
5 XII-COMPUTER SC.-M
28 def TCount(): 3
f=open('Story.txt','r') # ½ mark
X = f.readlines() #1 mark
count = 0
for w in X: # ½ mark
if w[0] in 'Tt': # ½ mark
count += 1
print("Total lines starting with T are: ",count) #½ mark
f.close()
TCount()
OR
def my_count():
f=open('Para.txt','r') # ½ mark
X = f.read() #1 mark
Y = X. split() # ½ mark
count = 0
for w in Y: # ½ mark
if w.lower() =='my':
count += 1
print('my occurs:',count,'times') # ½ mark
f.close()
my_count()
6 XII-COMPUTER SC.-M
30 employee_data = {'E001': 15000, 'E002': 27000, 'E003': 3 Marks for 3
30000, 'E004': 15000, 'E005': 19000 Correct
} Program.
stk_emp = []
Partial marks
def push_emp(): to be awarded
for emp_code, salary in employee_data.items(): in case of
if salary < 25000: partially
stk_emp.append(emp_code) correct
program
def pop_emp():
while len(stk_emp)>0:
print(stk_emp.pop())
if not stk_emp:
print("Stack is empty")
push_emp()
pop_emp()
7 XII-COMPUTER SC.-M
32 import pickle 2 Marks for 4
def write_student_data(): each function
f=open("student.dat","wb")
students = []
while True:
rno=int(input("Enter roll no: "))
name=input("Enter your name: ")
marks=int(input("Enter your marks: "))
data=[rno,name,marks]
students.append(data)
ch=input("Do you want to enter more records:(y/n): ")
if ch.lower() == "n":
break
pickle.dump(students,f)
f.close()
def display_students():
f=open("student.dat","rb")
s=pickle.load(f)
print("Students scored less than 33 are:")
for i in s:
if i[2]<=33:
print(i[1])
f.close()
write_student_data()
print("Data entered is as below:")
display_students()
8 XII-COMPUTER SC.-M
33 a. 1+1+1+1+1 5
i. LAN
ii. WAN
b. Switch/Hub
c.
34 i. 2+3 5
Pickling--Python object converted into a byte stream, and
“unpickling” is the reverse operation.
ii.
import pickle
def copyProducts():
count = 0
source_file = open("PRODUCTS.DAT", "rb")
dest_file = open("ELECTRONICS.DAT", "wb")
while True:
try:
record = pickle.load(source_file)
if record[1].lower() == "electronics":
9 XII-COMPUTER SC.-M
pickle.dump(record, dest_file)
count += 1
except EOFError:
break
return count
dest_file.close()
source_file.close()
copyProducts()
OR
(i) OR
It frees up system resources that are being used by the
file. If we do not close a file, there is a risk of data loss. 2+3
(ii)
import pickle
def findBooks(category):
try:
file = open("LIBRARY.DAT", "rb")
library_data = pickle.load(file)
found_books = []
10 XII-COMPUTER SC.-M
35 LINE 1: mysql.connector 1+1+1+1+1 5
LINE 2: mydata.connect
LINE 3: cursor()
LINE 4: fetchall()
LINE 5: rowcount
OR OR
LINE 1: mysql.connector
LINE 2: mydata.connect
LINE 3: cursor() 1+1+1+1+1
LINE 4: mycur.execute(qry)
LINE 5: mycon.commit()
11 XII-COMPUTER SC.-M