# Data Structures &Algorithms(DSA) Stacks MCQ's Question Set 3

0 like 0 dislike
1.4k views

edited

MCQ's on Stacks along with answers most frequently asked in both the company's placement prepratation and college semester examinations.

### For Indian Students- INR 570/- || For International Students- \$12.99/-

S.No.

Course Name

Apply Coupon

1.

Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence

Apply Coupon

2.

Computer Vision with OpenCV | Deep Learning CNN Projects

Apply Coupon

3.

Complete Machine Learning & Data Science with Python Apply Coupon

4.

Natural Language Processing-NLP with Deep Learning in Python Apply Coupon

5.

Computer Vision OpenCV Python | YOLO| Deep Learning in Colab Apply Coupon

6.

Complete Python Programming from scratch with Projects Apply Coupon

0 like 0 dislike
by (562 points)
selected

1) Define stack.

Ans:A stack is an ordered collection of homogenous data elements where the insertion and deletion operations occurs at only one end.

2) Stack is based on the principle

a) LIFO

b) FIFO

c) sequential

d) none of these

Ans:a(LIFO)

3) The process of pulling a new data element on to stack is known as

a) Push

b) Pop

c) Status

d) None of these

Ans:a(Push)

4) Define pop operation in stack.

Ans:Accessing the content while removing it from the stack is known as pop operation.

5) The condition top<1 when top=1; is for

a) Pop operation

b) Push operation

c) Status

d) none of these

Ans:a(Pop operation)

6) Name some applications of stack.

Ans:

• Evaluation of arithmetic expression
• Code generation for stack machine.
• Backtracking.
• Decimal to binary conversion

7) The operator placed in between two operance is

a) Infix expression

b) Postfix expression

c) Prefix expression

d) none of these

Ans:a(Infix expression)

8) How do you generate code for stack machines?

Ans:Stack machine is a machine which use a stack instead of registers to store intermediate results temporaries. Using a stack, we can easily generate an assembly code from a postfix notation.

9) Dicuss reversing a list of items in stack.

Ans:Reversing data requires that a given set of data will reordered. So that the first and last elements are exchanged, with are of the positions between the first and last being relatively exchanged also.

10) The set of statements which are executed repeatedly until some specified condition is satisfied called

a) Iteration

b) Recursion

b) Monolithic program

d) none of these

Ans:a(iteration)

11) What are indirect applications of stacks?

Ans:

• Auxiliary data structure for other algorithms such as tree traversal algorithms.
• Components of other data structures such as simulating queues.

12) What is the ammortized time of push operation in doubling strategy?

a) O(1)

b) logn

c) O(1) [O(n) /n]

d) none of these

Ans:c( O(1) [O(n) /n])

13) Can we evaluate the infix expression with stacks in one pass?

Ans:Using two stacks we can evaluate an infix expression in one pass without converting to postfix.

14) The number of stack permutations with n symbols is represented by?

a) Catalan number

b) int

c) float

d) none of these

Ans:a(Catalan Number)

15) On a given machine, how do you check whether the stack grows up or down?

Ans:Try noting down the address of a local variable. Call another function with a local variable declared in it and check the address of that local variable and compare.

16) What type of data structure does a Stack is?

a)Linear

b)non-linear

c)both A&B

d) none of these

Ans:a(linear)

17)The representation of stack can be done in

a)One way

b)Two ways

c)Three

d)none

Ans:b(two ways)

18)From the below listed options, which will you use to convert infix to postfix/prefix operators.

a) Queue

b)Stack

d)none

Ans:b(stack)

19)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

Ans:d(All of the above)

20)The postfix form of A*B+C/D is?

a) *AB/CD+

b) AB*CD/+

c)A*BC+/D

d) ABCD+/*

Ans:b(AB*CD/+)