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

What Is EFT?

Answer

Exchange Traded Funds (ETFs) are a relatively new phenomenon and are gaining popularity rapidly. This post outlines the key features of an ETF.


ETFs are like mutual funds because they hold an underlying asset like stocks, debt, commodities future contracts etc. If you are new to the concept of an ETF, think of it as a mutual fund, and build your understanding from thereon. An example of an ETF is the SBI Gold ETF, which holds physical gold as its underlying asset.

Report Error

View answer Workspace Report Error Discuss

Subject: Finance

1 2771
Q:

What is market risk?

Answer

It refers to the possibility for an investor to experience  losses due to  factors that affect the overall performance of the financial markets. Market risk cannot be eliminated through diversification, though it can be hedged against. The sources of market risk include natural disasters, recessions, political turmoil, changes in interest rates and terrorist attacks.

Report Error

View answer Workspace Report Error Discuss

0 2771
Q:

Press freedom day is celebrated on

A) May 2 B) May 3
C) May 4 D) None of these
 
Answer & Explanation Answer: B) May 3

Explanation:
Report Error

View Answer Report Error Discuss

2 2771
Q:

A sentence/a part of the sentence is underlined. Four alternatives are given to the underlined part which will improve the sentence. Choose the correct alternative and click the button corresponding to it. In case no improvement is needed, click the button corresponding to “No improvement”.


The trade union is hell bent at getting its demands fulfilled

A) hell bent in  B) hell bent about 
C) hell bent on  D) No improvement 
 
Answer & Explanation Answer: C) hell bent on 

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: TOEFL , GRE , CAT

0 2771
Q:

Words to describe a beautiful woman?

A) Gorgeous B) Cute
C) Elegant D) All of the above
 
Answer & Explanation Answer: D) All of the above

Explanation:

Words to describe a beautiful woman are :: appealing, fair, charming, fascinating, dazzling, fetching, angelic, fine, delicate, delightful, divine, beauteous, ...

Report Error

View Answer Report Error Discuss

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

1 2771
Q:

Attribution theory was designed to account for

A) how people explain others' behavior B) the process of revealing intimate aspects of ourselves to others
C) social facilitation and social loafing D) the loss of self-awareness that occurs in group situations
 
Answer & Explanation Answer: A) how people explain others' behavior

Explanation:

Attribution theory was designed to account for how people explain others' behavior. It is a theory in psychology states that the attributions people make about events and behavior can be classed as either internal or external. In an internal, or dispositional, attribution, people infer that an event or a person's behavior is due to personal factors such as traits, abilities, or feelings.

Report Error

View Answer Report Error Discuss

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

2 2771