Prentice-Hall     Addision-Wesley

Copyright © 2007 Gradiance Corporation.

 

Gradiance Online Accelerated Learning

 

 

 

 

 

     

Parse Trees

 

 



1.  

Which of the parse trees below yield the same word?

http://www.gradiance.com/phmu/pictures/ullman_6parsetrees.gif

 

 

 

 a) 

a and d

 

 b) 

a and c

 

 c) 

a and b

 

 d) 

a and f

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2.  

The folowing is a parse tree in some unknown grammar G:

http://www.gradiance.com/phmu/pictures/ullman_parsetree1g.gif

Which of the following productions is definitely not a production of G?

 

 

 

 a) 

A → aS

 

 b) 

B → CD

 

 c) 

None of the other choices.

 

 d) 

A → b

 

 

 

 

 

3.  

Which of the following is a parse tree for the grammar

S → abS, S → ab

http://www.gradiance.com/phmu/pictures/ullman_6parsetrees.gif

 

 

 

 a) 

(b)

 

 b) 

(e)

 

 c) 

(d)

 

 d) 

(a)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4.  

Here is a parse tree that uses some unknown grammar G.

http://www.gradiance.com/phmu/pictures/ullman_parsetree1g.gif

Which of the following productions is surely one of those for grammar G?

 

 

 

 a) 

B → AS

 

 b) 

S → B

 

 c) 

S → AB

 

 d) 

A → S

 

 

 

 

 

5.  

The parse tree below represents a rightmost derivation according to the grammar

S → AB, A → aS|a, B → bA

http://www.gradiance.com/phmu/pictures/ullman_parsetree1g.gif

Which of the following is a right-sentential form in this derivation?

 

 

 

 a) 

aababA

 

 b) 

aABba

 

 c) 

aaBB

 

 d) 

aabAba