Stack MCQ : Basics of Stack ( Multiple Choice Questions)
Question 1 |
User perform following operations on stack of size 5 then -
push(1); pop(); push(2); push(3); pop(); push(4); pop(); pop(); push(5);at the end of last operation, total number of elements present in the stack are -
3 | |
1 | |
2 | |
4 |
Question 2 |
In order to keep track of current topmost element of the stack we need to maintain one variable.
False | |
True |
Question 3 |
Consider Stack is implemented using the array.
#define MAX 10 struct STACK { int arr[MAX] int top = ___________; }What will be the initial value with which top is initialized.
Garbage | |
1 | |
0 | |
-1 |
Question 4 |
Consider Stack is implemented using the array.
#define MAX 10 struct STACK { int arr[MAX] int top = -1; }In this implementation of stack maximum value of top which cannot cause overflow will _________.
11 | |
9 | |
10 | |
Any Other |
Question 5 |
User perform following operations on stack of size 5 then -
push(1); pop(); push(2); push(3); pop(); push(2); pop(); pop(); push(4); pop(); pop(); push(5);Which of the following is correct statement for stack ?
Overflow Occures | |
Underflow Occures | |
Stack Operations will be performed Smoothly | |
None of these |
Question 5 Explanation:
Before Pushing 4 we have only 1 element in the stack. We are popping 2 elements from the stack thus underflow of stack occurs.
There are 5 questions to complete.