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 3898
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 3898
Q:

How many such pairs of letters are there in the word ORDINAL each of which has as many letters between them in the word as in the English alphabet?

A) None B) One
C) Two D) Three
 
Answer & Explanation Answer: D) Three

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Verbal Reasoning - Mental Ability
Exam Prep: Bank Exams
Job Role: Bank PO

5 3897
Q:

Which of the statements given below are correct?

 

A) In 2018 IPL auctions, Sunrisers Hyderabad retained Steve Smith.

B) Lewis Hamilton won the Formula One 2017 Japanese Grand Prix.

C) Ma Long won the 2017 San Marino and Rimini's Coast Motorcycle Grand Prix.

 

A) Only A B) Only B
C) A and C D) A and B
 
Answer & Explanation Answer: B) Only B

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Sports
Exam Prep: Bank Exams

1 3897
Q:

Moti Masjid in Red fort was constructed by

A) Humayun B) Aurangzeb
C) Akbar D) Jahangir
 
Answer & Explanation Answer: B) Aurangzeb

Explanation:

Moti Masjid was built by the Mughal emperor Aurangzeb from 1659-1660. The Moti Masjid is a white marble mosque inside the Red Fort complex in Delhi, India.

Report Error

View Answer Report Error Discuss

Filed Under: Indian History
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

10 3897
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 3896
Q:

The Supreme Court has reconstituted the special Investigation Team(SIT) to expedite probe into Black Money Cases and directed the government to issue the necessary notification. Who of the following is the chairman of this team?

A) Arijit Pasayat B) M.B.Shah
C) R.M.Lodha D) Vinod Rai
 
Answer & Explanation Answer: B) M.B.Shah

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness

3 3896
Q:

India's largest telecom operator Bharti Airtel announced a partnership with __________ to provide cyber security solutions to businesses in India.

A) Symantec Corp B) Mimecast
C) Cisco D) Raytheon
 
Answer & Explanation Answer: A) Symantec Corp

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Bank Clerk , Bank PO

6 3895