Study the following program and select the possible output(s) from the options (i) to (iv) following it. Also, write the maximum and the minimum values that can be assigned to the variable NUM.
Note :
– Assume all required header files are already being included in the program.
– random(n) function generates an integer between 0 and n – 1.
void main()
{
randomize();
int NUM;
NUM=random(3)+2;
char TEXT[]='ABCDEFGHIJK';
for (int I=1;I<=NUM; I++)
{
for(int J=NUM; J<=7;J++){
cout<<TEXT[J];
}
cout<<end1;
}
}
(i) | (ii) | (iii) | (iv) |
FGHI FGHI FGHI FGHI |
BCDEFGH BCDEFGH EFGH EFGH |
EFGH EFGH EFGH EFGH |
CDEFGH CDEFGH |
Possible outcome
(iii) and (iv)
Minimum value of NUM = 2
Maximum value of NUM = 4