0% found this document useful (0 votes)
85 views8 pages

Multile Choice Questions - Unit - 3

The document contains a multiple choice quiz on data structures concepts like stacks, queues, lists, trees, and their applications. There are 41 questions testing understanding of topics like: - Representing expressions in infix, prefix, and postfix notations - Implementing stacks and queues using arrays vs linked lists - Differences between stacks and queues in allowed operations - Applications of stacks and queues like function calls, arithmetic evaluation, FIFO ordering

Uploaded by

Harshad Lokhande
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views8 pages

Multile Choice Questions - Unit - 3

The document contains a multiple choice quiz on data structures concepts like stacks, queues, lists, trees, and their applications. There are 41 questions testing understanding of topics like: - Representing expressions in infix, prefix, and postfix notations - Implementing stacks and queues using arrays vs linked lists - Differences between stacks and queues in allowed operations - Applications of stacks and queues like function calls, arithmetic evaluation, FIFO ordering

Uploaded by

Harshad Lokhande
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

MULTILE CHOICE QUESTIONS (Unit III)

1. The term "push" and "pop" is related to the


(a) array (b) lists
(c) stacks (d) all of above
2. A data structure where elements can be added or removed at either end but not in the middle is
called 
(a) linked lists (b) Stacks
(c) queues (d) dequeue
3. The Infix equivalent of the prefix * + ab − cd is 
(a) (a+b) * (c−d) (b) (a+b) − (c*d)
(c) (a*b)−(c+d) (d) (a−b)*(c+d)
4. The postfix equivalent of the prefix * + ab− cd is 
(a) ab + cd − * (b) abcd + − *
(c) ab + cd * − (d) ab + − cd *
5. The postfix equivalent of the infix expression a+b+c+d is  
(a) abcd+++ (b) ab+c+d+
(c) ab+cd++ (d) (a−b)*(c+d)
6. The prefix equivalent of the infix expression a+b+c+d is 
(a) +ab+c+d (b) +++abcd
(c) ++ab+cd+ (d) abcd++++
7. The postfix equivalent of the infix expression a+b/c*d−e/f is 
(a) ab+cd*/ef−/ (b) abcd*+/ef−/
(c) ab+cd*/ef/− (d) abc/d*+ef/−
8. The prefix equivalent of the infix expression a+b/c*d−e/f is 
(a) +abc−*/ef (b) +/*−/abcdef
(c) −+a*/bcd/ef (d) +a*/bcd−/ef
9. The postfix equivalent of the infix expression a+b/c−d*e−f is 
(a) abc/+de*−f− (b) abcd*+/ef−/
(c) ab+cd*/ef/− (d) abc/d*+ef/−
10. The prefix equivalent of the infix expression a+b/c−d*e−f is 
(a) +abc−*/ef (b) −−+a/bc*def
(c) −+a*/bcd/ef (d) +a*/bcd−/ef
11. The infix equivalent of the postfix ab+cd+ef*−/ is 
(a) ((a+b)/( (c+d))−(e*f))) (b) (a+b) − (c+d)/(e*f)
(c) (a+b)*(c+d)−(e/f) (d) ((a+b)/(c+d))−(e*f)
12. The infix equivalent of the postfix ab*cd/+e− is 
(a) a+b*c/d−e (b) a*b+c/d−e
(c) (a*b)−(c/d)+e (d) a*b−c/d+e
13. The prefix equivalent of the postfix ab*cd/+e− is 
(a) +−/abc*de (b) −+*abc/de
(c) −+*ab/cde (d) *ab/+cd−e
14. Pick the correct prefix form to the given infix expression:
  {a*[b/(c−d)*f]/g}/[e+h]
(a)  //*a/b*−cdfg+ch (b) abcd−f*/g/*eh+/            
(c) //*a*/b−cdfg+eh (d) //*ab*/−cdfg+eh                                
15. Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n
elements. Assume that the insertion and deletion operation are carried out using REAR and
FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to
detect queue full and queue empty are
(a) Full: (REAR+1) mod n == FRONT, empty: REAR == FRONT
(b) Full: (REAR+1) mod n == FRONT, empty: (FRONT+1) mod n == REAR
(c) Full: REAR == FRONT, empty: (REAR+1) mod n == FRONT
(d) Full: (FRONT+1) mod n == REAR, empty: REAR == FRONT
16. Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
What is the maximum number of parentheses that will appear on the stack AT ANY ONE TIME
when the algorithm analyzes: (()(())(()))
(a) 4 (b) 3
(c) 2 (d) 6
17. Suppose we have an array implementation of the stack class, with ten items in the stack stored
at data[0] through data[9]. The SIZE is 42. Where does the push function place the new entry in
the array?
(a) data[0]               (b) data[1]              
(c) data[9]               (d) data[10]       
18. If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then removed one at a
time, in what order will they be removed?
(a) ABCD (b) ABDC
(c) DCAB (d) DCBA
19. What data structure is used to perform recursion?
(a) Stack (b) Queue
(c) Linked List (d) Arrays
20. For the expression ((A + B) * C – (D – E)/(F + G)), the equivalent Postfix notation is
(a) AB + C * DE −− / FG + (b) AB + C * DE − FG + /−
(c) AB + C * DE −− FG + / (d) AB + C − DE − * FG + /

21. Which data structure allows deleting data elements from front and inserting at rear?


(a) Stacks  (b) Queues 
(c) Deques  (d) Binary search tree
22. Identify the data structure which allows deletions at one end of the list but insertion anywhere
(a) Input−restricted deque
(b) Output−restricted deque
(c) Priority queues
(d) None of above
23. One difference between a queue and a stack is 
(a) Queue can be implemented using linked lists, but stack cannot
(b) Stack can be implemented using linked lists, but queues cannot
(c) Queues use two ends of the structure; stacks use only one
(d) Stacks use two ends of the structure, queues use only one
24. Suppose we have a circular array implementation of the queue, with ten items in the queue
stored at data[2] through data[11], the current capacity is 12. Where does the insert method
place the new entry in the array?
(a) data[1] (b) data[0]
(c) data[11] (d) data[12]
25. If we have implemented the queue with a linked list, keeping track of a front node and a rear
node with two reference variables. Which of these reference variables will change during an
insertion into a NONEMPTY queue?
(a) Neither changes (b) Only front changes
(c) Only rear changes (d) An exception is caused
26. If we have implemented the queue with a linked list, keeping track of a front node and a rear
node with two reference variables. Which of these reference variables will change during
deletion into NONEMPTY queue?
(a) Neither changes (b) Only front changes
(c) Only rear changes. (d) An exception is caused
27. If we have implemented the queue with a linked list, keeping track of a front node and a rear
node with two reference variables. Which of these reference variables will change during an
insertion into a EMPTY queue?
(a) Neither changes
(b) Only front changes
(c) Only rear changes
(d) Both front and rear change
28. Queues and Stacks can be implemented using either arrays or linked lists.
(a) True (b) False
29. In order to input a list of values and output them in order, you could use a Queue.
(a) True (b) False
30. In order to input a list of values and output them in opposite order, you could use a Stack.
(a) True (b) False
31. Which of the following is not the type of queue?
(a) Ordinary queue (b) Single ended queue
(c) Circular queue (d) Priority queue
32. Which is/are the application(s) of stack?
(a) Function calls (b) Parentheses check
(c) Evaluation of arithmetic expressions (d) All of the above
33. Stack is also called as
(a) Last in first out (b) First in last out
(c) Last in last out (d) First in first out
34. Queue is also called as
(a) Last in first out (b) First in last out
(c) Last in last out (d) First in first out
35. is very useful in situation when data have to stored and then retrieved in reverse order.
(a) Stack (b) Queue
(c) List (d) Link list
36. Consider the following pseudo code :
declare a stack of characters
while (there are more characters in the word to read)
{
read a character
push the character on the stack
}
while ( the stack is not empty )
{
pop a character off the stack
write the character to the screen
}
What is written to the screen for the input "carpets"?
(a) serc (b) carpets
(c) steprac (d) ccaarrppeettss
37. In the linked list implementation of the stack, where does the push method place the new entry
on the linked list?
(a) Before the first node
(b) At the end of last node
(c) After all other entries that are greater than the new entry.
(d) After all other entries that are smaller than the new entry.
38. What is the value of the postfix expression 6 3 2 4 + − *
(a) 18 (b) −18
(c) 15 (d) Invalid expression
39. What is the value of the postfix expression 23456*+−/
(a) 16 (b) −18
(c) − 15 (d) Invalid expression
40. What is the value of the postfix expression 23456*+−
(a) 16 (b) −18
(c) 15 (d) Invalid expression
41. Here is an infix expression: 4+3*(6*3−12). Suppose that we are using the usual stack algorithm
to convert the expression from infix to postfix notation. What is the maximum number of
symbols that will appear on the stack AT ONE TIME during the conversion of this expression?
(a) 5 (b) 2
(c) 3 (d) 4
42. The postfix form of the expression (A+ B)*(C*D− E)*F / G is
(a) AB+ CD*E − FG /** (b) AB + CD* E − F **G /
(c) AB + CD* E − *F *G / (d) AB + CDE * − * F *G /
43. A linear list of elements in which deletion can be done from one end (front) and insertioncan
take place only at the other end (rear) is known as a
(a) Queue (b) Stack
(c) Tree (d) Linked List
44. The data structure required to evaluate a postfix expression is
(a) Queue (b) Stack
(c) Array (d) Linked−list
45. What data structure would you mostly likely see in a nonrecursive implementation of a recursive
algorithm?
(a) Queue (b) Stack
(c) Array (d) Linked−list
46. The postfix form of A*B+C/D is
(a) *AB/CD+ (b) AB*CD/+
(c) A*BC+/D (d) ABCD+/*
47. What is the postfix form of the following prefix *+ab–cd
(a) ab+cd–* (b) abc+*–
(c) ab+*cd– (d) ab+*cd–
48. Which data structure is needed to convert infix notation to postfix notation?
(a) Branch (b) Queue
(c) Tree (d) Stack
49. What is the result of the following operation done on stack S which is not full?
push (&S, 10); x = pop (&S); where S is a structure containing array and top
(a) x = −1 (b) x = 10
(c) x = Null (d) Error
50. The prefix form of an infix expression p + q − r * t is
(a) + pq − *rt (b) − +pqr * t
(c) − +pq * rt (d) − + * pqrt
51. The equivalent prefix expression for the following infix expression (A+B)−(C+D*E)/F*G is
(a) −+AB*/+C*DEFG (b) /−+AB*+C*DEFG
(c) −/+AB*+CDE*FG (d) −+AB*/+CDE*FG
52. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is
(a) 600 (b) 350
(c) 650 (d) 588
53. The meaning of FIFO is  and it stands for 
(a) First In Fast Out, Stack
(b) First In First Out, Stack
(c) First In First Out, Queue
(d) First In Fast Out, Queue
54. The meaning of LIFO is  and it stands for 
(a) Last In First Out, Queue (b) Last In First Out, Stack
(c) Last In Fast Out, Stack (d) Last In First Out, Priority Queue
55. Adding data to stack is called 
(a) Push (b) Pop
(c) Insert (d) Delete
56. Items can be removed from both ends of 
(a) queue (b) stack
(c) tree (d) dequeue
57. In linked list each node consists of 
(a) data and link to next node
(b) data only
(c) link only
(d) address of first node
58. In linked lists there are no NULL links in 
(a) circular linked list (b) singly linked list
(c) doubly linked list (d) empty linked list
59. In stack, the command to access the element at top is 
(a) x = pop( ); (b) pop(x);
(c) pop(top); (d) top=pop( );
60. The result of evaluating prefix expressions *+++abcdc where, a = 1, b = 2, c = 3 and d = 4 is

(a) 10 (b) 12
(c) 30 (d) 18
61. The dummy header in linked list contains 
(a) first record (b) last record
(c) link to first record (d) link to last record
62. If the sequence of operations (push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2),
pop), are performed on a stack, the sequence of popped out values are 
(a) 2, 2, 1, 1, 2 (b) 2, 2, 1, 2, 2
(c) 2, 1, 2, 2, 1 (d) 2, 1, 2, 2, 2
63. In evaluating the arithmetic expression 2 * 3 − (4 + 5), using stacks to evaluate its equivalent
post-fix form, which of the following stack configuration is not possible?

(a (b) 5 (c) (d) 9


)
4 4 9 3
6 6 6 2
64. The postfix expression for the infix expression
A + B* (C + D) / F + D*E is 
(a) AB + CD + *F / D + E* (b) ABCD + *F / + DE* +
(c) A*B + CD / F*DE ++ (d) A + *BCD / F*DE ++
65. Which of the following is essential for converting an infix expression to the postfix form
efficiently?
(a) An operator stack (b) An operand stack
(c) An operator stack and an operand stack(d) A parse tree
66. Identify the data structure which allows deletions at one end of the list but insertion at both
ends.
(a) Input−restricted deque
(b) Output−restricted deque
(c) Priority queues
(d) None of above
67. Identify the data structure which allows deletions at both end of the list but insertion at one
end.
(a) Input−restricted deque
(b) Output−restricted deque
(c) Priority queues
(d) None of above
68. Identify the data structure which allows deletions as per the priority.
(a) Input−restricted deque
(b) Output−restricted deque
(c) Priority queues
(d) dequeue
69. In array implementation of stack stack full condition is
(a) top equal to one less than size of stack
(b) top is equal to 0
(c) top is equal to NULL
(d) top is equal to −1

1. (c) 2. (d) 3. (a) 4. (a) 5. (b) 6. (b) 7. (d) 8. (c) 9. (a) 10. (b)
11. (a) 12. (b) 13. (c) 14. (c) 15. (a) 16. (b) 17. (c) 18. (d) 19. (a) 20. (b)
21. (b) 22. (c) 23. (d) 24. (b) 25. (c) 26. (b) 27. (d) 28. (a) 29. (a) 30. (a)
31. (a) 32. (d) 33. (a) 34. (d) 35. (a) 36. (a) 37. (a) 38. (b) 39. (c) 40. (d)
41. (d) 42. (a) 43. (a) 44. (b) 45. (b) 46. (b) 47. (a) 48. (d) 49. (b) 50. (c)
51. (a) 52. (b) 53. (c) 54. (b) 55. (a) 56. (d) 57. (a) 58. (a) 59. (a) 60. (c)
61. (c) 62. (a) 63. (d) 64. (b) 65. (a) 66. (b) 67. (a) 68. (c) 69. (c)

You might also like