## Data Structure MCQ - Stack

This section focuses on the "Stack" of the Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. Which one of the following is an application of Stack Data Structure?

A. Managing function calls
B. The stock span problem
C. Arithmetic expression evaluation
D. All of the above

2. Process of inserting an element in stack is called ____________.

A. Create
B. Push
C. Evaluation
D. Pop

3. The postfix form of A*B+C/D is?

A. *AB/CD+
B. AB*CD/+
C. A*BC+/D
D. ABCD+/*

4.Which of the following is true about linked list implementation of stack?

A. In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.
B. In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.
C. Both of the above
D. None of the above

5.In a stack, if a user tries to remove an element from empty stack it is called _________.

A. Underflow
B. Empty collection
C. Overflow
D. Garbage Collection

6. Consider the following pseudocode that uses a stack
declare a stack of characters
while ( there are more characters in the word to read )
{
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 output for input "letsfindc"?

A. letsfindcletsfindc
B. cdnifstel
C. letsfindc
D. cdnifstelcdnifstel

7.Entries in a stack are “ordered”. What is the meaning of this statement?

A. A collection of stacks is sortable
B. Stack entries may be compared with the '<' operation
C. The entries are stored in a linked list
D. There is a Sequential entry that is one by one

8. The prefix form of A-B/ (C * D ⋀ E) is?

A. -/*⋀ACBDE
B. -ABCD*⋀DE
C. -A/B*C⋀DE
D. -A/BC*⋀DE

9.Following is an incorrect pseudocode for the algorithm which is supposed to determine whether a sequence of parentheses is balanced:
declare a character stack
while ( more input is available)
{
if ( the character is a '(' )
push it on the stack
else if ( the character is a ')' and the stack is not empty )
pop a character off the stack
else
print "unbalanced" and exit
}
print "balanced"
Which of these unbalanced sequences does the above code think is balanced?

A. ((())
B. ())(()
C. (()()))
D. (()))()

10.What is the value of the postfix expression 6 3 2 4 + – *:

A. Something between -5 and -15
B. Something between 5 and -5
C. Something between 5 and 15
D. Something between 15 and 100