+1 vote
in Class 12 by kratos

Observe the following program carefully and attempt the given questions:

include<iostream.h>

include<conio.h>

include<stdlib.h>

void main()

{

clrscr();

randomize();

char courses[][10]={"M.Tech","MCA","MBA","B.Tech"};

int ch;

for(int i=1;i<=3;i++)

{

ch=random(i)+1;

cout<<courses[ch]<<"\t";

}

getch();

}

I. Out of all the four courses stored in the variable courses, which course will never be displayed in the output and which course will always be displayed at first in the output?

II. Mention the minimum and the maximum value assigned to the variable ch?

1 Answer

+2 votes
by kratos
 
Best answer

I. M.Tech will never be displayed in the output.

MCA will always be displayed at first in the output.

II. Minimum value of ch=1

Maximum value of ch=3

...