InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What are the possible outcome(s) executed from the following code ? Also specify the maximum and minimum values that can be assigned to variable PICKER.import randomPICKER = random randint (0, 3)COLOR = ["BLUE", "PINK", "GREEN", "RED"]:for I in COLOR :for J in range (1, PICKER):Print (I, end = " ")Print ()(i)(ii)(iii)(iv)BLUEBLUEPINKBLUEBLUEPINKBLUEPINKPINKGREENPINKPINKGREENBLUEPINKGREENGREENREDGREENGREENREDBLUEPINKGREENREDREDRED |
|
Answer» Option (i) and (iv) are possible OR option (i) only PICKER maxval = 3 minval = 0 |
|
| 2. |
What are the possible outcome(s) expected from the following python code? Also specify maximum and minimum value, which we can have.def main():p = ‘MY PROGRAM’i = 0while p[i] != ‘R’:l = random.randint(0,3) + 5print p[l],’-’,i += 1(i) R – P – O – R – (ii) P – O – R – Y – (iii) O -R – A – G – (iv) A- G – R – M – |
|
Answer» Minimum value=5 Maximum value=8 So the only possible values are O, G, R, A Only option (iii) is possible. |
|