441 252

, 2.

254 342

, 3.

264 452

, 4.

458 326

">
MCQs > IT & Programming > Embedded C >

What will be the output of the following code?

#include<stdio.h>

#include<stdlib.h>

struct abc

{ int data;

    struct abc *next;

};

void xy1(struct abc* head)

{ if(head == NULL)

    return;

    xy1(head–>next);

    if ((head–>data)%2==0)

    {printf("%d ", head–>data*31);}

    else

    {printf("%d ", head–>data*21); }

}

void xy2(struct abc* start)

{ if(start == NULL)

    return;

    if(start–>next != NULL )

    xy2(start–>next–>next);

    if((start–>data%2==0))

    {printf("%d ", start–>data*3); }

    else

    {printf("%d ", start–>data*12); }

}

void p(struct abc** head_ref, int new_data)

{ struct abc* new_node =(struct abc*) malloc(sizeof(struct abc));

    new_node–>data = new_data;

    new_node–>next = (*head_ref);

    (*head_ref) = new_node;

}

int main()

{ struct abc* head = NULL;

    p(&head, 21);

    xy1(head);

    xy2(head);

    getchar();

    return 0;

}


Embedded C MCQs

What will be the output of the following code?

#include<stdio.h>

#include<stdlib.h>

struct abc

{ int data;

    struct abc *next;

};

void xy1(struct abc* head)

{ if(head == NULL)

    return;

    xy1(head–>next);

    if ((head–>data)%2==0)

    {printf("%d ", head–>data*31);}

    else

    {printf("%d ", head–>data*21); }

}

void xy2(struct abc* start)

{ if(start == NULL)

    return;

    if(start–>next != NULL )

    xy2(start–>next–>next);

    if((start–>data%2==0))

    {printf("%d ", start–>data*3); }

    else

    {printf("%d ", start–>data*12); }

}

void p(struct abc** head_ref, int new_data)

{ struct abc* new_node =(struct abc*) malloc(sizeof(struct abc));

    new_node–>data = new_data;

    new_node–>next = (*head_ref);

    (*head_ref) = new_node;

}

int main()

{ struct abc* head = NULL;

    p(&head, 21);

    xy1(head);

    xy2(head);

    getchar();

    return 0;

}


Answer

Correct Answer:

441 252

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