Data Structures - Stacks

11:   A postfix expression is merely the reverse of the prefix expression
A. True
B. False
C.
D.
 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here:



12:   Following sequence of operations is performed on a stack push(1),push(2),pop, push(1),push(2)pop,pop,pop,push(2),pop.The sequence of poped out values are
A. 2,2,1,1,2
B. 2,2,1,2,2
C. 2,1,2,2,1
D. 2,1,2,2,2
 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Gaurav Dutt said: (3:49pm on Saturday 18th May 2013)
push:- 1,2; Stack:- 1,2pop:- 2; Stack:- 1;push:- 1,2; Stack:- 1,1,2;pop,pop,pop:- 2,1,1; Stack:- becomes empty;push:- 2; Stack:- 2;pop:- 2; Stack:- becomes empty;Sequence of pop:- 2,2,1,1,2

Write your comments here:



13:   In eveluating the arithmetic expression 2*3-(4+5),using stacks to evaluate its equivalent postfix form, which of the following stack configuration is not possible?
A. 4 6
B. 5 4 6
C. 9 6
D. 9 3 2
 
 

Option: D

Explanation :
The postfix equivallent is 2 3 * 4 5 + -.
For evaluating this using stack,starting from the left,we have to scan one by one, if it is an operand push.
If it is an operator, pop it twice,apply operator on the poppedout entries and push the result onto the stack.
If we follow this,we can find configuration in option(d)is not possible

Click on Discuss to view users comments.

Write your comments here:



14:   Stack A has the entries a,b,c(with a on top).
Stack B is empty.An entry popped out of stack A can be printed immediately or pushed to stack B.An entry popped out of the stack B can only be printed. In this arrangement, which of the following permutations of a,b,c are not possible?
A. b a c
B. b c a
C. c a b
D. c b a
 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:



15:   The expression which accesses the (ij)th entry of am x n matrix stored in column majorform is
A. n x (i-1)+j
B. m x (j-1)+i
C. m x (n-j)+j
D. n x (m-i)+j
 
 

Option: B

Explanation :

Click on Discuss to view users comments.

Write your comments here: