CPSC 229 Foundations of Computation Spring 2024

Comments on Exam 2

Correction: for #7, the arrows in the grammar rules are backwards — they should point to the right, not the left.

For questions that ask for a concise English description of a language (#1, #4b, #7b), think about what strings are contained in the language / matched by the regular expression / accepted by the DFA or NFA / generated by the grammar and identify what the pattern is. Writing out some examples can help you with this, though you do need to be careful to generalize correctly. It is not sufficient to just describe the operator / regular expression / machine / grammar rules. Examples of insufficient answers:

#2: Be careful that your machine is a DFA, not an NFA!

#5: Make sure you take into account the ε-transitions.

#6: "Explaining how the grammar works" doesn't mean describing each rule — explain what the rule's role is in generating the correct language. For example, maybe a rule is responsible for a matching number of certain symbols, or adding more of a symbol, or ...

#7a: Make sure to give a left derivation, and review the notation for showing a derivation. The general grammars derivation examples from class illustrate the notation.