CS301 — Data Structures | VU Solved MCQs
This solved paper covers CS301 — Data Structures for Virtual University of Pakistan students, with midterm (Lectures 1–22) and finalterm (Lectures 23–45) questions solved with answers. It includes 10 midterm MCQs, 10 finalterm MCQs, 5 midterm subjective questions and 5 finalterm subjective questions — 30 questions in total — covering data structures, arrays, linked lists, stacks, queues, trees, sorting and searching. Every answer was solved independently and cross-checked against the VU handout, with the handout lecture cited under each question; handout page numbers are being added as they are verified. Use the Take the CS301 quiz link below to practise all 20 MCQs interactively with a live score counter. See the CS301 course hub (https://virtualustaad.blogspot.com/p/cs301-data-structures-past-papers-mcqs.html) for handouts, past papers and more, and the midterm and finalterm mega hubs for every subject. Compiled and verified by Virtual Ustaad. Last updated: 6 November 2026.
1. Midterm Solved MCQs
Q1. Which one of the following statements is NOT correct?
A) In a linked list the elements are necessarily contiguous
B) In a linked list the elements may be at far positions in memory
C) In a linked list each element also has the next element
D) In an array the elements are contiguous
Correct answer: A — In a linked list the elements are necessarily contiguous
Reference: VU handout, Lecture 5 — Linked lists.
Status: Verified
Q2. Each operator in a postfix expression refers to the previous:
A) One operand
B) Two operands
C) Three operands
D) Four operands
Correct answer: B — Two operands
Reference: VU handout, Lecture 7 — Stacks and postfix expressions.
Status: Verified
Q3. Which calling method does NOT change the original value of the argument in the calling function?
A) Call by passing the value of the argument
B) Call by passing the reference of the argument
C) Call by passing the address of the argument
D) None of the given options
Correct answer: A — Call by passing the value of the argument
Reference: VU handout, Lecture 4 — Call by value and call by reference.
Status: Verified
Q4. A tree is an AVL tree if:
A) Any one node fulfils the AVL condition
B) At least half of the nodes fulfil the AVL condition
C) All the nodes fulfil the AVL condition
D) None of the given options
Correct answer: C — All the nodes fulfil the AVL condition
Reference: VU handout, Lecture 20 — AVL trees.
Status: Verified
Q5. Suppose currentNode refers to a node in a linked list (Node class with members data and nextNode). What statement makes currentNode refer to the next node?
A) currentNode++
B) currentNode = nextNode
C) currentNode += nextNode
D) currentNode = currentNode->nextNode
Correct answer: D — currentNode = currentNode->nextNode
Reference: VU handout, Lecture 5 — Linked lists.
Status: Verified
Q6. A queue where the de-queue operation does not depend on FIFO is called a priority queue.
A) False
B) True
Correct answer: B — True
Reference: VU handout, Lecture 9 — Queues and priority queues.
Status: Verified
Q7. Which one is a self-referential data type?
A) Stack
B) Queue
C) Linked list
D) All of these
Correct answer: C — Linked list
Reference: VU handout, Lecture 5 — Linked lists.
Status: Verified
Q8. Each node in a doubly linked list has:
A) 1 pointer
B) 2 pointers
C) 3 pointers
D) 4 pointers
Correct answer: B — 2 pointers
Reference: VU handout, Lecture 6 — Doubly linked lists.
Status: Verified
Q9. A queue is implemented with a linked list, keeping track of a front pointer and a rear pointer. Which pointers change during an insertion into an EMPTY queue?
A) Neither changes
B) Only the front pointer changes
C) Only the rear pointer changes
D) Both change
Correct answer: D — Both change
Reference: VU handout, Lecture 9 — Queue implementation.
Status: Verified
Q10. The tree data structure is a:
A) Linear data structure
B) Non-linear data structure
C) Graphical data structure
D) Data structure like a queue
Correct answer: B — Non-linear data structure
Reference: VU handout, Lecture 13 — Trees.
Status: Verified
2. Finalterm Solved MCQs
Q1. If there are 56 internal nodes in a binary tree, how many external nodes will the binary tree have?
A) 54
B) 55
C) 56
D) 57
Correct answer: D — 57
Reference: VU handout, Lecture 14 — Binary trees (a binary tree with N internal nodes has N + 1 external nodes).
Status: Verified
Q2. If there are N elements in an array, the maximum number of steps needed to find an element using binary search is:
A) N
B) N squared
C) N log2 N
D) log2 N
Correct answer: D — log2 N
Reference: VU handout, Lecture 35 — Binary search.
Status: Verified
Q3. A heap can be used to implement a:
A) Stack
B) Queue
C) Priority queue
D) Linked list
Correct answer: C — Priority queue
Reference: VU handout, Lecture 25 — Heaps.
Status: Verified
Q4. In a complete binary tree, the bottom level is filled from:
A) Right to left
B) Left to right
C) Not filled at all
D) Top to bottom
Correct answer: B — Left to right
Reference: VU handout, Lecture 14 — Complete binary trees.
Status: Verified
Q5. If both pointers of a node in a binary tree are NULL, then it is a/an:
A) Leaf node
B) Root node
C) Internal node
D) Parent node
Correct answer: A — Leaf node
Reference: VU handout, Lecture 13 — Binary trees.
Status: Verified
Q6. We implement the heap by a:
A) AVL tree
B) Expression tree
C) Threaded tree
D) Complete binary tree
Correct answer: D — Complete binary tree
Reference: VU handout, Lecture 25 — Heap implementation.
Status: Verified
Q7. Which of the following is a divide-and-conquer algorithm?
A) Insertion sort
B) Bubble sort
C) Merge sort
D) Selection sort
Correct answer: C — Merge sort
Reference: VU handout, Lecture 36 — Divide-and-conquer sorting.
Status: Verified
Q8. In a threaded binary tree, the NULL pointers are replaced by:
A) Extra nodes
B) Threads
C) Dummy roots
D) Parent pointers
Correct answer: B — Threads
Reference: VU handout, Lecture 23 — Threaded binary trees.
Status: Verified
Q9. An AVL tree is identical to a binary search tree, except that:
A) The height of the left and right subtrees may differ by at most 1
B) It has no root node
C) It cannot store duplicate values
D) It is always a complete tree
Correct answer: A — The height of the left and right subtrees may differ by at most 1
Reference: VU handout, Lecture 20 — AVL trees.
Status: Verified
Q10. To develop a character encoding scheme in a Huffman tree, which value is assigned to the left branch?
A) 0
B) 1
C) -1
D) 2
Correct answer: A — 0
Reference: VU handout, Lecture 27 — Huffman coding.
Status: Verified
Practice every question instantly in the Take the CS301 quiz.
3. Midterm Subjective
Q1. What is a binary tree? Briefly explain it.
Answer: A binary tree is a finite set of elements that is either empty or is divided into three disjoint parts: a single element called the root, and two further binary trees called the left and right subtrees. Each node therefore has at most two children. This recursive definition is the basis for binary search trees, AVL trees and heaps.
Reference: VU handout, Lecture 13 — Binary trees.
Status: Verified
Q2. How is a single left rotation performed in an AVL tree?
Answer: A single left rotation is similar to a single right rotation. Start from tree node k1, the root, whose right child is k2. After the left rotation, the right child k2 becomes the root, and k1 moves down to become the left child of k2. The rotation restores balance when the tree is heavy on the right side.
Reference: VU handout, Lecture 21 — AVL rotations.
Status: Verified
Q3. Describe (i) the height of a tree and (ii) the balance of a node.
Answer: (i) The height of a binary tree is the maximum level of its leaves, also called its depth. (ii) The balance of a node in a binary search tree is the height of its left subtree minus the height of its right subtree. In an AVL tree this balance must be -1, 0 or 1 for every node; otherwise the tree needs rebalancing.
Reference: VU handout, Lecture 20 — Height and balance in AVL trees.
Status: Verified
Q4. Why is a queue a linear data structure?
Answer: A queue is a linear data structure because items can only be inserted at one end and removed from the other, in a single ordered sequence. Unlike a stack, which is last-in first-out (LIFO), a queue is first-in first-out (FIFO). Elements are therefore arranged in one line, in the order they arrived.
Reference: VU handout, Lecture 8 — Queues.
Status: Verified
Q5. How can we delete a node with two children in a binary search tree using its right subtree?
Answer: Replace the node to be deleted with its inorder successor, which is the smallest value in its right subtree. First find that smallest node in the right subtree, copy its value into the node being deleted, and then delete the successor node from the right subtree. The result is still a valid binary search tree, with all left-subtree values smaller and all right-subtree values larger than the replacement.
Reference: VU handout, Lecture 18 — Deletion in a binary search tree.
Status: Verified
4. Finalterm Subjective
Q1. Name two divide-and-conquer algorithms.
Answer: Merge sort and quick sort are two divide-and-conquer algorithms. Each algorithm divides the problem into smaller sub-problems, solves them, and combines the results. Merge sort divides the array in half and merges the sorted halves, while quick sort partitions the array around a pivot and sorts each part.
Reference: VU handout, Lecture 36 — Divide-and-conquer algorithms.
Status: Verified
Q2. What is a heap, and what are its two types?
Answer: A heap is a complete binary tree that follows the heap order, and it is used to implement a priority queue. In a max heap, each node has a value greater than the values of its children, so the root holds the largest value. In a min heap, the key in a parent is smaller than or equal to the key in each child, so the root holds the smallest value.
Reference: VU handout, Lecture 25 — Heaps.
Status: Verified
Q3. What is the difference between call by value and call by reference?
Answer: In call by value, a copy of the object is made and placed in the activation record when the function is called, so changes inside the function do not affect the caller's variable. In call by reference, no copy is made; instead the address of the variable is passed, so the function works on the original value and can change it.
Reference: VU handout, Lecture 4 — Call by value and call by reference (revision question in a finalterm paper).
Status: Verified
Q4. What is a Table ADT? Discuss any two implementations of the Table ADT.
Answer: A table is an abstract data type made up of rows and columns of information. Two implementations are the unsorted sequential array and the sorted sequential array. In an unsorted array, insertion is fast but searching is slow, while in a sorted array, searching is faster but insertion must keep the order, so it costs more.
Reference: VU handout, Lecture 30 — Table ADT.
Status: Verified
Q5. What is an equivalence relation? Give two examples.
Answer: A binary relation R over a set S is an equivalence relation if it has three properties: reflexivity (for every x in S, x R x), symmetry (x R y exactly when y R x), and transitivity (if x R y and y R z, then x R z). Examples include equality of numbers, and the relation "is in the same set as" for people grouped by, for example, their city or their class.
Reference: VU handout, Lecture 28 — Equivalence relations and disjoint sets.
Status: Verified
Frequently asked questions
How many questions are in this CS301 solved paper? 30 questions in total: 10 midterm MCQs, 10 finalterm MCQs, 5 midterm subjective questions and 5 finalterm subjective questions, all with solved answers and handout references.
Are the answers verified? Yes. Every answer was solved independently and cross-checked against at least two sources, including the VU handout. Where a handout page number is confirmed it is cited under the question; page numbers still being verified are being added over time.
Can I practise these MCQs as a quiz? Yes — use the Take the CS301 quiz link in this post to practise all 20 MCQs interactively on the Solved MCQs page, with a live score counter.

Comments
Post a Comment