Data Structure Multiple choice Questions and Answers on Stack Operations


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

a) Create
b) Push
c) Evaluation
d) Pop
Answer: b

Explanation: Self Explanatory.
2. Process of removing an element from stack is called __________

a) Create
b) Push
c) Evaluation
d) Pod
Answer: d

Explanation: Self Explanatory.
3.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
Answer: a

Explanation: Self Explanatory.
4. Pushing an element into stack already having five elements and stack size of 5 , then stack becomes

a) Overflow
b) Crash
c) Underflow
d) User flow

Answer: a

Explanation: Self Explanatory.
5. 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.
Answer : d

Explanation: Self Explanatory.
6. Which of the following applications may use a stack?

a) A parentheses balancing program.
b) Tracking of local variables at run time.
c) Compiler Syntax Analyzer.
d) All of the mentioned
Answer: d

Explanation: All are applications of stack.
7. Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(())) are:

a) 1
b) 2
c) 3
d) 4 or more
Answer: c
Explanation: Applying the postfix expression evaluation.
8. Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order).
The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?

a) 1
b) 2
c) 3
d) 4 or more
Answer: b

Explanation: Applying the postfix expression evaluation.
9. 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
Answer: d

Explanation: On solving the postfix expression the answer comes out to 18.
10.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.
The maximum number of symbols that will appear on the stack AT ONE TIME during the conversion of this expression?

a) 1
b) 2
c) 3
d) 4
Answer: d

Explanation: Self Explanatory.
11. 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 /
Answer: a

Explanation: Applying the postfix expression evaluation.
12. The data structure required to check whether an expression contains balanced parenthesis is?

a) Stack
b) Queue
c) Array
d) Tree
Answer: a

Explanation: Self Explanatory.
13. What data structure would you mostly likely see in a non recursive implementation of a recursive algorithm?

a) Linked List
b) Stack
c) Queue
d) Tree
Answer: b

Explanation: Self Explanatory.
14. The process of accessing data stored in a serial access memory is similar to manipulating data on a ________

a) Heap
b) Binary Tree
c) Array
d) Stack
Answer: d

Explanation: Self Explanatory.
15. The postfix form of A*B+C/D is?

a) *AB/CD+
b) AB*CD/+
c) A*BC+/D
d) ABCD+/*
Answer: b

Explanation: Applying the postfix expression evaluation.
16. Which data structure is needed to convert infix notation to postfix notation?

a) Branch
b) Tree
c) Queue
d) Stack
Answer: d

Explanation: Self Explanatory.
17. The prefix form of A-B/ (C * D ^ E) is?

a) -/*^ACBDE
b) -ABCD*^DE
c) -A/B*C^DE
d) -A/BC*^DE
Answer: c

Explanation: Applying the prefix expression evaluation.
18. What is the result of the following operation
Top (Push (S, X))

a) X
b) Null
c) S
d) None
Answer: a

Explanation: Self Explanatory.
19. The prefix form of an infix expression p + q – r * t is?

a) + pq – *rt
b) – +pqr * t
c) – +pq * rt
d) – + * pqrt
Answer: c

Explanation: Applying the prefix expression evaluation.
20. Which data structure is used for implementing recursion?

a) Queue
b) Stack
c) Array
d) List
Answer: b

Explanation: Stacks are used for implementation of Recursion.
21. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?

a) 600
b) 350
c) 650
d) 588
Answer: b

Explanation: Self Explanatory.
22. Convert the following infix expressions into its equivalent postfix expressions
(A + B ⋀D)/(E – F)+G

a) (A B D ⋀ + E F – / G +)
b) (A B D +⋀ E F – / G +)
c) (A B D ⋀ + E F/- G +)
d) None of the mentioned
Answer: a

Explanation: Applying the postfix expression evaluation.
23. Convert the following Infix expression to Postfix form using a stack
x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal.

a) xyz*+pq*r+s*+
b) xyz*+pq*r+s+*
c) xyz+*pq*r+s*+
d) None of the mentioned
Answer: a

Explanation: Applying the postfix expression evaluation.
24. Which of the following statement(s) about stack data structure is/are NOT correct?

a) Linked List are used for implementing Stacks
b) Top of the Stack always contain the new node
c) Stack is the FIFO data structure
d) Null link is present in the last node at the bottom of the stack
Answer: c

Explanation: Stack follows LIFO.
25. Consider the following operation performed on a stack of size 5.
Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operation, the number of elements present in stack are

a) 1
b) 2
c) 3
d) 4
Answer: a

Explanation: Self Explanatory.
26. Which of the following is not an inherent application of stack?

a) Reversing a string
b) Evaluation of postfix expression
c) Implementation of recursion
d) Job scheduling
Answer: d

Explanation: Job Scheduling is not performed using stacks.
27. The type of expression in which operator succeeds its operands is?

a) Infix Expression
b) Prefix Expression
c) Postfix Expression
d) None of the mentioned
Answer: c

Explanation: Self Explanatory.
28. Assume that the operators +,-, X are left associative and ^ is right associative.
The order of precedence (from highest to lowest) is ^, X, +, -. The postfix expression for the infix expression a + b X c – d ^ e ^ f is

a) abc X+ def ^^ –
b) abc X+ de^f^ –
c) ab+c Xd – e ^f^
d) -+aXbc^ ^def
Answer: a

Explanation: Applying the postfix expression evaluation.
29. If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, what is the order of removal?

a) ABCD
b) DCBA
c) DCAB
d) ABDC
Answer: b

Explanation: Stack follows LIFO(Last In First Out).

Related

Multiple Choice Questions 5400662318801609412

Post a Comment

emo-but-icon

item