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

When did B.R. Ambedkar was received Bharat Ratna?

A) 1890 B) 1980
C) 1990 D) 1989
 
Answer & Explanation Answer: C) 1990

Explanation:

Dr. B.R. Ambedkar received Bharat Ratna in the year 1990.

Report Error

View Answer Report Error Discuss

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

3 2749
Q:

Who is the new president and CEO of Nokia?

Answer

Rajeev Suri

Report Error

View answer Workspace Report Error Discuss

2 2749
Q:

The resolution of a printer is measured in

A) DPI B) Megabits
C) Hertz D) Inches
 
Answer & Explanation Answer: A) DPI

Explanation:

Dots per inch (DPI, or dpi) is a measure of spatial printing or video or image scanner dot density, in particular the number of individual dots that can be placed in a line within the span of 1 inch (2.54 cm).

Report Error

View Answer Report Error Discuss

1 2748
Q:

Which country won the Cricket World cup in 2011

A) Sri Lanka B) Australia
C) Pakistan D) India
 
Answer & Explanation Answer: D) India

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Sports

2 2748
Q:

Select the correct statement about the ureters.

A) The ureter is innervated by parasympathetic nerve endings only. B) Ureters contain sphincters at the entrance to the bladder to prevent the backflow of urine.
C) The epithelium is stratified squamous like the skin, which allows a great deal of stretch. D) The ureters are capable of peristalsis like that of the gastrointestinal tract.
 
Answer & Explanation Answer: D) The ureters are capable of peristalsis like that of the gastrointestinal tract.

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Biology
Exam Prep: AIEEE
Job Role: Analyst

2 2748
Q:

A genus can best be defined as

A) a taxon composed of one or more species and a classification level lying below family B) a taxon composed of families
C) the most specific taxon D) a taxon comprised of classes
 
Answer & Explanation Answer: A) a taxon composed of one or more species and a classification level lying below family

Explanation:

A genus can best be defined as a taxon composed of one or more species and a classification level lying below family.

Report Error

View Answer Report Error Discuss

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

1 2748
Q:

Which statement correctly describes the role of chance in evolution?

A) An allele that increases evolutionary fitness cannot be lost from a population by chance events. B) The ultimate source of new alleles is mutation, random changes in the nucleotide sequences of an organism's DNA
C) Evolutionary change proceeds by an accumulation of changes that occur by chance. D) None of the above
 
Answer & Explanation Answer: B) The ultimate source of new alleles is mutation, random changes in the nucleotide sequences of an organism's DNA

Explanation:
Report Error

View Answer Report Error Discuss

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

1 2747