Class 12th CS Marking Scheme
Class 12th CS Marking Scheme
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: C) 0.0
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)
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: 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
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
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.
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##
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=" ")
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;)
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
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;
(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
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.
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