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

What is the correct order for Respiration?

A) Election transport chain – Krebs’ cycle – glycolysis B) Glycolysis – Krebs’ cycle – electron transport chain
C) Glycolysis – electron transport chain – Krebs’ cycle D) The Krebs’ cycle - electron transport chain - glycolysis
 
Answer & Explanation Answer: B) Glycolysis – Krebs’ cycle – electron transport chain

Explanation:

Cellular respiration can be broken down into three main steps:

1. Glycolysis,

2. The Kreb's cycle (The citric acid cycle), and

3. Electron Transport Chain.

 

https://hyperphysics.phy-astr.gsu.edu/hbase/biology/celres.html

Report Error

View Answer Report Error Discuss

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

3 2406
Q:

Which activity is accomplished using the genetic code?

A) mutation B) DNA can be made into mRNA
C) DNA formation D) None of the above
 
Answer & Explanation Answer: B) DNA can be made into mRNA

Explanation:
Report Error

View Answer Report Error Discuss

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

3 2405
Q:

Select the antonym of
to comprise

A) to dispute B) to embody
C) to span D) to encompass
 
Answer & Explanation Answer: A) to dispute

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: Bank Exams

0 2405
Q:

What natural factors contribute to global climate?

A) Forest Fires B) Solar Activity
C) Melting Permafrost D) All the above
 
Answer & Explanation Answer: D) All the above

Explanation:

Global warming is the increase in the earth’s average temperature due to release of several greenhouse gases to the atmosphere by humans. Global warming is affecting many parts of the world.

 

Natural Causes include :

1. Solar Activity

2. Melting Permafrost

3. Forest Fires 

 

Human made causes include :

1. Deforestation

2. Overpopulation

3. Landfills

4. Mining

5. Fertilizer Use

Report Error

View Answer Report Error Discuss

Filed Under: General Science
Exam Prep: AIEEE , Bank Exams , GATE
Job Role: Analyst , Bank Clerk , Bank PO

2 2405
Q:

Hot springs are heated geothermally by underlying

A) water B) magma
C) mitula D) None of the above
 
Answer & Explanation Answer: B) magma

Explanation:

Magma is molten rocks beneath the earth's crust. Hot springs are heated geothermally by underlying magma.

Report Error

View Answer Report Error Discuss

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

2 2405
Q:

What form of Shiva is most prominent in the Brihadeshvara Temple built by the Chola dynasty?

A) Harihara B) Bhairava
C) .Rudra D) Tripurantaka
 
Answer & Explanation Answer: D) Tripurantaka

Explanation:

The most prominent form of Shiva in Brihadeshvara Temple built by Chola dynasty is Tripuntaka. Tripurantaka is a manifestation of the Hindu god Shiva. In this aspect, Shiva is depicted with four arms wielding a bow and arrow. Shiva as Tripurantaka is accredited with destroying three mythical cities of the Asuras. It is believed that the Rudraksha came from lord Shiva’s eyes, when he destroyed Tripura.

Report Error

View Answer Report Error Discuss

Filed Under: General Awareness
Exam Prep: Bank Exams

0 2405
Q:

Which keyboard shortcut bolds selected text?

A) CTRL + I B) SHIFT + CTRL + S
C) CTRL + B D) CTRL + SHIFT + I
 
Answer & Explanation Answer: C) CTRL + B

Explanation:

CTRL + B is computer keyboard shortcut bolds selected text.

CTRL + I is used for making the selected text italic

SHIFT + CTRL + S used for SAVE AS option for any document or file.

Report Error

View Answer Report Error Discuss

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

4 2404