CBSE Class 11 Computer Science Question 145 of 173

Data Handling — Question 34

Back to all questions
34
Question

Question 21

Consider the code given below:

import random
r = random.randrange(100, 999, 5)
print(r, end = ' ')
r = random.randrange(100, 999, 5)
print(r, end = ' ')
r = random.randrange(100, 999, 5)
print(r)

Which of the following are the possible outcomes of the above code ? Also, what can be the maximum and minimum number generated by line 2 ?

(a) 655, 705, 220
(b) 380, 382, 505
(c) 100, 500, 999
(d) 345, 650, 110

Answer

The possible outcomes of the above code can be:

Option (a) — 655, 705, 220
Option (d) — 345, 650, 110

Maximum number can be 995 and minimum number can be 100.

Answer