MS-2 CS
MS-2 CS
PRACTICE PAPER-II
Class-XII
Subject: Computer Science (083)
Marking Scheme Cum Model Answer-Sheet
SECTION-A(1*21=21 MARKS)
QN Answer of Question
1. Ans. True, as continue keyword skips remaining part of an iteration in a 1
loop.
2. Ans. (c) “uter”, as it counts from 4 index to last index 1
3. Ans: (b) True, as firstly “not” performed then “And” performed and at last 1
“Or” performed.
True or not True and False
True or False and False
True or False
True
4. Ans. (d) dict_student.update(dict_marks), as we use update method for 1
dictionary merging with syntax dict1.update(dict2)
5. Ans. (b) tuple, as Elements enclosed in parentheses( ) represents by 1
tuple.
6. Ans: (d) (40,60), as this expression will slice the given tuple starting with 1
index position 3 and selecting every second element till index number 7.
7. Ans. (c) None, as it is empty value. 1
8. Ans. (c) 512, as 2**3**2= 2**9=512 is the answer. 1
9. Ans. (b) Statement 4, as string’s individual element can’t assigned new 1
value so S[0]= '@' # Statement 4 give error.
10. Ans. (c) F=open(‘Notes.txt’) 1
print(F.read(10))
As read method in python is used to read at most n bytes from the file
associated with the given file descriptor. If the end of the file has been
reached while reading bytes from the given file descriptor, os.read( )
method will return an empty bytes object for all bytes left to be read.
11. Ans. (a) Pickling, as pickling is used for object serialization in handling 1
of Binary Files.
12. Ans. (d) n is local and x is global variable 1
As n is defined within function body and x is defined outside the function
body.
13. Alter- Add command is used to add a new column in table in SQL. 1
14. Ans. (b) DISTNICT, as DISTNICT Keyword is used to obtain Non- 1
duplicated values in a SELECT query.
15. Ans. (c) sum( ), as it’s used for summation of numeric values in a 1
column.
16. Ans. (a) Mycur.fetch(), as it’s not a valid method for fetching. 1
17. Ans. (c) Both Modualtion & Demodulation, as MODEM does both 1
tasks.
18. Ans. (c) HomePage, as it is the first page that normally view at a 1
website.
19. Ans: Topology is the way of connecting the networking devices. 1
20. Ans: (a) Both A and R are true and R is the correct explanation for A 1
As global variables are accessed anywhere in the program and local
variables are accessed only within the boundary of loop/ condition/
function.
1|Page
21. Ans: b) Both A and R are true and R is not the correct explanation for A 1
Invalid identifier(s)
(ii) @selute (iii) Que$tion (v) 4th Sem (vii) No#
As identifier(s) name does not have any special character except
underscore. Name should not start with digit and not any space is there
in name.
23 i) Names of any two data types available in python: int, float or any other 1+1
. valid datatype in python. =2
ii) Any 2 operators name used in python: Arithmetic, Logical, Relational
or any other valid operator in python.
24 (i)A) str="PYTHON@LANGUAGE" 2
. print(str[2: : ])
OR
B) d=dict( )
(ii)A) s=”LANGUAGE"
l=list(s)
OR
B) t=tuple( )
25 Lower = r.randint(1,3) means Lower will have value 1,2, or 3 2
. Upper =r.randint(2,4) means Upper will have value 2, 3, or 4
So K will be from (1, 2, 3) to (2, 3, 4)
Means if K=1, then upper limit (2,3,4)
If K=2, then upper limit (2,3,4)
If K=3, then upper limit (2,3,4)
So correct answer (ii) 30#40#50#
Maximum values of variables Lower and Upper are 3 and 4.
26 COUNT(*) returns the count of all rows in the table, 2
. whereas COUNT (COLUMN_NAME) is used with Column_Name
passed as argument and counts the number of non-NULL values in
the particular column that is given as argument.
Example:
A MySQL table, sales have 10 rows with many columns, one column
name is DISCOUNT.
This DISCOUNT column has 6 valid values and 4 empty/ null
values. When we run the Following queries on sales table.
SELECT COUNT(*)
FROM sales;
COUNT(*)
10
SELECT
COUNT(DISCOUNT)
FROM sales;
COUNT( DISCOUNT )
6
As in table, there are 10 rows so count(*) gives 10 and discount
column is having 6 valid values with 4 NULL values so it gives 6.
27 i) 1+1
2|Page
. A) Default constraint should be applied on a table’s column to provide =2
it the default value when column does not have any value.
OR
B) Unique constraint should be applied on a table’s column so that
NULL value is allowed in that column and duplicate values are not
allowed.
ii)
A)
SQL command to add one more column in previously defined table,
named CELL. Column name is CELL_ID with size 10 of integral
type should be added in the table
Alter table CELL
ADD CELL_ID(10) int;
OR
DROP table CELL;
28 (A) VOIP-Voice Over Internet Protocol 2
. Utility-VoIP is used to transfer audio (voice) and video over internet
URL- Uniform Resource Locator
Utility-Place for typing website names in web browser.
OR
(B)
IP Address MAC Address
Internet Protocol Address Media Access Control Address
It is 4 bytes address in IPV4 and It is 6 bytes address.
6 bytes address in IPV6
Or any other valid difference between the two.
(1 mark for ANY ONE difference)
SECTION-C (3*3= 9 Marks)
29 A) 3
. def countlines_et():
f=open("report.txt",'r')
lines=f.readlines()
linee=0
linet=0
for i in lines:
if i[0]=='E':
linee+=1
elif i[0]=='T':
linet+=1
print("No.of Lines with E:",linee)
print("No.of Lines with T:",linet)
countlines_et()
OR
B)
def show_todo():
f=open("abc.txt",'r')
lines=f.readlines()
for i in lines:
if "TO" in i or "DO" in i:
print(i)
show_todo()
30 A) 3
.
3|Page
data = [1,2,3,4,5,6,7,8]
stack = []
def push(stack, data):
for x in data:
if x % 2 == 0:
stack.append(x)
def pop(stack):
if len(stack)==0:
return "stack empty"
else:
return stack.pop()
push(stack,Data)
print(pop(stack)
(½ mark should be deducted for all incorrect syntax. Full marks to
be awarded for any other logic that produces the correct result.)
OR
B)
def push(EventDetails):
BigEvents=[]
count=0
for i in EventDetails:
if EventDetails[i]>200:
BigEvents.append(i)
count+=1
print(“The count of elements in the stack is”,count)
def pop(EventDetails):
if len(EventDetails)==0:
return "Dictionary is empty"
else:
return EventDetails.pop()
push(EventDetails)
print(pop(EventDetails))
(½ mark should be deducted for all incorrect syntax. Full marks to
be awarded for any other logic that produces the correct result.)
31 A) 1*3
(i) SELECT EMP_NAME, BASIC+DA+HRA+NPS AS “GROSS =3
SALARY” FROM EMPLOYEE;
(ii)UPDATE EMPLOYEE SET DA=DA+0.03*BASIC;
(iii)ALTER TABLE EMPLOYEE DROP COLUMN EMP_DESIG;
OR
B)
(i) SELECT COUNT(*) FROM EMPLOYEE;
(ii) SELECT * FROM EMPLOYEE ORDER BY basic desc;
(iii) SELECT SUM(hra) FROM EMPLOYEE;
SECTION-D (4*4= 16 Marks)
32 A) 1+3
. i) When the value passed in the index operator is greater than the actual =4
size of the tuple or list, Index Out of Range is thrown by python.
ii)
value=[1,2,3,4]
data=0
try:
data=value[4]
4|Page
except IndexError:
print(“list index out of range is not allowed”, end=’’)
except:
print(“Some Error occurred”, end=’’)
OR
B)
i) When the division or modulo by zero takes place for all numeric types,
ZeroDivisionError Exception is thrown by python.
ii)
def division(x,y):
try:
div=x/y
print(div, end=’’)
except ZeroDivisionError as e:
print(“ ZeroDivisionError Exception occured”, e, end=’’)
except:
print(“Some Error occurred”, end=’’)
33 import csv 2+2
. def AddNewRec(Country,Capital): =4
f=open(“CAPITAL.CSV”,’a’)
fwriter=csv.writer(f)
fwriter.writerow([Country,Capital])
f.close()
def ShowRec():
with open(“CAPITAL.CSV”,”r”) as NF:
NewReader=csv.reader(NF)
for rec in NewReader:
print(rec[0],rec[1])
AddNewRec(“INDIA”, ”NEW DELHI”)
AddNewRec(“CHINA”, ”BEIJING”)
ShowRec()
Output:
INDIA NEW DELHI
C H I N A B E I J IN G
34 i)SELECT SUM (PERIODS), SUBJECT FROM SCHOOL GROUP BY 1*4
. SUBJECT ; =4
DEVELOPMENT HUMANRESOURCE
PMENT
LOGISTICS ADM
iii) (a) Switches in all the blocks since the computers need to be
connected to the network.
(b) Repeaters between ADM and HUMANRESOURCE block & ADM
and Logistics block. The reason being the distance is more than 100m.
iv) Modem should be placed in the Server building
v) (c)OFC-Optical Fiber cable, this connection is high-speed wired
communication medium.
OR LAN will be set up among computers connected in Campus.
6|Page