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

The ancient goal of astrology was to 

A) make a more accurate model of the universe B) predict human events
C) understand the origin of Earth D) predict the passing of the seasons
 
Answer & Explanation Answer: B) predict human events

Explanation:

The ancient goal of astrology was to predict human events.

Report Error

View Answer Report Error Discuss

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

1 2769
Q:

Who is the new president and CEO of Nokia?

Answer

Rajeev Suri

Report Error

View answer Workspace Report Error Discuss

2 2769
Q:

Select the antonym of
horrify

A) affright B) petrify
C) appall D) soothe
 
Answer & Explanation Answer: D) soothe

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: AIEEE , Bank Exams , CAT

0 2769
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 2768
Q:

The flux commonly used in brazing is

A) Ammonium chloride B) Borax
C) Zinc chloride D) Resin plus alcohol
 
Answer & Explanation Answer: B) Borax

Explanation:
Report Error

View Answer Report Error Discuss

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

2 2768
Q:

The 'Old Faithful' in Yellow stone National Park, Wyoming is a/an

A) hot spring B) extinct volcano
C) geyser D) oak tree
 
Answer & Explanation Answer: C) geyser

Explanation:

Geysers are fountains of hot water and superheated steam that erupts with an explosion whereas hotsprings or thermal springs are found where water sinks deep enough the surface to be heated up by the interior forces and it comes out without any explosion. Iceland and New Zealand are the other countries having geysers while hot springs are relatively common.

Report Error

View Answer Report Error Discuss

Filed Under: World Geography

0 2768
Q:

What are the Various Register in 8085?

Answer

Accumulator register, Temporary register, Instruction register, Stack Pointer, Program Counter are the various registers in 8085

Report Error

View answer Workspace Report Error Discuss

Subject: Hardware

0 2767