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

Read the passage carefully and choose the best answer to each question out of the four alternatives and click the button corresponding to it.

It's nothing short of a revolution in how we eat, and it's getting closer every day. Yes, a lot of people are obese, and yes, the definition of "healthy eating" seems to change all the time. But in labs and research centres around the world, scientists are racing to match our genes and our taste buds, creating the perfect diet for each of us, a diet that will fight disease, increase longevity, boost physical and mental performance, and taste great to boot. As food scientist J.Bruce German says, "The foods we like the most will be the most healthy for us."

Is that going to be a great day, or what?

All this will come to pass, thanks to genomics, the science that maps and describes an individual's genetic code. In the future, personalized DNA chips will allow us to assess our own inherited predispositions for certain diseases, then adjust our diets accordingly. So, if you're at risk for heart disease, you won't just go on a generic low-fat diet. You'll eat foods with just the right amount and type of fat that's best for you. You'll even be able to track your metabolism day-to-day to determine what foods you should eat at any given time, for any given activity. "Since people differ in their genetics and metabolism, one diet won't fit all," says German. As complex as all this sounds, it could turn out to be relatively simple.

What will be possible in the future?

A) Personalised DNA chips for people to assess their own inherited predispositions B) You are at great risk for heart disease
C) You will not be able to determine what food you should eat D) You will be unable to adjust your diet
 
Answer & Explanation Answer: A) Personalised DNA chips for people to assess their own inherited predispositions

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: Bank Exams

0 2761
Q:

Who become the brand ambassador of the Swast Immunised India campaign?

A) Kareena Kapoor B) Deepika Padukone
C) Ranveer Singh D) Shilpa Shetty
 
Answer & Explanation Answer: A) Kareena Kapoor

Explanation:

The brand ambassador of the Swast Immunised India campaign is Kareena Kapoor Khan.

Report Error

View Answer Report Error Discuss

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

1 2761
Q:

Which measurement depends on gravitational force?

A) Mass B) Weight
C) Height D) All of the above
 
Answer & Explanation Answer: B) Weight

Explanation:

We know that,

Weight W = mg. That is mass times gravitational force.

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

Largest sea in the world

A) Mediterranean sea B) Philippine sea
C) Black sea D) Red sea
 
Answer & Explanation Answer: B) Philippine sea

Explanation:

Largest sea in the world is Philippine sea.

Report Error

View Answer Report Error Discuss

Filed Under: Longest, Shortest, Deepest
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

3 2760
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 2759
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 2759
Q:

Which best describes the fossil record?

A) The fossil record provides evidence of a common ancestor to many species B) The fossil record is inaccurate because scientists are not able to date fossils
C) The fossil record cannot provide evidence of evolution D) The fossil record provides evidence that disputes the theory of evolution
 
Answer & Explanation Answer: A) The fossil record provides evidence of a common ancestor to many species

Explanation:

A fossil is a traces or remainings of plants and animals that lived in the past. The fossil record provides evidence of a common ancestor to many species is the option that best describes the fossil record.

Report Error

View Answer Report Error Discuss

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

1 2759