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

The Kinetic energy of gas molecules

A) is unaffected by temperature variations B) decreases with increase of temperature
C) increases with decrease of temperature D) increases with increase of temperature
 
Answer & Explanation Answer: D) increases with increase of temperature

Explanation:

Kinetic Energy K.E = 12mV2  or 

K.E V2, Where 'm' is the mass and 'v' is the velocity of molecules.

 

Velocity is proportional to temperature. Hence, KE is proportional to temperature and would increase with temperature.

Report Error

View Answer Report Error Discuss

Filed Under: Chemistry
Exam Prep: AIEEE

18 4135
Q:

Largest gulf in the world

A) Persian Gulf B) Gulf of Mannar
C) Gulf of Mexico D) Gulf of Carpentaria
 
Answer & Explanation Answer: C) Gulf of Mexico

Explanation:

*  The Gulf of Mexico, bordered by the United States, Mexico, and the island nation of Cuba, is the worlds largest gulf.

It has a coastline of about 5,000 kilometers (3,100 miles).

*  The Gulf of Mexico is connected to the Atlantic Ocean by the Straits of Florida, between Cuba and the U.S. state of Florida.

It is largely surrounded by the North American continent.

Report Error

View Answer Report Error Discuss

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

8 4135
Q:

A boy sitting in a train moving with a uniform velocity drops a coin outside. A man standing outside the train will find the trajectory of the coin to be

A) a parabola B) a circle
C) a horizontal straight line D) a vertical straight line
 
Answer & Explanation Answer: A) a parabola

Explanation:

Parabola, because when the coin is dropped at a particular point, it has the same velocity as the running train. So by Newton's first law, it continues its motion horizontally with that velocity. But then, it is also pulled down by earth's gravity continuously. In this situation its horizontal motion gives way to the parabolic motion until it reaches the ground.

Report Error

View Answer Report Error Discuss

Filed Under: Physics

2 4135
Q:

Seagate is manufacturer of

A) harddisk B) earth moving equipment
C) picture tube D) banking software
 
Answer & Explanation Answer: A) harddisk

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Business Awareness

14 4134
Q:

Managing advertising, sales promotion and public relations :

what is public relations in marketing?

Answer

Public relations includes promotional activities that work to create a strong public image of the company. Public relations activities include helping the public to understand the company and its products. Public relations if done right can reach a large audience without the expensive cost of traditional advertising and marketing.

Report Error

View answer Workspace Report Error Discuss

0 4132
Q:

What has a mouth but never smiles?

Answer

A bottle has a mouth from which we used to drink water or any juice. But it cannot smile.

Report Error

View answer Workspace Report Error Discuss

Subject: Word Puzzles Exam Prep: TOEFL , GRE , GATE , CAT , Bank Exams , AIEEE
Job Role: Bank PO , Bank Clerk , Analyst

13 4132
Q:

Select the correct statement about the process of scientific inquiry.

A) The goal of scientific research is to prove the stated hypothesis. B) It is possible to test hypotheses, such as those involving historical events, without conducting experiments.
C) If the results of an experiment do not support the hypothesis that is tested, the experiment is badly designed. D) All of the above
 
Answer & Explanation Answer: B) It is possible to test hypotheses, such as those involving historical events, without conducting experiments.

Explanation:

The correct statement among the given options about the process of scientific inquiry is "It is possible to test hypotheses, such as those involving historical events, without conducting experiments."

 

Although it is not possible to carry out experiments to test hypotheses about evolutionary relationships between living groups or about the timing of the origin of major evolutionary innovations, such hypotheses can be evaluated by making predictions about the expected findings that would result from these hypotheses. Data can then be collected to test whether these predictions are correct.

Report Error

View Answer Report Error Discuss

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

0 4129