wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Linked List - Implementation

Total questions: 15

Worksheet time: 39mins

Name
Class
Date
1.

struct node *current = start->next

what will "current" contain if it is a pointer to a variable of type struct node ?

a)

Address of 2nd Node

b)

Data Field of 2nd Node

c)

Address of 1st Node

d)

None of these

2.

What is the operation of the below statements?

a)

Insert a new node to the front of a linked list

b)

Create a new node for a linked list

c)

Insert a new node to the end of the linked list

d)

Calculate the size of a linked list

3.

What is the operation of the below statements?

a)

Create a new node for a linked list

b)

Insert a new node to the front of a linked list

c)

Delete a new node from a linked list

d)

Insert a new node to the end of the linked list

4.

Which the following circular linked list

a)
b)
c)
5.

How many times should


“temp =temp->next” be executed in the image to get the value of "Null" when the initial value of temp is temp=head

a)

1

b)

2

c)

3

d)

4

6.

Give syntax to create a node for Single linked list?

a)

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

b)

newnode=(struct node )malloc(sizeof(struct node));

c)

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

d)

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

7.

Give routine to insert at the beginning in a linked list whose structure is by struct node, with list head as L and pointer variable as next

a)

newnode->next=next;

L=newnode;

b)

newnode->next=node;

L=newnode;

c)

newnode->next=L;

L=newnode;

d)

newnode->L=next;

L=newnode;

8.

How to insert a node after a position P in singly linked list?

a)

Newnode -> data = P ;

Newnode -> next = p ->next ;

P -> next = newnode ;

b)

Newnode -> data = x ;

Newnode -> next = p ->next ;

P -> next = L ;

c)

Newnode -> data = x ;

Newnode -> next = p ->node ;

P -> nextnode = next ;

d)

Newnode -> data = x ;

Newnode -> next = p ->next ;

P -> next = newnode ;

9.

Which of the following is application of Singly Linked List?

a)

moving pages forward and backward in browser

b)

Giving chance to each player in a multi player game

c)

Implementing Stack

10.

What advantage does a linked list have over an array?

a)

A linked list can give you the data faster

b)

It is easier to use

c)

A linked list is not of a fixed size

d)

It's better

11.

What is the best and worst-case time complexity for searching for a value in a Linked List?

a)

O(1) and O(log n)

b)

O(1) and O(1)

c)

O(1) and O(n^2)

d)

O(1) and O(n)

12.

What does the following function do for a given Linked List with first node as head?

a)

Prints all nodes of linked lists

b)

Prints alternate nodes of Linked List

c)

Prints alternate nodes in reverse order

d)

Prints all nodes of linked list in reverse order

13.

A linked list contains a list pointer variable _____that stores the address of the first node of the list.

a)

Head

b)

NULL

c)

NEXT

d)

LAST

14.

The last node of the singly-linked list contains__________.

a)

INFO

b)

NULL

c)

NEXT

d)

None of the above

15.

Which node’s data will be printed when


“temp =temp->next” is executed 3 times and the initial value of temp is temp=head

a)

Null

b)

9

c)

27

d)

46