Questions

Q:

How would you use qsort() function to sort an array of structures?

Answer

#include "string.h"


#include "stdlib.h"


struct stud


{


       int rollno;


       int marks;


       char name[30];


};


int sort_m (struct stud *, struct stud *);


int sort_name (struct stud *, struct stud *);


int sort_marks (struct stud *, struct stud *);


 


main()


{


static struct stud ss[] = {


                                            { 15, 96, "Akshay" },


                                            { 2, 97, "Madhuri" },


                                            { 8, 85, "Aishvarya" },


                                            { 10, 80, "Sushmita" }


                                   };


int x,w;


clrscr();


w = sizeof (struct stud);


 


printf ('\nIn order of roll numbers:");


qsort (ss, 4, w, sort_rn);


for(x=0; x<4;x++)


     printf ("\n%d%s%d", ss[x].rollno, ss[x].name,ss[x].marks);


 


printf("\n\nIn order of names:");


qsort(ss, 4, sort_name);


 


for (x=0; x<4;x++)


      printf("\n%d%s%d",ss[x].rollno, ss[x].name,ss[x].marks);


printf("\n\nIn order of marks:");


qsort(ss,4,w,sort_marks);


 


for (x=0;x<4;x++)


      printf ("\n%d%s%d",ss[x].rollno,ss[x].name,ss[x].marks);


}


int sort_rn (struct stud *t1, struct stud *t2)


{


     return (t1->rollno-t2->rollno);


}


 


int sort_name (struct stud *t1, struct stud *t2)


{


     return (strcmp(t1->name,t2->name));


}


int sort_marks (struct stud *t1, struct stud *t2)


{


     return (t2->marks-t1->marks);


}


 


 


 

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 3894
Q:

MS Kim Campbell is the first Prime Minister of

A) Congo B) Canada
C) Portugal D) Phillippines
 
Answer & Explanation Answer: B) Canada

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Famous Personalities

0 3893
Q:

Select the related word/letters/numbers from the given alternatives:

Words : Sentence :: Paragraph: ?

A) TYPING B) Essay
C) Letters D) Phrase
 
Answer & Explanation Answer: B) Essay

Explanation:
Report Error

View Answer Report Error Discuss

0 3891
Q:

The country which proposed the observance of the World Pulses Day?

 

A) Berlin B) Benin
C) Burkina Faso D) Nigeria
 
Answer & Explanation Answer: C) Burkina Faso

Explanation:

Burkina Faso proposed the observance of World Pulses Day on 10th February.

 

Report Error

View Answer Report Error Discuss

Filed Under: Important Days and Years
Exam Prep: Bank Exams

2 3891
Q:

Which statement best describes Arteries?

A) They have thin walls and transport blood away from the heart B) They have thick walls and transport blood toward the heart
C) They have thin walls and transport blood toward the heart D) They have thick walls and transport blood away from the heart
 
Answer & Explanation Answer: D) They have thick walls and transport blood away from the heart

Explanation:

Because arteries have to have thick walls for use of protection. Its when you get to veins where the walls get thinner. And the use of the heart is to pump blood to all of the cells and organs in the body so it would be to transport blood away from the heart.

i.e. 

Arteries = Away from the Heart 
Veins = Back to the Heart.

Report Error

View Answer Report Error Discuss

Filed Under: Biology
Exam Prep: AIEEE , Bank Exams , CAT , GATE
Job Role: Analyst , Bank Clerk , Bank PO

2 3890
Q:

Garba a popular folk dance is associated with Indian state

Answer

Gujarat

Report Error

View answer Workspace Report Error Discuss

Subject: Indian Culture

53 3889
Q:

24 Famous Football Cups and Trophies List With Pictures

Answer

List of International Football Trophies


 


1. UEFA Champions League - International


UEFA_Champions_League1560151581.jpg image



2. FIFA World Cup Trophy - International


FIFA_World_Cup1560151610.jpg image



3. League Championship Trophy - International


League_Championship_Trophy1560151646.jpg image



4. Premier League Trophy - International


 


List of Famous Indian Trophies Associated With Football


 


1. Bandodkar Trophy - India


Bandodkar_cup1560151768.jpg image



2. Dr. BC Roy Trophy - India


B.C_._Roy_Trophy_1560151831.jpg image



3. DCM Trophy - India


DCM_Trophy1560151849.png image



4. IFA Shield - India


IFA_Shield1560151872.png image



5. Santosh Trophy - India


Santosh_Trophy1560151912.jpg imageSantosh_Trophy1560151925.png image



6. Sir Ashutosh Mukherjee Trophy - India



7. Todd Memorial Trophy - India



8. Vittal Trophy - India


 


Trophies Associated With Football in US


 


1. BCS Trophy - America


BCS_Trophy1560152152.jpg image


2. Heisman Trophy - US


Heisman_Trophy1560152172.jpg image


 


Football Trophies in Australia



1. McClelland Trophy - Australia


McClelland_Trophy1560152235.jpg image


 


International Football Cups List


 


1. Colombo Cup - International


Colombo_Cup1560157663.jpg image



2. Confederation Cup - International


Confederation_Cup1560157729.jpg image



3. European Champion Clubs’ Cup - International


European_Champion_Clubs’_Cup1560157829.jpg image


4. The Scottish Cup - International


 


Famous Football Cups List in India


1. Durand Cup - India


Durand_Cup1560157914.jpg image


2. Kalinga Cup - India


Kalinga_Cup1560157944.jpg image



3. Rovers Cup - India


Rovers_Cup1560157977.jpg image



4. Scissor Cup - India


5. Subrato Mukherjee Cup - India


 


Football Cup in US and Canada


Grey Cup - US and Canada


Grey_Cup1560158090.jpg image


 


Football Cup in Asia


Meredka Cup - Asia


Meredka_Cup1560158121.jpg image

Report Error

View answer Workspace Report Error Discuss

Subject: Sports Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

12 3889
Q:

Who among the following Generals or Commanders , carried out a coup d'etat against Jahangir in 1626?

A) Asaf Khan B) Malik Ambar
C) Mahabat Khan D) None of these
 
Answer & Explanation Answer: C) Mahabat Khan

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian History

1 3888