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

Subject matters experts (SMEs) are resources that are imperative to the succes of a project. Many times, project managers are not experts in the areas they are managing and frequently must rely upon other's expertise. In which scope - management process are SMEs first used?

A) Scope planning B) Scope definition
C) Initiation D) Scope verification
 
Answer & Explanation Answer: C) Initiation

Explanation:

Initiation is the first step in the scope management process, and expert judgment is one of the techniques routinely utilized. Answers A, B, and D are incorrect because they would come after the initiation process.

Report Error

View Answer Report Error Discuss

Filed Under: PMP Certification

0 4138
Q:

"World Television Day" is observed every year on ___.

A) Nov 21 B) Oct 22
C) Sep 23 D) Aug 24
 
Answer & Explanation Answer: A) Nov 21

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Important Days and Years
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Bank Clerk , Bank PO

8 4138
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 4137
Q:

First woman Governor of Kerala?

A) Sheila Dikshit B) Fathima Beevi
C) Sarojini Naidu D) Jyothi Venkitachalam
 
Answer & Explanation Answer: D) Jyothi Venkitachalam

Explanation:

Jyothi Venkitachalam was an Indian politician who served as Governor of Kerala and Member of the Legislative Assembly of Tamil Nadu.

First_woman_Governor_of_Kerala1557552474.jpg image

Report Error

View Answer Report Error Discuss

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

5 4136
Q:

Traveling at high speeds requires

A) requires more steering input B) involves less vehicle maintenance
C) creates decreased following distances D) requires greater stopping distances
 
Answer & Explanation Answer: D) requires greater stopping distances

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Science
Exam Prep: Bank Exams

1 4135
Q:

Difference between Candidate key and Primary key?

Answer

Candidate Key – A Candidate Key can be any column or a combination of columns that can qualify as unique key in database. There can be multiple Candidate Keys in one table. Each Candidate Key can qualify as Primary Key. 


Primary Key – A Primary Key is a column or a combination of columns that uniquely identify a record. Only one Candidate Key can be Primary Key.






        • One needs to be very careful in selecting the Primary Key as an incorrect selection can adversely impact the database architect and future normalization. For a Candidate Key to qualify as a Primary Key, it should be Non-NULL and unique in any domain.




Report Error

View answer Workspace Report Error Discuss

6 4134
Q:

India was partitioned as a consequence of the formula contained in 

A) Cabinet Mission Plan B) Attlee's Declaration
C) June 3 plan or Mountbatten plan D) Both (b) and (c)
 
Answer & Explanation Answer: C) June 3 plan or Mountbatten plan

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian History

2 4134