It will sort and print the array in the ascending order, by using the merge sort. 

, 2.

It will sort and print the array in the ascending order, by using the selection sort.

, 3.

It will sort and print the array in the ascending order, by using the bubble sort.

, 4.

It will sort and print the array in the ascending order, by using the quick sort.

">
MCQs > IT & Programming > Embedded C >

Which of the given functions will be performed by the following program?

#include <stdio.h>

void main()

{

int arr1[15];

int a, b, number1, tmp_no;

printf("Enter any value between 2 and 15\n");

scanf("%d", &number1);

printf("Enter elements\n");

for (a = 0; a < number1; a++)

{

    scanf("%d", &arr1[a]);

}

for (a = 0; a < number1; a++)

{

    for (b = 0; b < (number1 – a – 1); b++)

    {

        if (arr1[b] > arr1[b + 1])

        {

            tmp_no = arr1[b];

            arr1[b] = arr1[b + 1];

            arr1[b + 1] = tmp_no;

        }

    }

}

for (a = 0; a < number1; a++)

{

    printf("%d\n", arr1[a]);

}

}


Embedded C MCQs

Which of the given functions will be performed by the following program?

#include <stdio.h>

void main()

{

int arr1[15];

int a, b, number1, tmp_no;

printf("Enter any value between 2 and 15\n");

scanf("%d", &number1);

printf("Enter elements\n");

for (a = 0; a < number1; a++)

{

    scanf("%d", &arr1[a]);

}

for (a = 0; a < number1; a++)

{

    for (b = 0; b < (number1 – a – 1); b++)

    {

        if (arr1[b] > arr1[b + 1])

        {

            tmp_no = arr1[b];

            arr1[b] = arr1[b + 1];

            arr1[b + 1] = tmp_no;

        }

    }

}

for (a = 0; a < number1; a++)

{

    printf("%d\n", arr1[a]);

}

}


Answer

Correct Answer:

It will sort and print the array in the ascending order, by using the bubble sort.

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Embedded C Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

More Embedded C MCQ Questions

search

Embedded C Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it