{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 313F04M - CPSC 313 Midterm Test November 4 2004 Name...

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

CPSC 313 — Midterm Test November 4, 2004 Name: Lecture Section: Lab Section: Please DO NOT write your ID number on this page. Instructions: Answer all multiple choice questions in part B on the score card using pencil . Answer all questions in part A in the space provided. No Aids Allowed. There are a total of 52 marks available on this exam. The exam will be marked out of 48. Duration: 120 minutes

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

View Full Document
ID Number: Section Question Score Possible score A 1 5 2 5 3 5 4 5 5 2 6 5 7 5 B 1-20 20 Total: 48 (+ 4 bonus marks) 1
ID Number: Part A - Short Answer Answer all open ended questions in this section in the space provided. At the end of this exam booklet some additional space is provided if needed. Make sure you indicate clearly where the answer to a question is located. The amount of marks each question is worth is indicated with the question. 1. [5 marks] Draw a transition diagram for a finite automaton that accepts the language L 1 = { w ∈ { 0 , 1 } * | w has odd length and ends with 11 } Briefly explain why your finite automata is correct. 2

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

View Full Document
ID Number: 2. [5 marks] Consider the deterministic finite automaton (DFA) M 2 which processes string over the alphabet Σ = { a, b, c } and whose transition diagram is as follows. q 0 q 1 q 2 start a,b c a,b c a,b,c Prove that, for any string w Σ * , δ ( q 0 , w ) = q 0 if and only if w ∈ { a, b } * . 3
ID Number: 3. [5 marks] Use the closure properties for regular languages to prove that the language L 3 = { wcw | w ∈ { a, b } * } is not a regular language. In your proof, you may use the fact that the language L = { ww | w ∈ { a, b } * } is not a regular language. 4

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

View Full Document
ID Number: 4. [5 marks] Give a regular expression whose language is L 4 = { w ∈ { a, b, c } * | w contains at least 1 a and at least 1 c } Explain why your answer is correct. 5. [2 marks] Consider the context-free grammar G 5 = ( V, T, P, S ) where V = { S, A, B } , T = { a, b } and P contains the rules S AbB A AA | a | B BB | a | b | Show that the grammar G 5 is ambiguous. 5
ID Number: 6. [5 marks] Consider again the context-free grammar G 5 from the previous question. We can prove the following claims: Claim 1 w T * B * G 5 w if and only if w L B = T * .

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.
• Spring '08
• NA
• Formal language, Formal languages, Regular expression, Nondeterministic finite state machine, Formal grammar, Context-free grammar

{[ snackBarMessage ]}