Page 134 - DCAP407_DATA_STRUCTURE
P. 134
Unit 7: Stacks
2. Fill in the blanks:
(a) No element can be inserted when the status of the stack is ……………….
(b) In a stack, the items can be added or removed only from the ………………..
(c) The ……………… operation adds an element on the top of the stack.
3. Select a suitable choice for every question:
(a) After every push operation the top is incremented by …………………
(i) 2
(ii) 3
(iii) 1
(iv) 4
(b) Pushing an element into a stack that is full results in a condition called ……………………..
(i) Stack full
(ii) Stack overfull
(iii) Stack overflow
(iv) Stack underflow
(c) Static stack implementation can be achieved using ………………
(i) Linked list
(ii) Array
(iii) Queue
(iv) Structure
7.8 Review Questions
1. “Static implementation of stack can be achieved using arrays”. Explain with a program.
2. “Stacks are represented in main memory using two ways”. Discuss with a program.
3. “The static allocation in a stack is an inefficient memory allocation technique”. Provide a solution
to this problem with an example.
4. “In static stack implementation, when the array is full, the status of stack is FULL and the
condition is called stack overflow”. Discuss.
5. “The pop operation cannot be performed when the status of the stack is underflow”. Discuss with
an example.
LOVELY PROFESSIONAL UNIVERSITY 127