Questions

Q:

Write a c program for quick sort.

Answer

#include<stdio.h>

void quicksort(int [10],int,int);

int main(){
  int x[20],size,i;

  printf("Enter size of the array: ");
  scanf("%d",&size);

  printf("Enter %d elements: ",size);
  for(i=0;i<size;i++)
    scanf("%d",&x[i]);

  quicksort(x,0,size-1);

  printf("Sorted elements: ");
  for(i=0;i<size;i++)
    printf(" %d",x[i]);

  return 0;
}

void quicksort(int x[10],int first,int last){
    int pivot,j,temp,i;

     if(first<last){
         pivot=first;
         i=first;
         j=last;

         while(i<j){
             while(x[i]<=x[pivot]&&i<last)
                 i++;
             while(x[j]>x[pivot])
                 j--;
             if(i<j){
                 temp=x[i];
                  x[i]=x[j];
                  x[j]=temp;
             }
         }

         temp=x[pivot];
         x[pivot]=x[j];
         x[j]=temp;
         quicksort(x,first,j-1);
         quicksort(x,j+1,last);

    }
}

Output:
Enter size of the array: 5
Enter 5 elements: 3 8 0 1 2
Sorted elements: 0 1 2 3 8

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 2777
Q:

The belief in one god is called

A) Polytheism B) Monotheism
C) Holytheism D) None
 
Answer & Explanation Answer: B) Monotheism

Explanation:

Belief in the existence of one god, or in the oneness of God is called Monotheism.

Report Error

View Answer Report Error Discuss

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

2 2777
Q:

In which state, maximum Coast Guard Stations have been established in India?

A) Tamil Nadu B) Andhra Pradesh
C) Maharastra D) Gujarat
 
Answer & Explanation Answer: D) Gujarat

Explanation:

The Indian Coast Guard (ICG) is an armed force that protects India's maritime interests and enforces maritime law, with jurisdiction over the territorial waters of India. Gujarat has maximum Coast Guard Stations.

Report Error

View Answer Report Error Discuss

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

4 2777
Q:

Which process occurs inside the chloroplasts?

A) Photosynthesis B) Glycolysis
C) Oxidation D) None of the above
 
Answer & Explanation Answer: A) Photosynthesis

Explanation:

The process that occurs inside the chloroplasts is photosynthesis. The light from the sun is obserbed and combining with water and CO2, plants prepare food for the plants.

Report Error

View Answer Report Error Discuss

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

3 2776
Q:

Kaolin is chemically classified as

A) Argillaceous rock B) Silicious rock
C) Metamorphic rock D) Calcareous rock
 
Answer & Explanation Answer: A) Argillaceous rock

Explanation:

Kaolin is chemically classified as Argillaceous rock.

Report Error

View Answer Report Error Discuss

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

0 2775
Q:

Improve the bracketed part of the sentence.
The mobile phones have made digital cameras a little (superfluous) in today's world.

A) extinct B) obsolete
C) redundant D) No improvement
 
Answer & Explanation Answer: B) obsolete

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: Bank Exams

0 2775
Q:

The ratio of gross cropped area to the net sown area is called

A) cropping intensity B) intensity of crop rotation
C) crop productivity D) cropping diversity
 
Answer & Explanation Answer: A) cropping intensity

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness
Exam Prep: Bank Exams

2 2775
Q:

Which Ragamala depicts the martial arts by introducing horsemen in battle?

Answer

 Nataraga/ Natanarayana

Report Error

View answer Workspace Report Error Discuss

Subject: Indian Culture

45 2774