Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
556 views
in Computer by (50.9k points)
closed by

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

+1 vote
by (45.3k points)
selected by
 
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 and Maximum value of ch = 3

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...