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

In the 10th Mandala of the Rigveda, which one of the following hymns reflects upon the marriage ceremonies?

A) Surya Sukta B) Purusha Sukta
C) Dana Stutis D) Urna Sutra
 
Answer & Explanation Answer: B) Purusha Sukta

Explanation:

surya sukta--a hymn in the praise of the sun god

•dana stuti--these are hymns in the praise of those who donate

•urna sutra--is the dot/mark on the forehead that is put before performing rituals.

•purusha sukta---contains hymns about marriage ceremonies

Report Error

View Answer Report Error Discuss

Filed Under: Indian History
Exam Prep: Bank Exams

1 2344
Q:

Rearrange the parts of the sentence in correct order.

Hit hard by austerity measures

P-government, they lead
Q-of the Conservative
R-lives embedded in anxiety

 

A) RPQ B) QRP
C) QPR D) PRQ
 
Answer & Explanation Answer: C) QPR

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: Bank Exams

0 2344
Q:

Which one of the pairs of folk-dance and state is NOT matched?

 

A) Jhumar - Haryana   B) Tamasha - Maharashtra  
C) Kajri - Uttar Pradesh D) Baul - West Bengal
 
Answer & Explanation Answer: A) Jhumar - Haryana  

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian Culture
Exam Prep: Bank Exams

8 2344
Q:

I can shave everyday but my beard will stay. who am I?

Answer

I am a Barber.

Report Error

View answer Workspace Report Error Discuss

Subject: Logic Puzzles Exam Prep: Bank Exams

27 2343
Q:

What is Materials Requirement Planning?

Answer

A given quantity of finished goods requires a given quantity of raw materials and components to make them. Materials requirement planning systems to make them. Materials requirements planning systems are computerized tools that manage when materials must be ordered to supply production at a later date. MRP is effective when output quantities are known.Small business owners are often their own MRP systems,storing the information needed to supply prodution in their knowledge and experience. Activities such as computer tracking inventory and forecasting demand are MRP activities.

Report Error

View answer Workspace Report Error Discuss

Subject: Manufacturing

1 2343
Q:

How many jobs can be run concurrently on MVT?

Answer

15 jobs.

Report Error

View answer Workspace Report Error Discuss

1 2342
Q:

Electromagnetic waves are transverse in nature is evident by

A) Reflection B) Polarisation
C) interference D) Diffraction
 
Answer & Explanation Answer: B) Polarisation

Explanation:
Report Error

View Answer Report Error Discuss

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

3 2342