Unit 2: Linked Lists - Practice Quiz

CSE205 — Data Structures And Algorithms 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 What are the two main components of a node in a singly linked list?

A. Data and Next Pointer
B. Data and Index
C. Head and Tail
D. Value and Reference Count

2 Which of the following best describes the memory allocation of a linked list?

A. Dynamic and Non-contiguous
B. Static and Non-contiguous
C. Static and Contiguous
D. Dynamic and Contiguous

3 What is the time complexity to access the Nth element in a singly linked list?

A. O(1)
B. O(n)
C. O(log n)
D. O(n^2)

4 Which pointer is required to maintain access to the entire linked list?

A. Null pointer
B. Tail pointer
C. Middle pointer
D. Head pointer

5 In C, which function is commonly used to dynamically allocate memory for a new node?

A. new()
B. alloc()
C. malloc()
D. create()

6 What is the value of the 'next' pointer in the last node of a grounded singly linked list?

A. NULL
B. Address of the Head
C. Address of the previous node
D. Garbage value

7 Which of the following is a disadvantage of a singly linked list compared to an array?

A. Fixed size
B. Expensive insertion at the beginning
C. Cannot expand dynamically
D. Memory wastage due to pointers

8 In a self-referential structure definition for a node, what is the data type of the pointer member?

A. int*
B. char*
C. void*
D. struct node*

9 What condition indicates that a singly linked list is empty?

A. head->next == NULL
B. head == tail
C. head == NULL
D. head->data == 0

10 What is the time complexity for inserting a node at the beginning of a singly linked list?

A. O(log n)
B. O(n log n)
C. O(n)
D. O(1)

11 When traversing a singly linked list, what is the condition to stop the loop?

A. ptr->data == NULL
B. ptr->next == NULL
C. ptr == NULL
D. ptr == head

12 Which scenario results in an 'Overflow' condition in a linked list?

A. The list contains a loop
B. The Free Storage Pool (Avail List) is empty
C. The head pointer is lost
D. The list is empty

13 What is the correct order of operations to insert a node 'NEW' between node 'A' and node 'B' (where A->next is B)?

A. NEW->next = A; A->next = B;
B. A->next = NEW; NEW->next = B;
C. NEW->next = B; A->next = NEW;
D. B->next = NEW; NEW->next = A;

14 What is the time complexity of deleting the last node in a singly linked list (without a tail pointer)?

A. O(n)
B. O(log n)
C. O(n^2)
D. O(1)

15 Which function is used to release the memory of a deleted node back to the system?

A. dalloc()
B. remove()
C. delete()
D. free()

16 What is a 'Header Linked List'?

A. A list sorted in ascending order
B. A list with two pointers per node
C. A list that contains a special node at the beginning containing metadata
D. A list where the last node points to the head

17 In a 'Grounded' Header Linked List, what does the last node point to?

A. Random Memory
B. NULL
C. The Header Node
D. The First Data Node

18 In a 'Circular' Header Linked List, what does the last node point to?

A. The Header Node
B. The Last Node itself
C. The First Data Node
D. NULL

19 What is the primary advantage of using a Header node?

A. It simplifies insertion and deletion algorithms by removing special cases for the first node
B. It allows binary search
C. It uses less memory
D. It automatically sorts data

20 What defines a Circular Linked List (without a header)?

A. Nodes are arranged in a circle visually only
B. Head is NULL
C. Last node points to the first node
D. Last node points to NULL

21 What is the loop termination condition when traversing a circular linked list starting from head?

A. ptr->next == head
B. ptr == NULL
C. ptr->next == NULL
D. ptr == head (after starting)

22 Which data structure allows traversal in both forward and backward directions?

A. Circular Singly Linked List
B. Singly Linked List
C. Two-way (Doubly) Linked List
D. Stack

23 How many pointers does a standard node in a Doubly Linked List contain?

A. Three
B. Two
C. One
D. Zero

24 What is the memory overhead of a Doubly Linked List compared to a Singly Linked List?

A. Same
B. Requires double the data space
C. Requires one extra pointer per node
D. 50% less

25 In a Doubly Linked List, to delete a node P (not first/last), which operations are needed?

A. P->prev->next = P->prev; P->next->prev = P->next;
B. head = P->next;
C. P->next = NULL; P->prev = NULL;
D. P->prev->next = P->next; P->next->prev = P->prev;

26 What is the time complexity to delete a node in a Doubly Linked List if the pointer to that node is given?

A. O(n log n)
B. O(1)
C. O(log n)
D. O(n)

27 Which list is best suited for implementing a 'Back' and 'Forward' button in a browser?

A. Queue
B. Singly Linked List
C. Circular Linked List
D. Doubly Linked List

28 In a Circular Doubly Linked List, what does the left (prev) pointer of the first node point to?

A. The first node
B. The second node
C. The last node
D. NULL

29 Which condition indicates 'Underflow' in a linked list?

A. Allocating NULL
B. Traversing past the end
C. Inserting into a full memory
D. Deleting from an empty list

30 If a Singly Linked List is effectively used as a Stack, which end is most efficient for Push and Pop?

A. Push at Start, Pop at End
B. Push at End, Pop at End
C. Push at End, Pop at Start
D. Push at Start, Pop at Start

31 Can Binary Search be effectively applied to a standard Linked List?

A. No, because random access is not allowed
B. Yes, with O(n) complexity
C. Yes, with O(log n) complexity
D. No, because it's not sorted

32 What happens if you free a node without updating the pointers pointing to it?

A. Dangling Pointer
B. List becomes circular
C. Stack Overflow
D. Memory Leak

33 What is the logical structure of a linked list?

A. Grid
B. Hierarchical
C. Non-Linear
D. Linear

34 In a Doubly Linked List, if p points to a node, what is p->next->prev equivalent to (assuming p is not last)?

A. p
B. p->next
C. NULL
D. p->prev

35 Which algorithm is commonly used to detect a cycle (loop) in a linked list?

A. Quick Sort
B. Dijkstra's Algorithm
C. Binary Search
D. Floyd’s Cycle-Finding Algorithm (Tortoise and Hare)

36 To reverse a singly linked list, how many pointers are typically required during the traversal?

A. 3
B. 2
C. 1
D. 4

37 What is a Sentinel node?

A. A dummy node (like a header) used to simplify boundary conditions
B. The last node in a list
C. A node with NULL data
D. A node responsible for memory allocation

38 Which polynomial operation is most efficiently handled by linked lists?

A. Roots finding
B. Addition of sparse polynomials
C. Evaluation
D. Graphing

39 In a Two-way list, inserting a node at the beginning requires changing how many existing pointers (excluding the new node's pointers)?

A. 3
B. 0
C. 2
D. 1

40 What data type is head typically declared as?

A. int
B. struct node
C. void
D. struct node*

41 If ptr is a pointer to a node, how do you access the data of that node in C?

A. *ptr.data
B. &ptr.data
C. ptr.data
D. ptr->data

42 Which operation typically runs faster on a Circular Linked List than a standard Singly Linked List?

A. Sorting
B. Binary Search
C. Finding the Nth node
D. Deleting the first node while maintaining a pointer to the last node

43 Which of the following is NOT a type of linked list?

A. Circular Linked List
B. Doubly Linked List
C. Indexed Linked List
D. Singly Linked List

44 Memory for a linked list node is allocated from which segment?

A. Stack
B. Data Segment
C. Code Segment
D. Heap

45 What is the main disadvantage of a Circular Linked List?

A. Cannot traverse backwards
B. Risk of infinite loops during traversal if not handled carefully
C. Requires double memory
D. Insertion is O(n)

46 To concatenate two singly linked lists (List A and List B) into one, what operation is required?

A. Copy all nodes of B to A
B. Traverse B to end and point to A
C. Traverse A to the end and make the last node point to head of B
D. Make head of A point to head of B

47 How do you represent a Polynomial using a linked list?

A. Nodes store value of x
B. Nodes store coefficient and exponent: [3,2] -> [5,0] -> NULL
C. Array of integers
D. Nodes store only coefficients

48 In a doubly linked list, what does head->prev point to?

A. Random garbage
B. NULL
C. The tail
D. The second node

49 When deleting a node from a linked list, why is a temporary pointer often used?

A. To store the address of the node to be freed so links can be rewired first
B. To speed up deletion
C. It is required by the C syntax
D. To allocate new memory

50 Which complexity best describes sorting a Linked List using Merge Sort?

A. O(n)
B. O(1)
C. O(n log n)
D. O(n^2)