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

Which statement regarding the era of Reconstruction is FALSE?

A) the 14th Amendment made African-Americans citizens of the U.S. B) the 13th Amendment outlawed slavery in all American states
C) federal law was changed to abolish slavery in states where it still existed D) state laws and customs upheld the constitutional amendments
 
Answer & Explanation Answer: D) state laws and customs upheld the constitutional amendments

Explanation:
Report Error

View Answer Report Error Discuss

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

2 2755
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 2754
Q:

Which statement about subatomic particles is not true?

A) Protons and neutrons have the same charge B) Protons and electrons have the opposite charhes
C) Protons and neutrons have almost the same mass D) All of the above
 
Answer & Explanation Answer: A) Protons and neutrons have the same charge

Explanation:
Report Error

View Answer Report Error Discuss

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

2 2754
Q:

Strength of concrete increases with

A) increase in fineness of cement B) decrease in size of aggregate
C) increase in water cement ratio D) decrease in curing time
 
Answer & Explanation Answer: C) increase in water cement ratio

Explanation:

Strength of concrete increases with increase in water cement ratio as the strength of the cement is directly proportional to water cement ratio.

Report Error

View Answer Report Error Discuss

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

2 2754
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 2754
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 2754
Q:

Resistivity of a wire depends on 

A) Length B) Area of cross section
C) Material D) All of above
 
Answer & Explanation Answer: C) Material

Explanation:

The resistivity of wire or the metal conductor is depend on the number density of free electrons in the conductor. so its mainly depends on nature of the material

Report Error

View Answer Report Error Discuss

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

0 2753