wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

VRESEC-24.01.2024-AN-1-3

Total questions: 15

Worksheet time: 15mins

Name
Class
Date
1.
A linear collection of data elements where the linear node is given by means of pointer is called?
a)
linked list
b)
node list
c)
primitive list
d)
None of these
2.
What is the time complexity to count the number of elements in the linked list?
a)
O(1)
b)
O(n)
c)
O(logn)
d)
None of the mentioned
3.
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?
a)
O(1)
b)
O(n)
c)
θ (n)
d)
θ (1)
4.
What is the output of following function for start pointing to first node of following linked list? 1->2->3->4->5->6 void fun(struct node* start) { if(start == NULL) return; printf("%d ", start->data); if(start->next != NULL ) fun(start->next->next); printf("%d ", start->data); }
a)
1 4 6 6 4 1
b)
1 3 5 1 3 5
c)
1 2 3 5
d)
1 3 5 5 3 1
5.
What is the functionality of the following piece of code? public int function(int data) { Node temp = head; int var = 0; while(temp != null) { if(temp.getData() == data) { return var; } var = var+1; temp = temp.getNext(); } return Integer.MIN_VALUE; }
a)
Find and delete a given element in the list
b)
Find and return the given element in the list
c)
Find and return the position of the given element in the list
d)
Find and insert a new element in the list
6.
Linked lists are not suitable to for the implementation of?
a)
Insertion sort
b)
Radix sort
c)
Polynomial manipulation
d)
Binary search
7.
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is
a)
log 2 n
b)
n/2
c)
log 2 n – 1
d)
n
8.
Which of these is an application of linked lists?
a)
To implement file systems
b)
For separate chaining in hash-tables
c)
To implement non-binary trees
d)
All of the mentioned
9.
In circular linked list, insertion of node requires modification of?
a)
One pointer
b)
Two pointer
c)
Three pointer
d)
None
10.
Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. Given the representation, which of the following operation can be implemented in O(1) time? i) Insertion at the front of the linked list ii) Insertion at the end of the linked list iii) Deletion of the front node of the linked list iv) Deletion of the last node of the linked list
a)
I and II
b)
I and III
c)
I, II and III
d)
I, II and IV
11.
In linked list each node contain minimum of two fields. One field is data field to store the data second field is?
a)
Pointer to character
b)
Pointer to integer
c)
Pointer to node
d)
Node
12.
What would be the asymptotic time complexity to find an element in the linked list?
a)
O(1)
b)
O(n)
c)
O(n2)
d)
None of the mentioned
13.
The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used?
a)
Singly linked list
b)
Doubly linked list
c)
Circular doubly linked list
d)
Array implementation of list
14.
Consider the following definition in c programming language.Which of the following c code is used to create new node? struct node { int data; struct node * next; } typedef struct node NODE; NODE *ptr;
a)
ptr = (NODE*)malloc(sizeof(NODE));
b)
ptr = (NODE*)malloc(NODE);
c)
ptr = (NODE*)malloc(sizeof(NODE*));
d)
ptr = (NODE)malloc(sizeof(NODE));
15.
What kind of linked list is best to answer question like "What is the item at position n"?
a)
Singly linked list
b)
Doubly linked list
c)
Circular linked list
d)
Array implementation of linked list