output: 15 4

, 2.

output: 15 7

, 3.

output: 10 7

, 4.

output: 10 2

">
MCQs > IT & Programming > Embedded C >

Find the output of the following program and choose the correct answer from the given options.

#include <stdio.h>

#include <malloc.h>

void abc(int num2[], int num)

{

int *c = (int *)calloc(sizeof(int), (num – 2));

int i;

printf("output: ");

for (i = 0; i < num; i++)

{

    if (c[num2[i]] == 1)

    printf(" %d ", num2[i]+5);

    else

    c[num2[i]]++;

}

}

int main()

{

int num1[] = {15, 10, 10, 2, 7, 4, 2};

int af = sizeof(num1) / sizeof(num1[0]);

abc(num1, af);

getchar();

return 0;

}


Embedded C MCQs

Find the output of the following program and choose the correct answer from the given options.

#include <stdio.h>

#include <malloc.h>

void abc(int num2[], int num)

{

int *c = (int *)calloc(sizeof(int), (num – 2));

int i;

printf("output: ");

for (i = 0; i < num; i++)

{

    if (c[num2[i]] == 1)

    printf(" %d ", num2[i]+5);

    else

    c[num2[i]]++;

}

}

int main()

{

int num1[] = {15, 10, 10, 2, 7, 4, 2};

int af = sizeof(num1) / sizeof(num1[0]);

abc(num1, af);

getchar();

return 0;

}


Answer

Correct Answer:

output: 15 7

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