InterviewSolution
Saved Bookmarks
| 1. |
The following code is from a game, which generates a set of 4 random numbers. Praful is playing this game, help him to identify the correct option(s) out of the four choices given below as the possible set of such numbers generated from the program code so that he wins the game. Justify your answer.#include<iostream.h>#include<stdlib.h>const int LOW=25;void main() {randomize ();int POINT=5,Number;for(int I=1;I<=4;I--){Number=LOW+random(POINT);cout<<Number<<":";POINT--;}}(i) 29:26:25:28:(ii) 24:28:25:26:(iii) 29:26:24:28:(iv) 29:26:25:26: |
||||||||||||||||||||||
|
Answer» (iv) 29: 26: 25: 26: is correct Justification: The only option that satisfied the values as per the code is option (iv) because when:
|
|||||||||||||||||||||||