Search Header Logo
DS LL

DS LL

Assessment

Presentation

Computers

Professional Development

Medium

Created by

Thirumoorthy Rathinakumar

Used 1+ times

FREE Resource

1 Slide • 1 Question

1

DS LL

by Thirumoorthy Rathinakumar

2

Multiple Choice

#include<stdio.h>

#include<stdlib.h>

struct node

{

    int data;

    struct node *next;

}*head=NULL;

int main()

{

    struct node *node1;

       node1=malloc(sizeof(struct node));

    node1->data = 10;

    struct node *node2;

       node2=malloc(sizeof(struct node));

    node2->data = 20;

    struct node *node3;

      node3=malloc(sizeof(struct node));

    node3->data = 30;

    struct node *node4;

      node4=malloc(sizeof(struct node));

    node4->data = 40;

    head = node1;

    node1->next = node2;

    node2->next = node3;

    node3->next = node4;

    node4->next = NULL;

    struct node *temp;

    temp = head;

    while(temp != NULL)

    {

        printf("%d-->",temp->data);

        temp = temp->next;

    }

    printf("NULL");

    return 0;

}

1

Output:

10-->20-->30-->40-->NULL

2

Output:

10-->20-->30-->40

3

Output:

NULL

4

Output:

10

DS LL

by Thirumoorthy Rathinakumar

Show answer

Auto Play

Slide 1 / 2

SLIDE