QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A CBSE12A-2017-B01F #6223

Question:

What are the possible outcome(s) executed from the following code? Also
specify the maximum and minimum values that can be assigned to variable N.
import random
NAV = ["LEFT","FRONT","RIGHT","BACK"];
NUM = random.randint(1,3)
NAVG = ""
for C in range(NUM,1,-1):
    NAVG = NAVG+NAV[I]
print NAVG
(i) BACKRIGHT (ii) BACKRIGHTFRONT
(iii) BACK (iv) LEFTFRONTRIGHT

Answer:

(i) BACKRIGHT
Max value 3 and minimum value 1 for variable NUM
OR
I or N not defined
OR
; wrongly placed in line 2