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 2721
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 2720
Q:

Which of the following is an interjection?

A) Alas B) Yikes
C) Oh D) All of the above
 
Answer & Explanation Answer: D) All of the above

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: AIEEE , Bank Exams , CAT , GRE , TOEFL
Job Role: Analyst , Bank Clerk , Bank PO

1 2720
Q:

What sugar is found in DNA?

A) Ribose B) Deoxyribose
C) Pentose D) Sucrose
 
Answer & Explanation Answer: B) Deoxyribose

Explanation:

DNA - Deoxyribonucleic acid is a type of nucleic acid. The sugar contained in it is called Deoxyribose.

Report Error

View Answer Report Error Discuss

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

3 2719
Q:

Who is the first Chief Election Commissioner of India?

A) Kalyan Sundaram B) Sukumar Sen
C) V.S. Ramadevi D) T.N. Seshan
 
Answer & Explanation Answer: B) Sukumar Sen

Explanation:

Sukumar Sen, a civil servant who served as the first Chief Election Commissioner of India from 21 March 1950 to 19 December 1958.

 

Who_is_the_first_Chief_Election_Commissioner_of_India1557483367.jpg image

Report Error

View Answer Report Error Discuss

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

2 2719
Q:

Which of these is a starting point for primary succession?

A) a neglected yard B) a surface exposed by a retreating glacier
C) an abandoned city D) abandoned farmland
 
Answer & Explanation Answer: B) a surface exposed by a retreating glacier

Explanation:
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 2719
Q:

what are the hardware interrupts?

Answer

TRAP, RST7.5, RST6.5, RST5.5, INTR.

Report Error

View answer Workspace Report Error Discuss

Subject: Hardware

0 2719
Q:

Project Life Cycle - Characteristic of Project Phases

What is a deliverable?

Answer

A deliverable is a measurable, verifiable work product such as a specification, feasibility study report, detailed design document, or working prototype.

Report Error

View answer Workspace Report Error Discuss

0 2718