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

 What is the name of autobiography of Adolf Hitler ?

A) First Attack B) Mein Kampf
C) My Spirit D) Ray of Hope
 
Answer & Explanation Answer: B) Mein Kampf

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: World History

4 4046
Q:

The Gas used for Artificial Ripening of Green Fruit is

A) Acetone B) Di Carbonate
C) Ethylene D) Ethyl Alcohol
 
Answer & Explanation Answer: C) Ethylene

Explanation:

Ethylene is used for Artificial Ripening of Green Fruit.

    • Calcium carbide is also used in some countries for artificially ripening fruit. When calcium carbide comes in contact with moisture, it produces acetylene gas, which is quite similar in its effects to the natural ripening agent, ethylene

 

Report Error

View Answer Report Error Discuss

Filed Under: Chemistry
Exam Prep: AIEEE
Job Role: Bank PO

9 4046
Q:

Which one of the following is NOT an example of economic overheads

A) Schools B) Sanitary Facilities
C) Roads and Rrailways D) Coal Mines
 
Answer & Explanation Answer: D) Coal Mines

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian Economy

1 4046
Q:

When were the first general elections of Independent India conducted ?

A) 1948-49 B) 1949-50
C) 1950-51 D) 1951-52
 
Answer & Explanation Answer: D) 1951-52

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian Politics

25 4046
Q:

Dhruv Sharma Who Died in July 2017 Belongs To Which Field ?

A) Politics B) Acting
C) Photography D) Music
 
Answer & Explanation Answer: B) Acting

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Famous Personalities
Exam Prep: Bank Exams , CAT
Job Role: Bank Clerk , Bank PO

6 4045
Q:

You are working on a new project to develop a new wireless product with ease - of - use features recommended by customers. It is as yet undetermined which features and the extent to which each feature will be incorporated into the product.You have a focus group that will continue to evaluate the features as the project goes forward.The focus group is authorized to suggest changes, as are your engineers and the quality department.As a project manager, what will help you most to minimize the effect of these changes?

A) A change management plan B) A scope management plan
C) Do not continue with the project until all of the features are clearly defined in the scope statement and scope definition. D) This is an expected part of every project. A good project manager will have a communications plan in place to be sure everyone knows what is happening on the project.
 
Answer & Explanation Answer: B) A scope management plan

Explanation:

Answer A is tempting because the problem focuses on changes. However, because we are talking about the elaboration of the product's characteristics, we are talking about scope changes, and therefore Answer B is the best answer. Answer C is also tempting because it is difficult to more forward on a project until the scope is clearly defined (especially in systems development projects), but with products and certain types of web development, scope changes can be frequent, and a formal scope management plan is needed. Answer D is true from a project perspective, but does not addres the scope issues.

Report Error

View Answer Report Error Discuss

Filed Under: PMP Certification

0 4045
Q:

Who has won the 2017 Man Booker International Prize  ?

A) Roy Jacobsen B) Amos Oz
C) David Grossman D) Ian Samsom
 
Answer & Explanation Answer: C) David Grossman

Explanation:

David Grossman has become the first Israeli author to win the 2017 Man Booker International prize for his novel “A Horse Walks Into a Bar”. The novel was translated by Jessica Cohen and is published in Britain by Jonathan Cape. The book is an ambitious high-wire act of a novel that shines a spotlight on the effects of grief, without any hint of sentimentality. Since 2016, the Man Booker International Prize awards both the winning author and translator £25,000. To be considered for the prize, books had to be translated into English and published in the UK between May 1, 2016 and April 30, 2017.

Report Error

View Answer Report Error Discuss

Filed Under: Honours and Awards
Exam Prep: Bank Exams , CAT
Job Role: Bank Clerk , Bank PO

11 4043