22

, 2.

23

, 3.

24

, 4.

25

">
MCQs > IT & Programming > Embedded C >

Analyse the following code and choose its correct output from the given options.

#include<stdio.h>

int main()

{

int num1[9] = {3,2,3,4,5,2,3,9,2};

int *pt1, sm=0;

int a, b, p, z, n=9;

z = n;

pt1 = num1;

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

{

    for (b = 0; b < z; b++)

    {

        if (a == b)

        {

            continue;

        }

        else if (*(pt1 + a) == *(pt1 + b))

        {

            p = b;

            z--;

            while (p < z)

            {

                *(pt1 + p) = *(pt1 + p + 1);

                p++;

            }

            b = 0;

        }

    }

}

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

{

    sm=sm+num1[a];

}

printf("%d",sm);

return 0;

}


Embedded C MCQs

Analyse the following code and choose its correct output from the given options.

#include<stdio.h>

int main()

{

int num1[9] = {3,2,3,4,5,2,3,9,2};

int *pt1, sm=0;

int a, b, p, z, n=9;

z = n;

pt1 = num1;

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

{

    for (b = 0; b < z; b++)

    {

        if (a == b)

        {

            continue;

        }

        else if (*(pt1 + a) == *(pt1 + b))

        {

            p = b;

            z--;

            while (p < z)

            {

                *(pt1 + p) = *(pt1 + p + 1);

                p++;

            }

            b = 0;

        }

    }

}

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

{

    sm=sm+num1[a];

}

printf("%d",sm);

return 0;

}


Answer

Correct Answer:

23

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

search

Embedded C Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it