# prac_quiz1 - 6.035 Practice Quiz 1 1 Give a Regular...

• CaptainStrawCrow5189
• 4

This preview shows pages 1–3. Sign up to view the full content.

6.035 Practice Quiz 1 1. Give a Regular Expression and DFA for: L = { x ∈ { 0 , 1 } * | x ends with 1 and does not contain the substring 00 } 2. Give a RE for: L = { 0 i 1 j | i is even and j is odd } 3. Given the NFA for below for 0 * (01) * 0 * , construct a DFA: 0 0 ε ε A B D C 0 1 4. Give a RE and a DFA/NFA for the language of all strings over { 0 , 1 } * that do not end in 01. 5. Give a RE and a CFG for: L = { x ∈ { 0 , 1 } * | x starts and ends with different symbols } 6. Give a CFG for: L = { x ∈ { 0 , 1 } * | symbol at position i is same as symbol at position i+2 and | x |≥ 2 } 7. Give a CFG for the language of all non-palindromes over { 0 , 1 } * . 8. Give a CFG for: L = { 0 i 1 j 0 k | j > i + k } So, 001111100 is in the string. Hint, the concatenation of two (or more) context-free languages is context-free. 9. Eliminate left recursion from: S Aa | b A Ac | Sd | ε 10. Give a CFG for L = { a i b i c i | i 1 } . 11. Is this grammar ambiguous? If so, prove it and construct a non-ambiguous grammar that derives the same language. S aS | aSbS | c 1

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

12. Assume that we have added a pointer type to decaf that can point to integers and booleans.
This is the end of the preview. Sign up to access the rest of the document.
• Fall '12
• Rindard
• Context-free grammar, Parse Trees, L1 L2 L3

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern