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

What unit is used to measure weighted average atomic mass?

A) amu B) gram/mole
C) Both A & B D) 1/mole
 
Answer & Explanation Answer: C) Both A & B

Explanation:

The unit which is used to measure weighted average atomic mass is Atomic Mass Unit (amu).

The amu or gram/mole can also be used for this measure.

Report Error

View Answer Report Error Discuss

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

2 2403
Q:

The passage of an electric current through a conducting liquid causes ___________.

A) Galvanisation B) Evaporation
C) Physical Reaction D) Chemical Reaction
 
Answer & Explanation Answer: D) Chemical Reaction

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Chemistry
Exam Prep: Bank Exams

2 2403
Q:

Which of the following represents a positive economic statement?

A) The government should extend unemployment benefits. B) The unemployment rate is too high.
C) Taxes should not be increased since that will lower spending. D) The unemployment rate is 4.8 percent.
 
Answer & Explanation Answer: D) The unemployment rate is 4.8 percent.

Explanation:
Report Error

View Answer Report Error Discuss

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

2 2403
Q:

Net exports are negative when

A) exports are greater than imports B) imports are greater than exports
C) No exports D) None of the above
 
Answer & Explanation Answer: B) imports are greater than exports

Explanation:


When exports are greater than imports, net exports are positive and similarly, when imports are greater than exports, net exports are negative.

 

When a country imports goods, it buys them from foreign producers. The money spent on imports leaves the economy, and that decreases the importing nation's GDP.

Report Error

View Answer Report Error Discuss

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

0 2403
Q:

National Housing Bank is a subsidiary of

A) State Bank of India B) Reserve Bank of India
C) Bank of India D) World Bank
 
Answer & Explanation Answer: C) Bank of India

Explanation:

National Housing Bank is a wholly subsidiary of RBI - Reserve Bank of India.

Report Error

View Answer Report Error Discuss

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

4 2403
Q:

Another name for Indira Point is: ______________________.

A) Parson point B) La-Hi-Ching
C) Pygmalion point D) All options are correct
 
Answer & Explanation Answer: D) All options are correct

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness
Exam Prep: Bank Exams
Job Role: Bank PO , Bank Clerk

0 2403
Q:

Voiceless it cries, wingless flutters, toothless bites, mouth-less mutters.

What is it?

Answer

It is The Wind which cries without a voice, flutters without wings, bites toothless and mutters mouthless.

Report Error

View answer Workspace Report Error Discuss

Subject: Word Puzzles Exam Prep: AIEEE , GRE
Job Role: Analyst , Bank PO

1 2402