


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Answer the following TRUE/FALSE questions: All non-deterministic finite state automatons can be converted to a deterministic finite state automaton: TRUE An object-oriented program is easier to read and understand than a conventional procedural program: TRUE The class of the value assigned to the this variable in a method is the class within which the method is declared: FALSE A Java method signature does not include the return type: TRUE A transient instance variable in Java is not written to persistent storage if the object is output: TRUE The class of the Class object is Class : TRUE A regular expression can specify the set anbn^ where 0<n<5, that is {ab, aabb, ..., aaaabbbb}: TRUE A shift reduce parser performs reductions in the reverse order specified by a left-most derivation: FALSE The string aabb is a sentential form for the grammar S->ab | aSb: TRUE A JO99 variable has an l-value and r-value: TRUE An abstract syntax tree is derived from a parse tree by removing extraneous nodes and restructuring the tree: TRUE A handle is a simple phrase: TRUE Some JO99 objects do not have a class: FALSE The following finite state automation recognizes the laguage specified by the regular expression a*1a+: FALSE
State Input NextState 0 1 1 0 a 0 1 a 2 2 1 1 2 a 2 Staring state is 0
A context free grammar can be used to recongnize any context sensitive language: FALSE
Given the parse table and grammar:
| | b | a | $ || S | A | |-------------------------------------| | 0 | s3 | s2 | || 1 | 5 | | 1 | | |accept|| | | | 2 | r4 | s2 | r4 || | 4 | | 3 | | | r1 || | | | 4 | r3 | | r3 || | |
| 5 | s6 | | || | | | 6 | | s2 | || | 7 | | 7 | | | r2 || | |
r1: S->b r2: S->AbA r3: A->aA r4: A->a
a) Show a right-most derivation for the input aaba.
S->AbA->Aba->aAba->aaba
b) When parsing the input aaba, how many shifts will be performed?
4
c) Show the parse tree for aaba.
s /|
/ |
A b A /| | / | | a A a | | a
Given the grammar S->AcD A->ab|aAb D->d|Dd a) What is the language?
anbncdm n, m >=
b) Fill-in the following sets: FIRST(s) = {a} FIRST{A} = {a} FIRST{D} = {d} c) Fill-in the following sets: FOLLOW(S) = {$} FOLLOW{A} = {c, b} FOLLOW{D} = {d, $}
error (i.e. blank)
Posted by HKN (Electrical Engineering and Computer Science Honor Society)University of California at BerkeleyIf yo 4