A leaf node is a node with no children. Why the others are wrong: The topmost node of the tree. — that is the root node, not a leaf node. A node with two children. — a node with two children is an internal node, not a leaf node. The longest path in the tree. — that is the height of the tree, not a leaf node.
In binary search, what is compared first with the target value?
AThe first element of the list
BThe last element of the list
CThe sum of all the elements
DThe middle element of the list ✓ Correct answer
✓ Correct answer: The middle element of the list
Full explanation
The middle element of the list. Binary search compares the target with the middle element of a sorted list, and then searches only the half where the target must be. Why the others are wrong: The first element of the list — the first element is checked first in a linear search, not in a binary search. The last element of the list — the last element is not compared first in a binary search. The sum of all the elements — the sum of the elements is never compared with the target in a binary search.
In a stack, what happens when an item is 'popped'?
AThe bottom item is removed
BThe top item is removed ✓ Correct answer
CA new item is added on top
DThe stack is cleared
✓ Correct answer: The top item is removed
Full explanation
The correct answer is the top item is removed. In a stack, popping removes the top item from the stack. Why the others are wrong: The bottom item is removed — in a stack, the bottom item cannot be removed first; only the top item is popped. A new item is added on top — adding a new item on top is called pushing, not popping. The stack is cleared — the stack is cleared only when all items are removed, not by one pop.
Among the following, which data structure uses push() operations on its data?
AGraph
BQueue
CStack ✓ Correct answer
DNone of these
✓ Correct answer: Stack
Full explanation
Stack. A stack is a linear data structure that follows LIFO (Last In, First Out) principle. push() → Adds an element to the top of the stack. pop() → Removes the element from the top of the stack
Which data structure uses LIFO (Last In, First Out) principle?
AStack ✓ Correct answer
BQueue
CLinked List
DNone of these
✓ Correct answer: Stack
Full explanation
Stack. A stack follows the LIFO (Last In, First Out) principle: the last element pushed is the first one popped. Elements are added with Push and removed with Pop, and stacks are used for function calls and expression evaluation.
Which sorting algorithm is the fastest in the average case?
AQuick Sort ✓ Correct answer
BMerge Sort
CBubble Sort
DNone of these
✓ Correct answer: Quick Sort
Full explanation
Quick Sort. Quick sort has an average-case time complexity of O(n log n) with small constant factors, making it the fastest on average among the options given; merge sort is also O(n log n) on average but is usually slower in practice.
Stack. Recursion uses a stack: each function call is pushed onto the call stack in LIFO order and popped when it completes, so the most recent call finishes first.
Tree. A connected graph with no cycles is a tree, with n vertices and n-1 edges and a unique path between any two vertices. Note: the question does not state 'connected', so strictly an acyclic graph in general is a forest; the paper's intended answer is Tree.
What is the time complexity of inserting an element in a binary heap?
AO(n log n)
BO(1)
CO(log n) ✓ Correct answer
DNone of these
✓ Correct answer: O(log n)
Full explanation
O(log n). Inserting into a binary heap adds the element at the end and then heapifies up to restore the heap property, which takes logarithmic time in the number of elements.
Which algorithm is used to find the shortest path in a graph?
ADecision Tree
BDijkstra's Algorithm ✓ Correct answer
CK-Nearest Neighbors
DNone of these
✓ Correct answer: Dijkstra's Algorithm
Full explanation
Dijkstra's Algorithm. Dijkstra's algorithm finds the shortest path between nodes in a weighted graph by repeatedly selecting the closest unvisited node and updating shortest-path estimates.
Which of the following is a self-balancing binary search tree?
AAVL Tree ✓ Correct answer
BBinary Heap
CHash Table
DNone of these
✓ Correct answer: AVL Tree
Full explanation
AVL Tree. An AVL tree is a self-balancing binary search tree in which the heights of the left and right subtrees differ by at most one, keeping search at O(log n).
Which data structure is best for implementing a priority queue?
AHash Table
BHeap ✓ Correct answer
CStack
DNone of these
✓ Correct answer: Heap
Full explanation
Heap. A heap is the best structure for a priority queue because it supports insertion and extraction of the highest (or lowest) priority element efficiently, in O(log n) time.
A data structure having data elements arranged in sequential order would be known as ______?
ATree data structure
BNon-linear data structure
CLinear data structure ✓ Correct answer
DNone of these
✓ Correct answer: Linear data structure
Full explanation
Linear data structure. Linear data structure Definition: Data elements are arranged sequentially in a single line/order Access: Each element has a unique predecessor and successor (except first/last) Examples: Array, Linked List, Stack, Queue, String
A set of instructions/steps/rules that are followed to solve a problem is called _____?
AProcedure
BMethod
CAlgorithm ✓ Correct answer
DNone of these
✓ Correct answer: Algorithm
Full explanation
Algorithm. An algorithm is a step-by-step set of rules to solve a problem. It is used in programming and computer science. Algorithms must be clear, finite, and logical. Every computer program is based on an algorithm. It works like a recipe to reach a solution.
A data structure known as FILO (First In Last Out) would be considered as _____?
AQueue
BStack ✓ Correct answer
CPriority queue
DNone of these
✓ Correct answer: Stack
Full explanation
Stack. FILO (First In Last Out) means the first inserted item is removed last. This behavior matches a Stack data structure. Stack works on push and pop operations. It is used in function calls and undo operations. Elements are accessed only from the top. Additional information : Stack — FILO / LIFO Queue — FIFO