Sample Midterm2-fa07 - Sample Questions for Midterm 2 (CS...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sample Questions for Midterm 2 (CS 421 Fall 2007) On the actual midterm, you will have plenty of space to put your answers. Some of these questions may be reused for the exam. 1. Using the rules provided in class, derive a valid type judgment for let rec fact = fun n -> if n = 0 then 1 else let r = fact (n - 1) in n * r in fact;; (The rules will be provided for you on the exam, if this kind of question is asked.) 2. Give a (most general) unifier for the following unification instance. Capital letters denote variables of unification. Show your work by listing the operation performed in each step of the unification and the result of that step. {X = f(g(x),W), h(y) = Y, f(Z,x) = f(Y,W)} 3. For each of the regular expressions below (over the alphabet {a,b,c}), draw a non- deterministic finite state automaton that accepts exactly the same set of strings as the given regular expression. a. a* b* c* b. ((aba bab) c (aa bb))* c. (a*b*)*(c ε ) (b*a*)* 4. Consider the following grammar:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This test prep was uploaded on 04/21/2008 for the course CS 421 taught by Professor Kamin during the Fall '08 term at University of Illinois at Urbana–Champaign.

Page1 / 2

Sample Midterm2-fa07 - Sample Questions for Midterm 2 (CS...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online