You are on page 1of 1

CS200 Quiz 3: Grammars & Stacks (9/9/14)

b. A derivation tree is another representation


[20 pts per question]
of a grammar.
1. Given the grammar G=(V,T,S,P) where
c. All grammars can be expressed as regular
V={0,1,S,A}, T={0,1} and P is:
expressions.
0 11
d. Regular expressions are defined over sets.
|00
4. Circle one: If these ints (6, 2, 5, 1, 9) are added
Which describes the language?
to a stack in the order given, which will be the
a. Strings of all 0s or all 1s
first to be removed:
b. Strings with an odd number of 0s and even
a. 6
number of 1s
b. 2
c. Strings with two 1s followed by 0s or 1s
c. 1
d. None of the above
d. 9
2. Circle all that are true: In a grammar,
5. Circle all that are true:
a. means 0 or more xs.
a. Because a stack can be implemented using
b. Non-terminals cannot appear in the left
an ArrayList, all of the standard ArrayList
hand side of productions.
methods are available to the user of the
c. Terminals are part of the vocabulary.
stack.
d. S must be the starting non-terminal.
b. The item removed first from a stack is called
the top.
3. Circle all that are true:
c. Stacks are used to track recursion.
a. A derivation shows how a string could be
d. Stacks are always implemented using an
produced from a grammar.
ArrayList.

You might also like