0% found this document useful (0 votes)
190 views

Class 12th CS Marking Scheme

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
190 views

Class 12th CS Marking Scheme

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

KENDRIYA VIDYALAYA SANGATHAN CHANDIGARH REGION

PRE-BOARD -II EXAMINATION - 2024-25


MARKING SCHEME
Class: XII Max Marks:70
Subject: COMPUTER SCIENCE (083) Time: 03:00 Hrs

Q. QUESTIONS marks
no
1 State True or False : 1
“In Python, tuple is a mutable data type”.
Answer: FALSE
2 Select the correct output of the code : 1
S = "text#next"
print(S.strip("t"))
(A) ext#nex
(B) ex#nex
(C) text#nex
(D) ext#next

ANS: (A) ext#nex


3 What will be the output : 1
print(16*5/4*2/5-8)
a) -3.33
b) 6.0
c) 0.0
d) -13

ANS: C) 0.0

4 Select the correct output of the code : 1


S="Amrit Mahotsav @ 75"
A=S.split(" ",2)
print(A)
(a) ('Amrit', 'Mahotsav', '@', '75')
(b) ['Amrit', 'Mahotsav', '@ 75']
(c) ('Amrit', 'Mahotsav', '@ 75')
(d) ['Amrit', 'Mahotsav', '@', '75']

ANS: d) ['Amrit', 'Mahotsav', '@ 75']


5 Find the output: 1
A=”MISSISSIPPI”
print(A[:4]+’#’+A[-5:-1])
a) MISSI#SIPPI
b) MISS#SIPP
c) MISS#IPPIS
d) MISSI#PPIS

ANS: b) MISS#SIPP
6 What will be the output of the following code ? 1
Tuple1=(10,)
Tuple2=Tuple1*2
print(Tuple2)
a) 20
b) (20,)
c) (10,10)
d) Error

ANS: c) (10,10)

7 What will be output of the following code: 1


d1={1:2,3:4,5:6}
d2=d1.get(3)
print(d2)
a) 4
b) 3
c) 5
d) 6

ANS: a) 4
8 Select the output of the code: 1
s = “Bring it on”
l = s.split()
s_new = “#”.join([l[0].lower(), l[1], l[2].title()])
print(s_new)
a) bring#it#ON b) bring#it#on
c) Bring#it#On d) bring#it#On

ANS: d) bring#it#On
9 If a table which has one Primary key and two candidate keys. How many Alternate keys will this 1
table have?
(A) 1
(B) 2
(C) 3
(D) 4
ANS: A)1
10 Which of the following modes in Python creates a new file, if file does not exist and overwrites 1
the content, if the file exists ?
(a) r+
(b) r
(c) w
(d) a
ANS: c) w
11 State whether the following statement is True or False: 1
While handling exceptions in python name of the exception has to be compulsorily added with
except clause
ANS: false
12 What will be the output of the following code? 1
c = 10
def add():
global c
c=c+5
print(c,end='#')
add()
c=12
print(c,end='%')
(A) 15%12#
(B) 15%12#
(C) 15#12%
(D) 12%15#

ANS: (C) 15#12%

13 ____________ is used in pattern matching with ( % , _) in where clause to put condition 1

ANS: like
14 Fill in the blank : _________ statement of SQL is used to insert new records in a table. 1
(a) ALTER
(b) UPDATE
(c) INSERT
(d) CREATE
ANS: c) insert

15 In which datatype the value stored is not padded with spaces to fit the specified length, instead it 1
only take up the space they need to store the data.
(A) DATE
(B) VARCHAR
(C) FLOAT
(D) CHAR
ANS: (B) VARCHAR

16 Which aggregate function will return cardinality of the table 1


(a) sum()
(b) count()
(c) count(*)
(d) max()

ANS: (b) count(*)


17 Which protocol is a set of rules for transmitting data over the internet, and is the basis for the 1
World Wide Web:
(a) pop
(b) http
(c) ftp
(d) smtp

ANS:b) http
18 Ethernet card is also known as : 1
(a) LIC
(b) NIC
(c) MIC
(d) OIC

ANS: b)NIC
19 Fill in the blank : In _________ switching, before a communication starts, a dedicated path is 1
identified between the sender and the receiver.
(a) Packet
(b) Graph
(c) Circuit
(d) Plot

ANS: (c) Circuit


20 Assertion (A): CSV module allows to write a single record into each row in CSV file using 1
writerow() function.
Reason (R): The writerow() function creates header row in csv file by default.

ANS: (C)A is True but R is False

21 Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses. Reasoning 1
(R): WHERE and HAVING clauses are used to check conditions, therefore, these can be used
interchangeably.

ANS: (C)A is True but R is False

SECTION B
22 (i) 1 mark for correct difference 2
(ii) Tuple
1 mark for correct answer
23 (½ x 4 = 2 Marks for each correct operator)
24 (I) A) L1.append(‘maths’) 2
OR
B) L1.sort(reverse=True)
(1 mark for correct answer)
(II) A) L1.pop(0)
OR
B) L1.index(‘cs’)
(1 mark for correct answer)

25 What possible outcome(s) will be produced when the following code is executed? 2
import random
value=random.randint(0,3)
fruit=["APPLE","ORANGE","MANGO","GRAPE"]
for i in range(value):
print(fruit[i],end='##')

a) APPLE##
b) APPLE##ORANGE##
c) APPLE## ORANGE##GRAPE##
d) ORANGE##MANGO##APPLE##
ANS: a) APPLE##
b) APPLE##ORANGE##

(1 mark for each correct output)


26 Rewrite the following code in Python after removing all syntax error(s) and underline each 2
correction done in the code .
def fun1():
num=30
for k in range(0,num):
if k%4==0 :
print(k*4)
else:
print(k+3)
½ mark for each correction
27 (I) A) UNIQUE 2
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 i) Expand the following : 2
aSMTP: Simple Mail Transfer Protocol.
b) VoIP: Voice Over Internet Protocol
(1/2 mark for each correct )

ii) Give one disadvantage of Star topology


(1 mark for correct answer)

OR
i) What is a web browser ?
ii) Define the term Telnet
(1 mark for each correct answer)

SECTION C
29 Write a function in Python to count the number of lines in a text fie ‘EXAM.txt’ which start with 3
an alphabet ‘T’ .
def show():
count=0
f=open("EXAM.txt",'r')
data=f.readlines()
for word in data:
if word[0]==’T’:
count+=1
print(count)
f.close()
(½ mark for correct function header)
(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
(½ mark for checking the line starts with “T”)
(1/2 mark for correctly counting)
(½ mark for printing the count)

OR
Write a function in Python that count the number of “can” words present in a text file
“DETAILS.txt”
def show():
count=0
f=open("DETAILS.txt ",'r')
data=f.read()
d=data.split()
for word in d:
if word==’can’:
count+=1
print(count)
f.close()
(½ mark for correct function header)
(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
(½ mark for checking the word can)
(1/2 mark for correctly counting)
(½ mark for printing the count)

30 Thushar received a message(string) that has upper case and lower-case alphabet. He want to 3
extract all the upper case letters separately .Help him to do his task by performing the following
user defined function in Python:
a) Push the upper case alphabets from the string into a STACK
b) Pop and display the content of the stack.

def extract_uppercase_letters(message):
stack = []
for char in message:
if char.isupper():
stack.append(char)

def pop_stack():
while stack:
print(stack.pop(), end=" ")

( ½ Mark for the correct loop in the function )


( ½ Mark for correctly checking the uppercase in the function )
( ½ Mark for pushing the correct character into stack)
( ½ Mark for the correct loop in the function for Pop)
( ½ Mark for correctly display and pop of item from stack)
(½ Mark for correct declaration of both functions)

Or
Consider a list named Nums which contains random integers. Write the following user defined
functions in Python and perform the specified operations on a stack named BigNums.
(i)
PushBig () : It checks every number from the list Nums and pushes all such numbers which have
5 or more digits into the stack, BigNums.
(ii)
PopBig () : It pops the numbers from the stack, BigNums and displays them. The function should
also display "Stack Empty" when there are no more numbers left in the stack.

Ans:
def PushBig(Nums,BigNums):
for N in Nums:
if len(str(N)) >= 5:
BigNums.append(N)
def PopBig(BigNums):
while BigNums:
print(BigNums.pop())
else:
print("Stack Empty")
( No marks for any function header as it was a part of the question)
( ½ Mark for the correct loop in the function PushBig)
( ½ Mark for correctly checking the number of digits in the function PushBig)
( ½ Mark for pushing the correct number into BigNums in the function PushBig)
( ½ Mark for the correct loop in the function PopBig)
( ½ Mark for correctly checking the underflow condition and printing "Stack Empty" in the
function PopBig)
(½ Mark for popping and printing the correct number in the function PopBig)
Note: Ignore the declarations of Nums and/or BigNums
No marks for any function header as it was a part of the question
(2x1½ mark for correct function body;)

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


def calculate(str):
text=''
x=range(len(str)-1)
for i in x:
if str[i].isupper():
text+=str[i]
elif str[i].islower():
text+=str[i+1]
else:
text+='@'
return text
start='Pre-board Exam'
final=calculate(start)
print(final)
Ans: Pe-@oard @Eam
deduct ½ mark for one wrong character

or
Predict the output of the following code :
def Total (Num=10):
Sum=0
for C in range(1,Num+1):
if C%2!=0:
continue
Sum+=C
return Sum
print(Total(4),end="$")
print(Total(),end="@")

ANS: 6$30@
(1 ½ mark for each correct value of print) (deduct ½ mark for not printing @$)
SECTION D
32 Consider the table BOOK as given below 4

Book_id Book_name Author_name Publisher Price Quantity


C0001 Fast Cook Lata Kapoor EPB 355 5
F0001 The Tears William Hopkins First Publ 650 20
T0001 My First c++ Brain & Brooke EPB 350 10
T0002 C++ Brain A.W. Rossaine TDH 350 15
works
F0002 Thunderbolts Anna Roberts First Publ 750 50
The table contains many more records than shown here.

(A) Write the following queries:


i. To show book name, Author name and price of books of “First Publ” Publisher
ii. To list the names of those books whose name starts with F
iii. To Display the names and price from books in ascending order of their prices.
iv. To increase the price of all books of EPB publishers by 50.

OR
(B) Write the output:
i. Select Publisher, sum(quantity) as total_quantity from book group by Publisher;
ii. Select Book_name, Author from book where author like '%Kapoor%';
iii. Select * from book where price between 500 and 1000;
iv. Select count(*) from book;

Ans: a. SELECT Book_name, Author_name, Price FROM Book WHERE


Publisher = ‘First Publ’;
b. SELECT Book_name FROM Book WHERE Book_name like ‘F%’;
c. SELECT Book_name, Price FROM Book ORDER BY Price ASC;
d. UPDATE Book SET Price=Price+50 WHERE Publisher = “EPB”;

4X1 for each correct query


OR
(i)
Publisher Total _Quantity
EPB 15
First Publ 70
TDH 15

(ii)
Book_name Author_name
Fast Cook Lata Kapoor

(iii)
Book_id Book_name Author_name Publisher Price Quantity
F0001 The Tears William Hopkins First Publ 650 20
F0002 Thunderbolts Anna Roberts First Publ 750 50

(iv) 5

1 mark for each correct output


33 A csv file " record.csv " contains the data . Each record consists of a list with field elements as 2+2
empid, name and sal to store employee id, employee name and employee salary respectively.
Write user defined functions s in Python that defines the following:
(i) ADD() – To accept and add data of an employee to a CSV file ‘record.csv’.
(ii) COUNTR() – To count the number of records present in the CSV file named ‘record.csv’
whose salary is more than 100000.
import csv
def ADD():
f=open(" record.csv",'w')
csvwriter=csv.writer(f)
csvwriter.writerow(['empid','name','salary'])
while True:
empid=int(input("Enter your employee id:"))
name=input("Enter your name:")
sal=int(input("Enter your salary:"))
csvwriter.writerow([empid,name,sal])
print("Do you want to enter more records:")
ch=input()
if(ch=='n'):
break
f.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the writer object)
(½ mark for correctly input the data)
(½ mark for correctly writing the records)

def COUNTR():
f=open(”record.csv",'r')
c=csv.reader(f)
c1=list(c)
cnt=0
for i in c1:
if(i[2]>100000):
cnt+=1
print("No of records in the file:",cnt)
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 count)

34 Aman has been entrusted with the management of some Institution’s Database. He needs 4
to access some information from FACULTY and COURSES tables for a survey analysis.
Help him extract the following information by writing the desired SQL queries as
mentioned below.
Teacher
Posting

(i) To list the names and age of female teachers who are in Mathematics
department.
(ii) To display the name teachers who are posted in Agra
(iii) To display the max(date_to_join), min(date_to_join) of teachers
(iv)
(A) To display name, bonus, department for each teacher where bonus is 10%
of salary
Or
(B) To display the Cartesian Product of these two tables.

Ans:
(i) Select name, age from teacher, posting where teacher.p_id=posting.p_id and
department=’Mathematics’;
(ii) Select name from teacher, posting where teacher.p_id=posting.p_id and
place=’Agra’;
(iii) Select max(date_to_join), min(date_to_join) from teacher;
(iv) Select name, 10/100*salary “Bonus” , department from teacher natural join posting;
(v) Select * from teacher, posting;
35 Arushi has created a table named student in MYSQL database, School: 4
•rno(Roll number )- integer
• name(Name) - string
• clas (Clas) – string
• marks – float
Note the following to establish connectivity between Python and MySQL: • Username - root •
Password - 12345 • Host - localhost
i) Arushi, now wants to add record of student by taking data from user. Help arushi to write the
program in Python.
ii) Also write code to display the total number of records present in the table.

import mysql.connector as mycon


def AddAndDisplay():
mydb=mycon.connect(host="localhost",user="root", passwd="12345", database= "School" )
mycursor=mydb.cursor()
rno=int(input("Enter Roll Number :: "))
name=input("Enter name :: ")
clas=int(input("Enter class :: "))
marks=int(input("Enter Marks :: "))
query="insert into student values({},'{}',{},{})".format(rno,name,clas,marks)
mycursor.execute(query)
mycursor. commit()
print ("Data Added successfully")
mycur.execute("select * from student ")
print(mycur.rowcount())

(½ 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
36 A binary file “STUDENT.DAT” has structure [admission_number, Name, Percentage]. 5
(I) Write a function to input the data of a candidate and append it in a binary file.
(ii) ) Write a function to increase the percentage of student to 95% whose admission number is
input by the user.
Ans:
(I)
import pickle
def input_candidates():
f=open(“student.dat”,’ab’)
c = []
admno = int(input("Enter admission number: "))
name = input("Enter Candidate Name: ")
per = int(input("Enter percentage: ") )
c=[admno,name,per]
pickle.dump(c,f)
print("Candidate data appended successfully.")
f.close()
def update_per():
adm=int(input(“enter the admission number whose percentage is to be updated”))
f=open(“student.dat”,’rb+’)
try:
while True:
a=f.tell()
L=pickle.load(f)
If(L[0]==adm):
L[2]=95
f.seek(a,0)
pickle.dump(L,f)
print(“data updated”)
break
except EOError:
print(“record not found”)

(1/2 mark of import pickle)


(1/2 mark for input)
(1/2 mark for opening file in append mode)
(1/2 mark for using dump)
(1/2 mark for opening file in read write mode)
( 1/2 mark for using load)
(1 mark for checking the condition and updating the value)
(1 mark for updating the data in file)
37 Oxford college, in Delhi is starting up the network between its different wings. There are four 5
Buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL as shown below:

i) S
uggest
the
cable
layout
of
connec
tions
betwee
n the
buildin
gs.
ii)
Sugge
st the
most
suitabl
e place (i.e., building) to house the server of this college, provide a suitable reason.
iii) Is there a requirement of a repeater in the given cable layout? Why/ Why not?
iv) Suggest the placement of hub/switch with justification.
v) The organisation also has inquiry office in another city about 50-60 km away in hilly
region. Suggest the suitable transmission media to interconnect to college and inquiry office
out of the following:
a. Fibre optic cable b. Microwave c. Radio wave
or
What would be your recommendation for enabling live visual communication between the
Admin Office at the Delhi campus and the Mumbai Branch Office from the following
options:
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging

ANS: (i)
1 mark for correct layout
(ii) ADMIN Block
as it has
maximum
number of computers. (1 mark for correct answer)
(iii) Repeater can be placed between ADMIN and SENIOR building and ADMIN
and JUNIOR as the distance is more than 100
I mark for placement of repeater in layout
(iv)in all the wings (1 mark for correct answer)
(v) microwave
Or
Video Conferencing

You might also like