OA. free
Free
Warner Bros Data Structures & Algorithms Data Structures & Algorithms Medium

Which of the following statements are true regarding a linked list data structure?

Warner Bros technical mcq question, verified with a worked answer. Free to practise - no sign-up.

Which of the following statements are true regarding a linked list data structure?

Choose one option.
Show answer & explanation
Answer: D. All of the above

Linked lists are dynamic data structures that allow efficient insertions/deletions by updating pointers, support dynamic resizing since nodes are allocated on the heap, and require sequential traversal (O(n)) because they lack contiguous memory indexing.

Step-by-step Derivation:
Step 1: Evaluate Option A. In a linked list, inserting or deleting a node only requires updating the 'next' pointers of adjacent nodes. Unlike arrays, no elements need to be shifted, making these operations O(1) if the position is known. Thus, A is true.
Step 2: Evaluate Option B. Linked lists are composed of nodes allocated dynamically in memory. They do not require a pre-defined size (unlike static arrays), allowing them to grow or shrink as long as memory is available. Thus, B is true.
Step 3: Evaluate Option C. Random access (accessing the i-th element in O(1) time) requires contiguous memory addresses. In a linked list, to reach the i-th node, one must start from the head and traverse i-1 nodes. Thus, random access is not supported. Thus, C is true.
Step 4: Since A, B, and C are all technically correct, the correct choice is Option D.