Page 256 - C++
P. 256
CBSE AISSCE 2016-2017 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91/1 Delhi)
self.Ino=I
self.IName=N
self.Qty=int(Q);
def Buy(self,Q):
self.Qty = self.Qty + Q
def Sell(self,Q):
self.Qty -= Q
def ShowStock(self):
print self.Ino,":",self.IName,"#",self.Qty
I1=ITEM()
I2=ITEM(100,"Eraser",100)
I3=ITEM(102,"Sharpener")
I1.Buy(10)
I2.Sell(25)
I3.Buy(75)
I3.ShowStock()
I1.ShowStock()
I2.ShowStock()
Ans 102 : Sharpener # 85
101 : Pen # 20
100 : Eraser # 75
(1 mark for each correct line of output)
NOTE:
● Deduct ½ Mark for not writing any or all ‘:’ or ‘#’ symbol(s)
● Deduct ½ Mark for not considering any or all line breaks at proper place(s)
(f) What are the possible outcome(s) executed from the following code? Also specify 2
the maximum and minimum values that can be assigned to variable N.
import random
SIDES=["EAST","WEST","NORTH","SOUTH"];
N=random.randint(1,3)
OUT=""
for I in range(N,1,-1):
OUT=OUT+SIDES[I]
print OUT
(i) SOUTHNORTH (ii) SOUTHNORTHWEST
(iii) SOUTH (iv) EASTWESTNORTH
Ans (i) SOUTHNORTH
Maximum value of N = 3
Minimum value of N = 1
(1 mark for correct option)
NOTE: No marks to be awarded for writing any other option or any other
combination
( ½ each for maximum and minimum value of N)
Page #15 of 28