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

Nucleotides are attached by bonds between the

A) phosphates and sugars B) nitrates and sugars
C) nitrates and phosphates D) sugars and hydrates
 
Answer & Explanation Answer: A) phosphates and sugars

Explanation:

In DNA, adjacent nucleotides are linked by a phosphodiester bond: a covalent bond is formed between the 5' phosphate group of one nucleotide and the 3'-OH group of another.

 

Hence, in this manner, each strand of DNA has a "backbone" of phosphate-sugar-phosphate-sugar-phosphate.

Report Error

View Answer Report Error Discuss

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

1 2725
Q:

Fat is completely digested in the

A) small intestine B) mouth
C) large intestine D) stomach
 
Answer & Explanation Answer: A) small intestine

Explanation:

Fat is completely digested in the small intestine of the body.

Report Error

View Answer Report Error Discuss

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

4 2724
Q:

Who was an early proponent of functionalism?

A) Darwin B) Charles
C) William James D) Wyndt
 
Answer & Explanation Answer: C) William James

Explanation:

who_was_an_early_proponent_of_functionalism1544613019.jpg image

William James was an early proponent of functionalism.

Report Error

View Answer Report Error Discuss

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

3 2724
Q:

The amount of water vapor in the air is called

A) Saturated air B) Precipitation
C) Humidity D) Capacity
 
Answer & Explanation Answer: C) Humidity

Explanation:

The amount of water vapor in the air is called Humidity. The amount of water vapor that air acn hold depends on the temperature of the air. The amount of water vapor in the air as compared with the amount of water that the air could hold is called Relative humidity.

Report Error

View Answer Report Error Discuss

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

4 2724
Q:

Plants developing in dry conditions are

A) lithophytes B) hydrophytes
C) mesophytes D) xerophytes
 
Answer & Explanation Answer: D) xerophytes

Explanation:

Plants developing in dry conditions are called as xerophytes.

Report Error

View Answer Report Error Discuss

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

7 2724
Q:

Which virus is not associated with cancer?

A) Epstein-Barr virus B) Papillomavirus
C) Retrovirus D) Hepatitis virus
 
Answer & Explanation Answer: C) Retrovirus

Explanation:

In the above given options, Retrovirus is the only virus which is not associated with cancer. Here the viruses which are associated with different types of cancer. They are:

Hepatitis virus which is associated with Liver cancer

Papillomavirus which is associated with Cervical cancer

Epstein-Barr virus which is associated with Burkitt's lymphoma.

Report Error

View Answer Report Error Discuss

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

1 2723