Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Question 1:

You want to conduct a survey within your classroom, on the
quality of canteen’s food. You ask each of your class
fellows to rank the quality of food between 1 and 5 (1
representing excellent quality and 5 representing worst
quality). During the survey, you make a list containing the
roll# of student and the opinion given by that student. The
list can be as follow

Roll # Opinion

234 1

235 1

236 5

237 1

238 2

239 3

240 5

241 5

242 1

To get the results of the survey, you need to determine the
frequency of each opinion value. The frequency of an opinion
is determined by counting the number of students giving that
opinion. For example, for the above list the frequency of
opinion value 1 is 4 and frequency of opinion value 4 is 0.
After getting the frequency of each opinion, you can easily
judge about the quality of the food by seeing through the
frequency of each opinion.

You need to develop a program to calculate the results of
this survey. The program inputs the opinion of 50 students
and counts the frequency of each opinion. It then displays a
report showing the frequency of each opinion.

Sample output:

Opinion Frequency Remarks

1 5 Excellent

2 10 Good

3 15 Normal

4 10 Bad

5 10 Really bad



Question 1: You want to conduct a survey within your classroom, on the quality of canteen’s f..

Answer / sivajyothi katireddi

#include<stdio.h>
struct survey
{
int roll;
int opinion;
}s[50];
main()
{
int i,a[5]={\0};
for(i=0;i<50;i++) //taking input
{
printf("enter roll num and opinion\n")
scanf("%d %d",s[i].roll,s[i].opinion);
}
printf("survey list is:\n"); //to print survey list
printf("roll\t opinion\n")
for(i=0;i<50;i++)
{
printf("%d\t%d\n",s[i].roll,s[i].opinion);
}
for(i=o;i<50;i++) //to find frequency of opinion
{
switch(s[i].opinion)
{
case 1: a[1]++;
break;
case 2: a[2]++;
break;
case 3: a[3]++;
break;
case 4: a[4]++;
break;
case 5: a[5]++;
break;
default:break;
}
}
/*to print report*/
printf("1\t %d\t excellent\n",a[1]);
printf("2\t %d\t Good\n",a[2]);
printf("3\t %d\t Normal\n",a[3]);
printf("4\t %d\t Bad\n",a[4]);
printf("5\t %d\t Really bad\n",a[5]);
}

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Interview Questions

Why we use int main and void main?

0 Answers  


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

0 Answers   Google, Infosys,


what is the different between data structure and data type?

1 Answers   Ignou,


How do I initialize a pointer to a function?

2 Answers  


What is the significance of c program algorithms?

0 Answers  


What is file in c preprocessor?

0 Answers  


#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2 = 5; printf ( "\n The sum is :%d", value1 | value2 ); } This is the answer asked by some one to add two numbers with out using arithmetic operator?Yes this answer is write it given out put as 15.But how????? what is need of following line? int main ( int argc, char* argv [ ] ) how it work?what is the meaning for this line? please explain me.Advance thanks

9 Answers   Excel,


what is the benefit of c30

2 Answers  


explain memory layout of a C program

2 Answers  


any "C" function by default returns an a) int value b) float value c) char value d) a & b

0 Answers  


Not all reserved words are written in lowercase. TRUE or FALSE?

0 Answers  


Write a program to find minimum between three no.s whithout using comparison operator.

4 Answers   IBM,


Categories