Data Structure Quiz 9
To improve Knowledge in the field of Data Structures
Questions
When linear queue of size MAXQUEUE were implemented in C, underflow occurs at
- Front = 0
- Rear = -1
- Rear = Front
- Rear - Front + 1 = 0
Let the getnode function is called when a node is required for insertion in a linked list. The overflow occurs when
- available list is empty
- available list is full
- available list is half full
- none of these
When linear queue of size MAXQUEUE were implemented in C, overflow occurs at
- Front = MAXQUEUE
- Rear = MAXQUEUE -1
- Rear = Front
- Rear - Front + 1 = 0
In a circular queue of size MAXQUEUE, overflow occurs at
- before incrementing rear, rear = front
- after incrementing rear, rear = front
- before incrementing rear, rear = front +1
- after incrementing rear, rear = front +1
Which among the following is not the correct difference between array and linked lists?
- Insertion in array is costlier whereas linked list is cheaper.
- Deletion in array is costlier whereas linked list is cheaper.
- Traversal in array is costlier whereas linked list is cheaper.
- Linked list requires more memory than array.
Which among the following algorithms requires the reverse of input string before processing through stacks?
- Infix to postfix conversion
- Infix to prefix conversion
- Postfix evaluation
- Prefix evaluation
Let the binary heap has depth equal to d. What is the minimum number of nodes in the heap?
- 2d+1 -1
- 2d+1
- 2d
- 2d -1
The operation decrease-key(H,x,k) is an operation that decreases the key of node x by k (if k<key(x) ) in a binary heap. What is the maximum effort required for this operation?
- Equal to height of the tree
- Constant
- Number of nodes in the heap
- None of these
Let multipop (S, k) is an operation that removes k items form the stack S. In which of the following algorithms, does the multipop() function can be applied?
- Infix to postfix conversion
- Infix to prefix conversion
- Postfix evaluation
- None of these
A descending priority queue is implemented by using linked list. Which of the following operations is the cheapest?
- Traversal
- Insertion
- Search
- Delete-Max
An ascending priority queue is implemented by using linked list. Which of the following operations is the cheapest?
- Traversal
- Insertion
- Delete-min
- Search
What is the total number of possible binary search tree with keys 20, 25 and 5?
- 4
- 3
- 5
- 6
Let there be a stack of integer values. How many elements does the stack contain after following operations?
PUSH(S,1), PUSH(S,2), … , PUSH(S,10)
Multipop(S,5)
PUSH(S,11), PUSH(S,12), … , PUSH(S, 30)
Multipop(S,10)
- 20
- 30
- 10
- 15
Let the binary heap has depth equal to d. What is the minimum number of nodes in the heap?
- 2d+1 -1
- 2d+1
- 2d
- 2d -1
In a circular queue of size MAXQUEUE, overflow occurs at
- Before incrementing rear, rear = front
- After incrementing rear, rear = front
- Before incrementing rear, rear = front +1
- After incrementing rear, rear = front +1
Given a linear queu
| Front | Rear | |||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| A | B | C | ||||
| After the following operations, what will be the positions of front and rear? | ||||||
| Insert(Q,D) Remove(Q) Insert(Q,E) |
- Rear = 6, Front = 3
- Rear = 7, Front = 4
- Rear = 7, Front = 3
- None of these
Given a linear queu
| Front | Rear | |||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| A | B | C | ||||
| After the following operations, what will be the positions of front and rear? | ||||||
| Insert(Q,D) Insert(Q,E) Remove() Insert(Q,F) |
- Rear = 7, Front = 4
- Rear =7, Front = 3
- Rear = 8, Front = 3
- Queue overflows
Given a circular queu
| Rear | Front | |||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| A | B | C | ||||
| After the following operations, what will be the positions of front and rear? | ||||||
| Insert(Q,X), Insert(Q,Y), Remove(Q), Insert(Q,Z) Insert(Q,D), Insert(Q,E) |
- Rear =1, Front = 1
- Rear = 1, Front = 7
- Rear = 1, Front = 2
- Queue overflows
Given a circular queu
| Rear | Front | |||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| A | B | C | ||||
| After the following operations, what will be the positions of front and rear? | ||||||
| Insert(Q,X), Insert(Q,Y), Remove(Q), Insert(Q,Z) |
- Rear = 6, Front = 1
- Rear = 6, Front = 7
- Rear = 7, Front = 1
- None of these