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

Consider the electromagnetic radiations having wavelengths 200 nm, 500 nm and 1000 nm. Which wavelength (s) of the following can make visual sensation to a human eye?

A) 200 nm and 500 nm B) 500 nm and 1000 nm
C) 500 nm only D) 200 nm and 1000 nm
 
Answer & Explanation Answer: C) 500 nm only

Explanation:
Visual image of human eye is 390-700 nanometer. So, approximate value is 500 nanometer only.
Report Error

View Answer Report Error Discuss

Filed Under: Physics
Exam Prep: Bank Exams

3 2278
Q:

In the aggregate expenditures model, it is assumed that investment

in_the_aggregate_expenditures_model_it_is_assumed_that_investment1553493949.jpg image

A) does not change when real GDP changes B) does not respond to changes in interest rates
C) changes by less in percentage terms than changes in real GDP D) automatically changes in response to changes in real GDP
 
Answer & Explanation Answer: A) does not change when real GDP changes

Explanation:

In the aggregate expenditures model, it is assumed that investment does not change when real GDP changes.

 

  • The aggregate expenditure is the sum of all the expenditures undertaken in the economy by the factors during a specific time period.

 

  • The aggregate expenditure determines the total amount that firms and households plan to spend on goods and services at each level of income.
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 2277
Q:

Factors that aid venous return include all except

A) pressure changes in the thorax B) urinary output
C) activity of skeletal muscles D) venous valves
 
Answer & Explanation Answer: B) urinary output

Explanation:
Report Error

View Answer Report Error Discuss

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

4 2277
Q:

All enzymes are proteins.

A) TRUE B) FALSE
Answer & Explanation Answer: A) TRUE

Explanation:

All enzymes are proteins but all proteins are not enzymes since, enzymes are subset of proteins.

Report Error

View Answer Workspace Report Error Discuss

Subject: Biology
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk

0 2277
Q:

The resolution of a printer is measured in

A) DPI B) Megabits
C) Hertz D) Inches
 
Answer & Explanation Answer: A) DPI

Explanation:

Dots per inch (DPI, or dpi) is a measure of spatial printing or video or image scanner dot density, in particular the number of individual dots that can be placed in a line within the span of 1 inch (2.54 cm).

Report Error

View Answer Report Error Discuss

1 2276
Q:

Who is the co-founder of Hotmail?

Answer

Sabeer Bhatia

Report Error

View answer Workspace Report Error Discuss

4 2276
Q:

Which of the following Indian Universities has topped the list of country's official higher education rankings, recently announced by the HRD Ministry ? 

A) Jawaharlal Nehru University B) Banaras Hindu University
C) IISc-Bengaluru D) Delhi University
 
Answer & Explanation Answer: C) IISc-Bengaluru

Explanation:

The Indian Institute of Sciences (IISc)- Bengaluru has topped the list of best universities of country's official higher education rankings, recently announced by the HRD Ministry.

Report Error

View Answer Report Error Discuss

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

1 2276