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
c)Linked List
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/+)