180 3996 372 252 204 67 45

, 2.

15 333 31 21 17 31 15 21 333 17

, 3.

180 3996 372 252 204 17 31 15 17 36 19

, 4.

15 333 31 21 17

">
MCQs > IT & Programming > Embedded C >

What will be the output of the given program?

#include<stdio.h>

#include<stdlib.h>

struct node

{

  int data;

  struct node *next;

};

void ab(struct node* head)

{

  if(head == NULL)

  return;

  ab(head–>next);

  printf("%d ", head–>data*12);

}

void de(struct node* start)

{

  if(start == NULL)

  return;

  printf("%d ", start–>data);

  if(start–>next != NULL )

  de(start–>next–>next);

  printf("%d ", start–>data*7/6);

}

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

{

  struct node* new_node =(struct node*) malloc(sizeof(struct node));

  new_node–>data = new_data;

  new_node–>next = (*head_ref);

  (*head_ref) = new_node;

}

int main()

{

  struct node* head = NULL;

  p(&head, 15);

  p(&head, 333);

  p(&head, 31);

  p(&head, 21);

  p(&head, 17);

  ab(head);

  de(head);

  getchar();

  return 0;

}


Embedded C MCQs

What will be the output of the given program?

#include<stdio.h>

#include<stdlib.h>

struct node

{

  int data;

  struct node *next;

};

void ab(struct node* head)

{

  if(head == NULL)

  return;

  ab(head–>next);

  printf("%d ", head–>data*12);

}

void de(struct node* start)

{

  if(start == NULL)

  return;

  printf("%d ", start–>data);

  if(start–>next != NULL )

  de(start–>next–>next);

  printf("%d ", start–>data*7/6);

}

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

{

  struct node* new_node =(struct node*) malloc(sizeof(struct node));

  new_node–>data = new_data;

  new_node–>next = (*head_ref);

  (*head_ref) = new_node;

}

int main()

{

  struct node* head = NULL;

  p(&head, 15);

  p(&head, 333);

  p(&head, 31);

  p(&head, 21);

  p(&head, 17);

  ab(head);

  de(head);

  getchar();

  return 0;

}


Answer

Correct Answer:

180 3996 372 252 204 17 31 15 17 36 19

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