Languages [3i Infotech Placement]: Sample Questions 505 - 506 of 546
Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.
Question 505
Explanation
- qsort () is an standard C library function, for sorting an array.
- It uses two argument one of which contains logic to decide order in sorted output.
- This provides flexibility so qsort () to use many types and can be used to obtain any desired order.
- The compare function takes two pointers as arguments and defines the order.
#include<stdio.h>
#include<stdlib.h>
typedef struct emp_list
{
int id;
char name[10];
}
EMP;
int sorting_mech( const void ⚹ele1 , const void ⚹ele2)
{
int a,b;
a =⚹((int ⚹)ele1);
b =⚹((int ⚹)ele2);
if( a >b)
{
return 1;
}
if(a <b )
{
return -1;
}
return 0;
}
qsort(&emp_list_array, &sorting_mech);
The function sorting_mech will be called by the qsort to sort order employees whenever there is need.
Question 506
Write in Short Short Answer▾
What is meant by distributed application? Why are we using that in our application?
EditExplanation
- Distribution application is executed or run on multiple computers within a network.
- Such applications interact (over network) to achieve a specific goal or task.
- They can use client-server model where application software runs as either client, or the server that the client accesses.
- Front end on the client computer requires minimal processing power.