Questions

Q:

Write a c program for merge sort.

Answer

#include
#define MAX 50

void mergeSort(int arr[],int low,int mid,int high);
void partition(int arr[],int low,int high);

int main(){
  
    int merge[MAX],i,n;

    printf("Enter the total number of elements: ");
    scanf("%d",&n);

    printf("Enter the elements which to be sort: ");
    for(i=0;i<n;i++){
         scanf("%d",&merge[i]);
    }

    partition(merge,0,n-1);

    printf("After merge sorting elements are: ");
    for(i=0;i<n;i++){
         printf("%d ",merge[i]);
    }

   return 0;
}

void partition(int arr[],int low,int high){

    int mid;

    if(low<high){
         mid=(low+high)/2;
         partition(arr,low,mid);
         partition(arr,mid+1,high);
         mergeSort(arr,low,mid,high);
    }
}

void mergeSort(int arr[],int low,int mid,int high){

    int i,m,k,l,temp[MAX];

    l=low;
    i=low;
    m=mid+1;

    while((l<=mid)&&(m<=high)){

         if(arr[l]<=arr[m]){
             temp[i]=arr[l];
             l++;
         }
         else{
             temp[i]=arr[m];
             m++;
         }
         i++;
    }

    if(l>mid){
         for(k=m;k<=high;k++){
             temp[i]=arr[k];
             i++;
         }
    }
    else{
         for(k=l;k<=mid;k++){
             temp[i]=arr[k];
             i++;
         }
    }
  
    for(k=low;k<=high;k++){
         arr[k]=temp[k];
    }
}


Sample output:

Enter the total number of elements: 5
Enter the elements which to be sort: 2 5 0 9 1
After merge sorting elements are: 0 1 2 5 9

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 2376
Q:

The mechanism of material removal in EDM process is

A) Erosion and Cavitations B) Cavitations and Evaporation
C) Melting and Evaporation D) Melting and Corrosion
 
Answer & Explanation Answer: C) Melting and Evaporation

Explanation:

Electrical discharge machining (EDM), also known as spark machining, spark eroding, burning, die sinking, wire burning or wire erosion, is a manufacturing process whereby a desired shape is obtained by using electrical discharges.

Report Error

View Answer Report Error Discuss

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

1 2376
Q:

Who become the brand ambassador of the Swast Immunised India campaign?

A) Kareena Kapoor B) Deepika Padukone
C) Ranveer Singh D) Shilpa Shetty
 
Answer & Explanation Answer: A) Kareena Kapoor

Explanation:

The brand ambassador of the Swast Immunised India campaign is Kareena Kapoor Khan.

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

Which describes how Africa was divided into countries?

A) Ethnic groups were each given their own country B) Artificial political unity was attempted
C) Boundaries were made according to language similarities D) Nomadic peoples were given control of their lands
 
Answer & Explanation Answer: A) Ethnic groups were each given their own country

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: World History
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

1 2375
Q:

What is Bull Market?

Answer

Bull market is that market where stock value are expected rise and people will have tendency to sell their stock so as to earn profit out of it. Thus sudden push from the suppliers will gradually niutalise the market.


 

Report Error

View answer Workspace Report Error Discuss

Subject: Finance

0 2374
Q:

Which statement best describes the relationship between science and technology?

A) Technology is a branch of science. B) Advances in science can lead to new technology.
C) Without technology there is no science. D) Technology is not related to science.
 
Answer & Explanation Answer: B) Advances in science can lead to new technology.

Explanation:

The aim of science is to get an understanding of the natural world, while the aim of technology is to use that understanding to improve people's lives. 

 

Hence, Advances in science can lead to new technology.

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

3 2374
Q:

A computer port is used to

A) Donwload files B) Communicate with other computer peripherals
C) Communicate with hard disks D) All of the above
 
Answer & Explanation Answer: B) Communicate with other computer peripherals

Explanation:
Report Error

View Answer Report Error Discuss

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

1 2374
Q:

Buenos Aires largest shopping mall is called

A) Alto Palermo B) Santa Fe
C) Coronel Diaz D) Abasto
 
Answer & Explanation Answer: D) Abasto

Explanation:

Abasto Shopping is the largest mall in the capital city of Argentina, Buenos Aires with over 230 shops, movie theaters and an enormous food court.

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 2373