+1 vote
in Class 12 by kratos

Observe the following program and find out, which output(*) out of (i) to (iv) willbe expected from the program? What will be the minimum and the maximum value assigned to the variable Alter?

Note: Assume all required header files are already being included in the program.

void main( )

{

randomize();

int Ar[]={10,7}, N;

int Alter=random(2) + 10 ;

for (int C=0;C<2;C++)

{

N=random(2) ;

cout<<Ar[N] +Alter<<”#”;

}

}

(i) 21#20#

(ii) 20#18#

(iii) 20#17#

(iv) 21#17#

1 Answer

+4 votes
by kratos
 
Best answer

The output expected from the program is

(iii) 20#17#

Minimum Value of Alter = 10

Maximum Value of Alter = 11

...