0

Data Structure Quiz 9

Attempted 0/25 Correct 0 Score 0

When linear queue of size MAXQUEUE were implemented in C, underflow occurs at

  1. Front = 0

  2. Rear = -1

  3. Rear = Front

  4. Rear - Front + 1 = 0


Correct Option: D

Let the getnode function is called when a node is required for insertion in a linked list. The overflow occurs when

  1. available list is empty

  2. available list is full

  3. available list is half full

  4. none of these


Correct Option: A

When linear queue of size MAXQUEUE were implemented in C, overflow occurs at

  1. Front = MAXQUEUE

  2. Rear = MAXQUEUE -1

  3. Rear = Front

  4. Rear - Front + 1 = 0


Correct Option: B

In a circular queue of size MAXQUEUE, overflow occurs at

  1. before incrementing rear, rear = front

  2. after incrementing rear, rear = front

  3. before incrementing rear, rear = front +1

  4. after incrementing rear, rear = front +1


Correct Option: B

Which among the following is not the correct difference between array and linked lists?

  1. Insertion in array is costlier whereas linked list is cheaper.

  2. Deletion in array is costlier whereas linked list is cheaper.

  3. Traversal in array is costlier whereas linked list is cheaper.

  4. Linked list requires more memory than array.


Correct Option: C

Which among the following algorithms requires the reverse of input string before processing through stacks?

  1. Infix to postfix conversion

  2. Infix to prefix conversion

  3. Postfix evaluation

  4. Prefix evaluation


Correct Option: B

Let the binary heap has depth equal to d. What is the minimum number of nodes in the heap?

  1. 2d+1 -1

  2. 2d+1

  3. 2d

  4. 2d -1


Correct Option: A

What is the value of A(5, 3)?

  1. 5

  2. 3

  3. 8

  4. 10


Correct Option: D

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?

  1. Equal to height of the tree

  2. Constant

  3. Number of nodes in the heap

  4. None of these


Correct Option: A

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?

  1. Infix to postfix conversion

  2. Infix to prefix conversion

  3. Postfix evaluation

  4. None of these


Correct Option: C

What is the value of A(15, 2)?

  1. 15

  2. 2

  3. 5

  4. 42


Correct Option: C

Gcd (18,60) = ?

  1. 9

  2. 3

  3. 6

  4. none of these


Correct Option: C

Gcd (20, 28) = ?

  1. 4

  2. 20

  3. 7

  4. 28


Correct Option: A

A descending priority queue is implemented by using linked list. Which of the following operations is the cheapest?

  1. Traversal

  2. Insertion

  3. Search

  4. Delete-Max


Correct Option: D

An ascending priority queue is implemented by using linked list. Which of the following operations is the cheapest?

  1. Traversal

  2. Insertion

  3. Delete-min

  4. Search


Correct Option: C

What is the total number of possible binary search tree with keys 20, 25 and 5?

  1. 4

  2. 3

  3. 5

  4. 6


Correct Option: C

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)

  1. 20

  2. 30

  3. 10

  4. 15


Correct Option: D

Let m and n be the integers and A(m,n) be a recursively defined function A(m,n)= 5
if m<n = A(m-n, n+2) if m ≥ n What is the value of A (2, 7)?

  1. 2

  2. 7

  3. 5

  4. None of these


Correct Option: C

Let the binary heap has depth equal to d. What is the minimum number of nodes in the heap?

  1. 2d+1 -1

  2. 2d+1

  3. 2d

  4. 2d -1


Correct Option: C

Let Gcd (m,n) be a recursively defined function as given below Gcd (n,m) m<n Gcd (m,n) = m n=0 Gcd(n,m%n) otherwise Gcd (6,15) = ?

  1. 6

  2. 15

  3. 3

  4. 0


Correct Option: C

In a circular queue of size MAXQUEUE, overflow occurs at

  1. Before incrementing rear, rear = front

  2. After incrementing rear, rear = front

  3. Before incrementing rear, rear = front +1

  4. After incrementing rear, rear = front +1


Correct Option: A

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)

  1. Rear = 6, Front = 3

  2. Rear = 7, Front = 4

  3. Rear = 7, Front = 3

  4. None of these


Correct Option: B

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)

  1. Rear = 7, Front = 4

  2. Rear =7, Front = 3

  3. Rear = 8, Front = 3

  4. Queue overflows


Correct Option: D

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)

  1. Rear =1, Front = 1

  2. Rear = 1, Front = 7

  3. Rear = 1, Front = 2

  4. Queue overflows


Correct Option: D

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)

  1. Rear = 6, Front = 1

  2. Rear = 6, Front = 7

  3. Rear = 7, Front = 1

  4. None of these


Correct Option: A
- Hide questions