Font size
WorksheetsLinked List
Total questions: 85
Worksheet time: 43mins
What advantage does a linked list have over an array?
Size of the list doesn't need to be mentioned at the beginning of the program
You can add or remove elements from the middle of the list.
The linked list doesn't have a size limit
All of these are true.
Nodes in a linked list contain two things
Direction and a pointer
Data and a pointer
A Pointer and a reference
A pointer and a node
The situation when in a linked list Head==NULL
is
Full
Empty
Half full
saturated
In the above image what will be printed when Head->next->data?
83
9
27
Error
Complete the code in the red column
string info; int link;
int info; NodeType link;
int info; string link;
int info; NodeType * link;
Which of the following statement is not correct?
List is a linear structure
There are 2 example of list, Array List & Linked List.
Array List is not an example of List
List contains a sequence of elements
What is value in the head -> next -> next below?
12
4600
1600
88
struct node *current = start->next
what will "current" contain if it is a pointer to a variable of type struct node ?
Address of 2nd Node
Data Field of 2nd Node
Address of 1st Node
None of these
What is the operation of the below statements?
Insert a new node to the front of a linked list
Create a new node for a linked list
Insert a new node to the end of the linked list
Calculate the size of a linked list
What is the operation of the below statements?
Insert a new node to the front of a linked list
Create a new node for a linked list
Insert a new node to the end of the linked list
Calculate the size of a linked list
What is the operation of the below statements?
Create a new node for a linked list
Insert a new node to the front of a linked list
Delete a new node from a linked list
Insert a new node to the end of the linked list
Which the following circular linked list
How to delete node B?
head->next=TempPtr; free(TemPtr);
free(TemPtr); head->next=TempPtr->next;
head->next=TempPtr->next;free(TemPtr)r;
free(head); head->next= TempPtr->next
The doubly linked list would have how many fields in a node?
1
2
3
4
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
1
2
3
4
How many null pointers exists in a circular linked list?
0
1
2
3
Which of this not about linked list ?
A nonlinear collection of data elements
It can be used to implement several other common abstract data types example stack, queue, tree
It use more memory than arrays because of the storage used by their pointers.
Each record of a linked list is often called an 'element' or 'node'
Which the following circular linked list
What advantage does a linked list have over an array?
A linked list can give you the data faster
It is easier to use
A linked list is not of a fixed size
It's better
What is the best and worst-case time complexity for searching for a value in a Linked List?
O(1) and O(log n)
O(1) and O(1)
O(1) and O(n^2)
O(1) and O(n)
Nodes in a linked list contain two things
Direction and a pointer
Data and a pointer
A Pointer and a reference
A pointer and a node
What is an advantage of using a linked list over an array?
Size of the list doesn't need to be mentioned at the beginning of the program
You can add or remove elements from the middle of the list.
The linked list doesn't have a size limit,
Both of these are true.
How to delete node B
head->next=TempPtr; delete TemPtr;
delete TempPtr; head->next=TempPtr->next;
head->next=TempPtr->next; delete TempPtr;
delete head; head->next= TempPtr->next
To display data of the linked list:
LinkedList *ptr; while (ptr!=NULL){ cout<<ptr->data;}
LinkedList *ptr; while(ptr!=NULL){ ptr=ptr->Next;cout<<ptr->Data};
LinkedList *ptr; while(ptr!=NULL){ ptr=ptr->Next;}
LinkedList *ptr; while(ptr!=NULL){ ptr=ptr->Next;cout<<ptr->Next;}
What does the following function do for a given Linked List with first node as head?
Prints all nodes of linked lists
Prints alternate nodes of Linked List
Prints alternate nodes in reverse order
Prints all nodes of linked list in reverse order
The situation when in a linked list START=NULL is
underflow
overflow
list full
saturated
A linked list contains a list pointer variable _____that stores the address of the first node of the list.
Head
NULL
NEXT
LAST
Name the three functions of a stack data structure.
push, pop, peek
push, pop, pull
push, pop, pow
none of the above
How many fields does the node of a singly linked list has?
1
2
3
4
The doubly linked list would have how many fields in a node?
1
2
3
4
Linked list data structure offers considerable saving in _____________
a) Computational Time
b) Space Utilization
c) Space Utilization and Computational Time
d) Speed Utilization
The situation when in a linked list Head==NULL
is
Full
Empty
Half full
saturated
Each node in a linked list has two
pairs of ………….. and ……………….
Link field and information field
Link field and avail field
Avail field and information field
Address field and link field
In the above image what will be printed when Head->next->data?
83
9
27
Error
In the above image what will be printed when Head->next->next->data is displayed?
83
9
27
Error
What is the condition to check whether linked
list is empty
Head->next==Null
Head->next->next==Null
temp->next==Null
Head==Null
Which node’s data will be printed when
“temp =temp->next” is executed 3 times and the initial value of temp is temp=head
Null
9
27
46
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
1
2
3
4
Head->next->next will print what value
(a)
Complete the code in the red column
string info; int link;
int info; NodeType link;
int info; string link;
int info; NodeType * link;
What is value in the head -> next -> next -> data below?
34
12
88
3
In Linked List implementation, a node carries information regarding
Data
Link
Data and Link
None of the mentioned
Which of the following is not the advantages of Array lists?
Fast random access to the elements
Easy to use
Easy to program
Size is fixed
What is value in the temp -> next -> next-> data below?
34
88
12
3
What is value in the head -> next -> next below?
12
4600
1600
88
struct node *current = start->next
what "current" will contain if it is variable of type struct node ?
Address of 2nd Node
Data Field of 2nd Node
Address of 1st Node
None of these
What is the operation of the below statements?
Insert a new node to the front of a linked list
Create a new node for a linked list
Insert a new node to the end of the linked list
Calculate the size of a linked list
What is the operation of the below statements?
Insert a new node to the front of a linked list
Create a new node for a linked list
Delete a new node from a linked list
Insert a new node to the end of the linked list
Which of the following statement is not correct?
List is a linear structure
There are 2 example of list, Array List & Linked List.
Array List is not an example of List
List contains a sequence of elements
What is the best and worst-case time complexity for searching for a value in a Linked List?
O(1) and O(log n)
O(1) and O(1)
O(1) and O(n^2)
O(1) and O(n)
Linked List is a data structure that consists of sequence of nodes
True
False
To display data of the linked list:
LinkedList *ptr; while (ptr!=NULL){ cout<<ptr->data;}
LinkedList *ptr; while(ptr!=NULL){ ptr=ptr->Next;cout<<ptr->Data};
LinkedList *ptr; while(ptr!=NULL){ ptr=ptr->Next;}
LinkedList *ptr; while(ptr!=NULL){ ptr=ptr->Next;cout<<ptr->Next;}
What does the following function do for a given Linked List with first node as head?
Prints all nodes of linked lists
Prints alternate nodes of Linked List
Prints alternate nodes in reverse order
Prints all nodes of linked list in reverse order
Which of this not about linked list ?
A nonlinear collection of data elements
It can be used to implement several other common abstract data types example stack, queue, tree
It use more memory than arrays because of the storage used by their pointers.
Each record of a linked list is often called an 'element' or 'node'
What advantage does a linked list have over an array?
A linked list can give you the data faster
It is easier to use
A linked list is not of a fixed size
It's better
What is the best and worst-case time complexity for searching for a value in a Linked List?
O(1) and O(log n)
O(1) and O(1)
O(1) and O(n^2)
O(1) and O(n)
What is an advantage of using a linked list over an array?
Size of the list doesn't need to be mentioned at the beginning of the program
You can add or remove elements from the middle of the list.
The linked list doesn't have a size limit,
Both of these are true.
In a circular linked list
Components are all linked together in some sequential manner
There is no beginning and no end
Components are arranged hierarchically
Forward and backward traversal within the list is permitted
A linear collection of data elements where the linear node is given by means of pointer is called?
Linked list
Node list
Primitive list
None
Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?
Deleting a node whose location in given
Searching of an unsorted list for a given item
Inverting a node after the node with given location
Traversing a list to process each node
In linked list each node contain minimum of two fields. One field is data field to store the data second field is?
Pointer to character
Pointer to integer
Pointer to node
Node
The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used?
Singly linked list
Doubly linked list
Circular doubly linked list
Array implementation of list
Consider the following definition in c programming language
struct node
{
int data;
struct node * next;
}
typedef struct node NODE;
NODE *ptr;
Which of the following c code is used to create new node?
ptr=(NODE*)malloc(sizeof(NODE));
ptr=(NODE*)malloc(NODE);
ptr=(NODE*)malloc(sizeof(NODE*));
ptr=(NODE)malloc(sizeof(NODE));
A variant of linked list in which last node of the list points to the first node of the list is?
Singly linked list
Doubly linked list
Circular linked list
Multiply linked list
In doubly linked lists, traversal can be performed?
Only in forward direction
Only in reverse direction
In both directions
None
What kind of linked list is best to answer question like “What is the item at position n?”
Singly linked list
Doubly linked list
Circular linked list
Array implementation of linked list
A variation of linked list is circular linked list, in which the last node in the list points to first node of the list. One problem with this type of list is?
It waste memory space since the pointer head already points to the first node and thus the list node does not need to point to the first node.
It is not possible to add a node at the end of the list.
It is difficult to traverse the list as the pointer of the last node is now not NULL
All of above
A variant of the linked list in which none of the node contains NULL pointer is?
Singly linked list
Doubly linked list
Circular linked list
None
In circular linked list, insertion of node requires modification of?
One pointer
Two pointer
Three pointer
None
Linked lists are not suitable to for the implementation of?
Insertion sort
Radix sort
Polynomial manipulation
Binary search
Which of the following points is/are true about Linked List data structure when it is compared with array
Arrays have better cache locality that can make them better in terms of performance
It is easy to insert and delete elements in Linked List
Random access is not allowed in a typical implementation of Linked Lists
All of the mentioned
What differentiates a circular linked list from a normal linked list?
a) You cannot have the ‘next’ pointer point to null in a circular linked list
b) It is faster to traverse the circular linked list
c) You may or may not have the ‘next’ pointer point to null in a circular linked list
d) Head node is known in circular linked list
Consider a small circular linked list. How to detect the presence of cycles in this list effectively?
A.) Keep one node as head and traverse another temp node till the end to check if its ‘next points to head
B.) Have fast and slow pointers with the fast pointer advancing two nodes at a time and slow pointer advancing by one node at a time
C.) Cannot determine, you have to pre-define if the list contains cycles
D.) None of these
What differentiates a circular linked list from a normal linked list?
A.) You cannot have the ‘next’ pointer point to null in a circular linked list
B.) It is faster to traverse the circular linked list
C.) You may or may not have the ‘next’ pointer point to null in a circular linked list
D.) All of these
Which of the following application makes use of a circular linked list?
A) Undo operation in a text editor
B) Recursive function calls
C) Allocating CPU to resources
D.) None of the above
In a circular linked list ----------------
a.Components are all linked together in some sequential manner
.b.There is no beginning and no end.
c.Components are arranged hierarchically.
d.Forward and backward traversal within the list is permitted.
A variant of linked list in which last node of the list points to the first node of the list is?
a.Singly linked list
b.Doubly linked list
c.Circular linked list
d.Multiply linked list
In circular linked list, insertion of node requires modification of?
a.One pointer
b.Two pointer
c.Three pointer
d.Requires no modification
A ............. is a header list where the last node points back to the header node.
A. rounded header list
B. circular header list
C. common header list
D. forward header list
The disadvantage in using a circular linked list is .......
A. it is possible to get into infinite loop
B. last node points to fist node.
C. time consuming
D. requires more memory space.
How do you count the number of elements in the circular linked list?
a)
public int length(Node head)
{
int length = 0;
if( head == null)
return 0;
Node temp = head.getNext();
while(temp != head)
{
temp = temp.getNext();
length++;
}
return length;
}
b)
public int length(Node head)
{
int length = 0;
if( head == null)
return 0;
Node temp = head.getNext();
while(temp != null)
{
temp = temp.getNext();
length++;
}
return length;
}
c)
public int length(Node head)
{
int length = 0;
if( head == null)
return 0;
Node temp = head.getNext();
while(temp != head && temp != null)
{
temp = head.getNext();
length++;
}
return length;
}
d)
public int length(Node head)
{
int length = 0;
if( head == null)
return 0;
Node temp = head.getNext();
while(temp != head && temp == null)
{
temp = head.getNext();
length++;
}
return length;
}
In Linked list implementation, a node carries information regarding _______.
Link
Data
Link and Data
None of the above
A linked list in which the last node of Linked list points to the first is called a _________.
Singly linked list
Doubly linked list
Circular linked list
None of these
A doubly linked list performs traversal in _________.
Either direction
Circular direction
Any direction
None of these
Linked list data structure usage offers considerable saving in
Space utilisation and computational time
Space utilisation
computational time
