Page 361 - C++
P. 361
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)
● Deduct ½ Mark for not considering any or all line breaks at proper
place(s)
(f) What possible outputs(s) are expected to be displayed on screen at the time of 2
execution of the program from the following code? Also specify the maximum
values that can be assigned to each of the variables BEGIN and LAST.
import random
POINTS=[20,40,10,30,15];
POINTS=[30,50,20,40,45];
BEGIN=random.randint(1,3)
LAST=random.randint(2,4)
for C in range(BEGIN,LAST+1):
print POINTS[C],"#",
(i) 20#50#30# (ii) 20#40#45#
(iii) 50#20#40# (iv) 30#50#20#
Ans (ii) 20#40#45# and (iii) 50#20#40#
Max value for BEGIN 3
Max value for LAST 4
(1 Mark for writing the correct options)
OR
(½ Mark for writing only option (ii))
OR
(½ Mark for writing only option (iii))
OR
(Full 2 Marks to be awarded if “ERROR”/ “NO OUTPUT” mentioned)
NOTE: No marks to be awarded for writing any other option or any other
combination
(½ Mark for writing correct Maximum value of BEGIN)
(½ Mark for writing correct Maximum value of LAST)
2 (a) What is the advantage of super() function in inheritance? Illustrate the same with 2
the help of an example in Python.
Ans In Python, super() function is used to call the methods of base class which have
been extended in derived class.
class person(object):
def __init__(self,name,age):
self.name=name
self.age=age
def display(self):
Page #19/35