Data Structures - Stacks

21:  

Stack A has the eintries 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 stack B can only be printed. In the arrangement, which of the following permutations of a, b, c is not possible?

A.

b a c

B.

b c a

C.

c a  b

D.

a b c

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:



22:  

The postfix equivalent of the prefix * + a b - c d is

A.

ab+cd-*

B.

ab cd + - *

C.

ab + cd * -

D.

ab + - cd *

 
 

Option: A

Explanation :

The tree whose preorder traversal yields * + A B – C D, is given in fig 6.18. Writer the post-order traversal of the tree. That is the postfix form.

Click on Discuss to view users comments.

Rishi said: (12:26am on Sunday 23rd June 2013)
Prefix Form : * ab-cdInfix Form : (a b)*(c-d)Postfix Form : ab cd-*

Write your comments here:



23:  

Stacks cannot be used to

A.

eevaluate an arithmetic expression  in postfix form

B.

iumplemen recursion

C.

convert a given arithmetic expression in infix form to its equivalent postfix form

D.

allocate resources (like CPU) by the operating system

 
 

Option: D

Explanation :

Click on Discuss to view users comments.

Write your comments here:



24:  

The postifx expression for the infix expression

A + B* (C+D) / F + D*E is

A.

AB+CD + *F/ D+E*

B.

ABCD + *F / + DE* +

C.

A*B + CD / F* DE ++

D.

A + *BCD/ F* DE ++

 
 

Option: B

Explanation :

Click on Discuss to view users comments.

Write your comments here:



25:  

Stack is useful for implemeting

A.

breadth first search

B.

depth first search

C.

recursion

D.

Both (b) & (c)

 
 

Option: D

Explanation :

Breadth first search  needs Queue for implementaion 
 

Click on Discuss to view users comments.

Write your comments here: