QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A CBSE12A-2018-B01F #6107

Question:

What possible outputs(s) are expected to be displayed on screen at the time of 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#

Answer:

(ii) 20#40#45# and      (iii) 50#20#40#

Max value for BEGIN 3
Max value for LAST 4