1.Easy
A graph consists of:
- ARows and columns
- BVertices (nodes) connected by edges
- CKeys and hashes only
- DOnly a root and leaves
2.Easy
Where is the smallest element of a binary min-heap found?
- AIn any leaf, which must be searched
- BAt the root
- CIn the leftmost leaf
- DIn the last array position
3.Easy
How are the elements of an array stored in memory?
- AScattered, linked by pointers
- BIn random locations chosen by a hash
- CIn one contiguous block, one after another
- DIn a tree of memory pages
4.Medium
What is the cost of inserting an element in the middle of an array of n elements?
- AO(n), because later elements must shift
- BO(n²), because each element moves n times
- CO(1), because the index is known
- DO(log n), because of binary search
5.Medium
What is the purpose of a sentinel (dummy) node in a linked list?
- ATo prevent the list from growing beyond a fixed maximum number of nodes
- BTo make the list sorted
- CTo store the number of elements
- DTo simplify code by removing special cases at the head or tail
6.Medium
Which data structure is used to check whether the brackets in "{[()]}" are balanced?
- AA queue
- BA binary search tree
- CA hash table
- DA stack
7.Hard
Why do databases often use B+ trees rather than plain B-trees for indexes?
- AB+ trees do not need to be balanced
- BAll records are in linked leaves, which makes range scans efficient
- CB+ trees store data only in the root
- DB+ trees use binary internal nodes, which reduces the number of disk reads
8.Hard
A Fenwick tree (binary indexed tree) over an array of n numbers supports which operations in O(log n)?
- AFinding the median in O(1)
- BInserting elements at any position
- CPrefix-sum queries and single-element updates
- DSorting the array and binary search
Answer key
- 1. B · Vertices (nodes) connected by edges
- 2. B · At the root
- 3. C · In one contiguous block, one after another
- 4. A · O(n), because later elements must shift
- 5. D · To simplify code by removing special cases at the head or tail
- 6. D · A stack
- 7. B · All records are in linked leaves, which makes range scans efficient
- 8. C · Prefix-sum queries and single-element updates
Full step-by-step solutions: practise this topic on examproblems.com.