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

Which method of expressing direction is indicated in the illustration?

A) Section B) Interjuction
C) Intersection D) None of the above
 
Answer & Explanation Answer: C) Intersection

Explanation:

Which_method_of_expressing_direction_is_indicated_in_the_illustration1556259373.png image

 

Intersection method of expressing direction is indicated in the illustration.

Report Error

View Answer Report Error Discuss

Filed Under: Physics
Exam Prep: Bank Exams , AIEEE
Job Role: Bank Clerk , Analyst

5 4162
Q:

'Roaring Forties' are 

A) waterfalls in canada B) cyclonic winds
C) the turbulent years in world History from 1940 to 1944 D) westerly winds blowing through out the year over the oceans of the Southern Hemisphere between 40 degrees and 60 degrees south
 
Answer & Explanation Answer: D) westerly winds blowing through out the year over the oceans of the Southern Hemisphere between 40 degrees and 60 degrees south

Explanation:

The absence of a landmass within these latitudes in the southern hemisphere eliminate friction and lends force to these winds and hence derives the name

Report Error

View Answer Report Error Discuss

Filed Under: World Geography

0 4161
Q:

Bose selected the best soldiers from the three existing brigades (named after Gandhi Azad and Nehru)and organised a new brigade which the soldiers themselves called

A) Himalayan Brigade B) Swatantra Bharat Brigade
C) Bhagat Singh Brigade D) Subhas Brigade
 
Answer & Explanation Answer: D) Subhas Brigade

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian History

2 4161
Q:

Now my value becomes ?

value1499404917.jpg image

A) 5 B) 10
C) 15 D) 12
 
Answer & Explanation Answer: B) 10

Explanation:

In the first figure, number of triangles are 5.

In the second, the figure becomes double then the number of triangles also doubles.

i.e, 10. 

Report Error

View Answer Report Error Discuss

Filed Under: Logic Puzzles
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Bank Clerk

15 4161
Q:

Which Bank has launched 'Project Nishchay' in partnership with The Boston Consulting Group (BCG) ?

A) SBI B) Dena Bank
C) IDBI Bank D) Yes Bank
 
Answer & Explanation Answer: C) IDBI Bank

Explanation:

IDBI Bank has launched 'Project Nishchay' in partnership with The Boston Consulting Group (BCG) to accelerate its turnaround programme and improve financial performance.

Report Error

View Answer Report Error Discuss

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

9 4159
Q:

The study of the weather is known as

A) Weatherology B) Siesmology
C) Meteorology D) Pulmology
 
Answer & Explanation Answer: C) Meteorology

Explanation:

Meteorology is the study of weather and Earth's atmosphere. Climatology is another term used to describe the study of weather.

 

Studying the weather is not only useful for determining if you'll need an umbrella for the day. While forecasting is an important aspect of studying weather, understanding weather patterns provides valuable information about the status of the planet.

Report Error

View Answer Report Error Discuss

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

1 4158
Q:

Mycolog is the branch of botany in which we study about

A) Algae B) Fungi
C) Bacteria D) Virus
 
Answer & Explanation Answer: B) Fungi

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Biology

7 4157