CHAPTER-3
STACKS
1. A mechanism to store, organize and access data along with operations
that can be efficiently performed on the data is
a) datatype b) data structure
c) data list d) data collection
2. Which of the following an example of a data structure?
a) print b) string c) function d) for loop
3. What type of data structure is string?
a) It contains sequence of characters
b) It contains sequence of integers
c) It is nonlinear data structure
d) It contains elements with mixed datatype.
4. A data structure that contains sequence of elements where each
character is
a) int b) float c) list d) string
5. A sequence data structure in which each element may be of different
types is
a) int b) float c) list d) string
6. LIFO stands for
a) Last in Front Out b) Left In First Out
c) Last In First Out d) Last In Forward Out
7. Which data structure follows Last-In-First-Out principle? (E)
a) Queue b) Stack c) Deque d) integer
8. The principle of stack is
a) FILO b) LILO c) FIFO d) LIFO
9. Stack implements which of the following arrangement
a) FILO b) LILO c) FIFO d)LIFO
10. Which of the following is the application uses LIFO principle
a) Confirmation of train ticket is in waiting list
b) Calling customer service centre through IVRS, waiting till a support person
is available (c) Sending print commands from multiple files using shared
printer. d) Bangles worn on wrist
11. Which of the following statement is correct about stack?
a) Addition of new element is from front , removal of existing element is from
rear end
b) Addition of new element is from rear, removal of existing element is from
front end
c) Addition of new element and removal of existing element happens from
middle.
d) Addition of new element, removal of existing element takes place at same
end TOP.
12. Which statement is not correct about stack?
a) Stack is a linear data structure
b) Stack does not follow LIFO rule
c) PUSH operation may result into overflow condition
d) Stack is used to reverse a string
13. The arrangement of elements in linear order where adding new
elements or removal of existing elements take place from the same end
a) Stack b) Queue c) Deque d) Deck
14. In stack data structure, from which end does addition of new
elements and removal of existing elements take place?
a) END b) TOP c) REAR d) TAIL
15. The fundamental operations performed on the stack are
a) insert,delete b) push,pop c) push,delete d) insert,pop
16. Which operation adds a new element to the TOP of the stack? (E)
a) Push b) Pop c) Peek d) insert
17. Addition of new element at the TOP of the stack is called
a) Push b) Peek c) Pop d) overflow
18. Which operation is used to remove an element from the Top of the
stack?
a) Push b) Pop c) Peek d) Is Empty
19. Removal of existing element from TOP of the stack is called as
a) push b) peek c) pop d) overflow
20. Trying to add an element to a full stack results in which exception?
a) overflow b) underflow c) peek d) empty stack
21. Trying to delete an element from an empty stack results in an
exception called
a) overflow b) peek c) underflow d) full stack
22. Which exception will occur when trying to add an element to a full
stack?
a) overflow b) underflow c) peek d) empty stack
23. Which exception will occur when trying to remove an existing element
from an empty stack?
a) overflow b) underflow c) peek d) full stack
24. Which datatype is used to implement stack in python? (D)
a) string b) int c) float d) list
25. Which built-in method is used to insert a new element to Top of the
stack in python?
a) insert b) add c) append d) insert
26. Which built-in method is used to remove an existing element from the
stack in python?
a) pop b) delete c) free d) remove
27. Which of the following operation can result in stack overflow
exception?
a) Trying to add an element to a full stack
b) Trying to add an element to an empty stack
c) Trying to delete an element from an empty stack
d) Trying to delete an element from full stack
28. Which of the following operation can result in stack underflow
exception?
a) Trying to add an element to a full stack
b) Trying to add an element to an empty stack
c) Trying to delete an element from an empty stack
d) Trying to delete an element from a full stack
29. In which condition, stack overflow exception occurs?
a) Stack is full and append( ) is called
b) Stack is empty and append( ) is called
c) Stack is full and pop( ) is called
d) Stack is empty and pop( ) is called
30. In which condition stack underflow exception occurs?
a) Stack is full and append( ) is called
b) Stack is empty and append( ) is called
c) Stack is full and pop( ) is called
d) Stack is empty and pop( ) is called
31. If elements 10, 20,30,40 are inserted to the stack ,Which is the
correct order in which elements are popped?
a) 10, 20,30,40 b) 20, 30, 40,10 c) 30,40,10, 20 d) 40, 30, 20,10
32. Which data structure is used to convert an expression in postfix
notation?
a) queue b) stack c) deque d) string
33. Which built-in methods are used for implementing stack data
structure in python?
a) push, pop b) insert, delete c) append, pop d) append, remove
34. Who introduced a different way of representing arithmetic expression
called polish notation?
a) Charles Babbage b) Dennis Richtie
c) Ken Thompson d) Jan Lukasiewicz
35. Multiple chairs in a vertical pile is an application of which data
structure?
a) Stack b) Queue c) String d) List
36. Which data structure is used to convert an infix expression to postfix?
a) Stack b) Queue c) String d) List
37. Which data structure is used to handle matching of parentheses in
arithmetic expression?
a) Stack b) Queue c) String d) List
38. Which data structure is used to convert an infix expression to postfix
or prefix expression?
a) Stack b) Queue c) String d) List
39. Which rule is used to evaluate an infix expression?
a) BODMAS b) FIFO c) LIFO d) LILO
40. In which notation operators are written before their operands?
a) infix b) polish c) reverse polish d) postfix
41. The other name of prefix notation is
a) infix notation b) suffix notation
c) polish notation d) reverse polish notation
42. The other name of postfix notation is
a) infix notation b) polish notation
c) reverse polish notation d) suffix notation
43. The other name of polish notation is
a) infix notation b) prefix notation
c) postfix notation d) suffix notation
44. The other name of reverse polish notation is
a) infix notation b) polish notation
c) reverse polish notation d) suffix notation
45. X+Y, Which representation is followed in the given expression
a) infix b) postfix c) polish d) prefix
46. The prefix notation of x+y is
a) xy+ b) (x+y) c) +xy (E) d) (xy+)
47. The postfix notation of x*y is
a) xy* b)(*xy) c) *xy d) (x*y)
48. Evaluate the following postfix expression and find the result of 78*+2
a) 56 b) 112 c) 23 d) 65
49. Assertion(A): Stack follows the Last-In-First-Out
Reason (R): The new element is added and an existing element is
removed from the same end
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
50. Assertion(A): Stack follows the FIFO order
Reason (R): In stack a new element is added and an existing element is
removed from the one end only
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
51. Assertion(A): Stack follows the First-In-First-Out principle
Reason (R): The new element is added and an existing element is
removed from the same end
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
52. Assertion(A):Stack data structure is used to reverse a string
Reason(R): The principle of stack is LIFO
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
53. Assertion(A): Stack data structure is used to reverse a string
Reason (R): The new element is added and an existing element is
removed from the same end
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
54. Assertion(A):Stack data structure is used to reverse a string
Reason(R): The principle of stack is FIFO
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
55. Assertion(A):Stack data structure is used to redo/undo editing of text
/image in text / image editor
Reason(R): The principle of stack is FIFO
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
56. Assertion(A): Stack data structure is used to redo/undo editing of
text/image in text / image editor
Reason(R): The principle of stack is LIFO
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
57. Assertion(A): Stack data structure is used to maintain the history of
browsed pages
Reason(R): The principle of stack is LIFO
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
58. Assertion(A): Stack data structure is used to maintain the history of
browsed pages
Reason(R): The principle of stack is FIFO
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
59. Assertion(A): Stack follows LIFO rule
Reason(R): Insertion and deletion takes place at different ends.
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
60. Assertion(A): Stack data structure is used in accessing link of the last
visited webpage. Reason(R): The ordering principle is FIFO
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason
61. Assertion(A):append() and pop() built-in methods are used in python
implementation of stack.
Reason(R): Stack is linear arrangement of elements where insertion and
deletion takes place at the same end.
a) A is true, R is correct reason b) A is true, R is not correct reason
c) A is false, R is correct reason d) A is false, R is not correct reason