MCQ Answers:
1. Benign - malign
2. Ambiguous - clear
3. Frangible - sturdy
4. Remorse - satisfaction
5. Kindled - extinguish
6. Dearth - abundance
7. Din - silence
8. Affable - rude
9. Limber - rigid
10. Frustrated- satisfied
11. Amity - enmity
12. Vehement - Feeble
13. Noted - obscure
14. Ameliorate - worsen
15. Gorgeous- plain
16. Nomadic - settled
17. Deceit - trust
18. Obscurity- clarity
19. Shrill - muffled
20. Pillaged - safeguarded
21. Smirked - frowned
22. Lavish - economical
23. Obliterated - construct
24. Nictitate - Stare
25. Former - latter
Program solutions:
1. Sort by total marks:
Solution:
#include<stdio.h>
struct Student
{
int regNum, mathsMark, physicsMark, chemistryMarks, total;
};
int main ()
{
int N, index, ctr = 0;
scanf ("%d", &N);
struct Student stud[N];
for (index = 0; index < N; index++)
{
scanf ("%d %d %d %d", &stud[index].regNum, &stud[index].mathsMark,
&stud[index].physicsMark, &stud[index].chemistryMarks);
stud[index].total =stud[index].mathsMark + stud[index].physicsMark +stud[index].chemistryMarks;
}
struct Student temp;
for (index = 0; index < N; j++)
{
for (int j = 0; j < N - index; j++)
{
if (stud[j].total < stud[j + 1].total)
{
temp = stud[j];
stud[j] = stud[j + 1];
stud[j + 1] = temp;
}
}
}
for (index = 0; index < N; index++)
{
printf ("%d\n", stud[index].regNum);
}
}
2. Item with maximum price:
Solution:
#include<stdio.h>
struct Item
{
int itemID;
char itemName[100];
int itemPrice;
};
int
main ()
{
int N;
scanf ("%d", &N);
struct Item item[N];
int index = 0;
for (index = 0; index < N; index++)
{
scanf ("%d %s %d", &item[index].itemID, &item[index].itemName,
&item[index].itemPrice);
}
}
int i=0; max=item[i].itemPrice;
for(index=1;index<N;index++){
if(item[index].itemPrice>max){
max=item[index].itemPrice;
i=index;
}
}
printf("%d %s %d",item[i].itemID,item[i].itemName,item[i].itemPrice);
0 Comments