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

As an infant, the ability to produce antibodies is

A) about 80% of that of an adult B) nonexistent
C) limited D) the same as an adult
 
Answer & Explanation Answer: C) limited

Explanation:

As an infant, the ability to produce antibodies is limited.

Report Error

View Answer Report Error Discuss

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

0 2757
Q:

Which country has decided to venture into Internet of things with new satellite system 'Marathon'?

A) China B) Russia
C) India D) Japan
 
Answer & Explanation Answer: B) Russia

Explanation:

Russia has decided to venture into Internet of things with new satellite system 'Marathon'.

Report Error

View Answer Report Error Discuss

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

0 2757
Q:

Who is the new president and CEO of Nokia?

Answer

Rajeev Suri

Report Error

View answer Workspace Report Error Discuss

2 2757
Q:

Which of the following Articles of Indian Constitution guarantees freedom to press?

A) Article 16 B) Article 19
C) Article 22 D) Article 31
 
Answer & Explanation Answer: B) Article 19

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian Politics

1 2757
Q:

To resolve an object in an electron microscope,

A) the wavelength of the electrons must be close to the diameter of the object B) the wavelength of the electrons must be greater than the diameter of the object.
C) Both A & B D) None of the above
 
Answer & Explanation Answer: A) the wavelength of the electrons must be close to the diameter of the object

Explanation:
Report Error

View Answer Report Error Discuss

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

1 2757
Q:

Tensional forces normally cause which one of the following?

A) normal faults B) strike-slip faults
C) thrust faults D) reverse faults
 
Answer & Explanation Answer: A) normal faults

Explanation:

Tensional forces normally cause normal faults.

Report Error

View Answer Report Error Discuss

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

2 2756
Q:

Which subatomic particle has no charge?

A) electron B) neutron
C) proton D) All of the above
 
Answer & Explanation Answer: B) neutron

Explanation:

An atom is composed of three subatomic particles. They are ::

 

1) Electron (-vely charged particle)

2) Proton (+vely charged particle)

3) Neutron (No charge particle)

 

Hence, Neutron is the subatomic particle which has no charge.

Report Error

View Answer Report Error Discuss

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

2 2756