1.Easy
In a singly linked list, what does the next pointer of the last node contain?
- AThe number of nodes in the list
- BNull (no node)
- CThe address of the previous node
- DThe address of the first node
2.Easy
How are the elements of an array stored in memory?
- AIn a tree of memory pages
- BScattered, linked by pointers
- CIn random locations chosen by a hash
- DIn one contiguous block, one after another
3.Easy
What is the root of a tree?
- AA node with no children
- BAny node in the middle
- CThe top node with no parent
- DThe node with the largest value
4.Medium
What is true of the adjacency matrix of an undirected graph?
- AIts main diagonal always contains ones
- BIt is always upper triangular
- CEach row has exactly one 1
- DIt is symmetric about the main diagonal
5.Medium
Which data structure does a running program use to keep track of active function calls and their local variables?
- AA hash table of functions
- BThe call stack
- CThe heap memory queue
- DA binary search tree of frames
6.Medium
Which data structure is used to check whether the brackets in "{[()]}" are balanced?
- AA binary search tree
- BA hash table
- CA queue
- DA stack
7.Hard
What is the main advantage of a skip list over a sorted linked list?
- AExpected O(log n) search by using several levels of forward pointers
- BGuaranteed O(1) search because every node stores a pointer to every other node
- CIt stores keys without order
- DIt uses no extra memory
8.Hard
Which data structure supports an LRU (least recently used) cache with O(1) get and put?
- AA single sorted array
- BA binary search tree only
- CA stack only
- DA hash map combined with a doubly linked list
Answer key
- 1. B · Null (no node)
- 2. D · In one contiguous block, one after another
- 3. C · The top node with no parent
- 4. D · It is symmetric about the main diagonal
- 5. B · The call stack
- 6. D · A stack
- 7. A · Expected O(log n) search by using several levels of forward pointers
- 8. D · A hash map combined with a doubly linked list
Full step-by-step solutions: practise this topic on examproblems.com.