Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

Similar documents
I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

Theory of Computations Spring 2016 Practice Final Exam Solutions

Theory of Computations Spring 2016 Practice Final

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Decidable Problems. We examine the problems for which there is an algorithm.

Theory of Computation, Homework 3 Sample Solution

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

CSE 105 THEORY OF COMPUTATION

Theory Bridge Exam Example Questions Version of June 6, 2008

CSC-461 Exam #2 April 16, 2014

CT32 COMPUTER NETWORKS DEC 2015

1. [5 points each] True or False. If the question is currently open, write O or Open.

Outline. Language Hierarchy

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Computer Sciences Department

Midterm I (Solutions) CS164, Spring 2002

ECS 120 Lesson 16 Turing Machines, Pt. 2

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Final Exam 1, CS154. April 21, 2010

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

A Characterization of the Chomsky Hierarchy by String Turing Machines

CS 181 B&C EXAM #1 NAME. You have 90 minutes to complete this exam. You may assume without proof any statement proved in class.

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

PS3 - Comments. Describe precisely the language accepted by this nondeterministic PDA.

Midterm I - Solution CS164, Spring 2014

Turing Machine Languages

14.1 Encoding for different models of computation

QUESTION BANK. Formal Languages and Automata Theory(10CS56)

ONE-STACK AUTOMATA AS ACCEPTORS OF CONTEXT-FREE LANGUAGES *

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

6.045J/18.400J: Automata, Computability and Complexity Final Exam. There are two sheets of scratch paper at the end of this exam.

Languages and Automata

CSE 105 THEORY OF COMPUTATION

Theory of Languages and Automata

Equivalence of NTMs and TMs

CS143 Midterm Fall 2008

From Theorem 8.5, page 223, we have that the intersection of a context-free language with a regular language is context-free. Therefore, the language

Final Course Review. Reading: Chapters 1-9

6.045 Final Exam. Name: Please write your name on each page. This exam is open book, open notes.

Finite automata. We have looked at using Lex to build a scanner on the basis of regular expressions.

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

JNTUWORLD. Code No: R

UNIT I PART A PART B

Multiple Choice Questions

HKN CS 374 Midterm 1 Review. Tim Klem Noah Mathes Mahir Morshed

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.

Limited Automata and Unary Languages

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

CS 125 Section #10 Midterm 2 Review 11/5/14

T.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course)

1 Parsing (25 pts, 5 each)

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.

Today, we will dispel the notion that Java is a magical language that allows us to solve any problem we want if we re smart enough.

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

Theory of Programming Languages COMP360

Problems, Languages, Machines, Computability, Complexity

Chapter 14: Pushdown Automata

Pushdown Automata. A PDA is an FA together with a stack.

Variants of Turing Machines

Formal Languages and Automata

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

where is the transition function, Pushdown Automata is the set of accept states. is the start state, and is the set of states, is the input alphabet,

Turing Machines Part Two

CS21 Decidability and Tractability

CSE 105 THEORY OF COMPUTATION

CS103 Handout 42 Spring 2017 May 31, 2017 Practice Final Exam 1

CISC 4090 Theory of Computation


t!1; R 0! 1; R q HALT

lec3:nondeterministic finite state automata

Actually talking about Turing machines this time

Theory of Computation

Decision Properties for Context-free Languages

Computation, Computers, and Programs. Administrivia. Resources. Course texts: Kozen: Introduction to Computability Hickey: Introduction to OCaml

Regular Languages and Regular Expressions

Specifying Syntax COMP360

CS 181 EXAM #1 NAME. You have 90 minutes to complete this exam. You may state without proof any fact taught in class or assigned as homework.

Converting a DFA to a Regular Expression JP

Automating Construction of Lexers

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

CpSc 421 Final Solutions

CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia

Lexical Analysis. Prof. James L. Frankel Harvard University

CMSC330 Fall 2016 Midterm #2 2:00pm/3:30pm

CS154 Midterm Examination. May 4, 2010, 2:15-3:30PM

Context-Free Grammars

Lecture 18: Turing Machines

CS 44 Exam #2 February 14, 2001

First Midterm Exam CS164, Fall 2007 Oct 2, 2007

1. Provide two valid strings in the languages described by each of the following regular expressions, with alphabet Σ = {0,1,2}.

THEORY OF COMPUTATION

(Refer Slide Time: 0:19)

Languages and Compilers

Transcription:

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all of the instructions below, and I will obey the Academic Honor Code. Signature and Date: This exam has 6 pages in total, numbered 1 to 6. Make sure your exam has all the pages. This exam will be 1 hour and 25 minutes in length. This is a closed-book, closed-note exam. For all problems, follow these instructions: 1. Give only your answers in the spaces provided. I will only grade what you put in the answer space, and I will take off points for any scratch work in the answer space. Use the scratch-work area or the backs of the sheets to work out your answers before filling in the answer space. 2. DFA stands for deterministic finite automaton; NFA stands for nondeterministic finite automaton; CFG stands for context-free grammar; PDA stands for pushdown automaton. 3. For any proofs, be sure to provide a step-by-step argument, with justifications for every step. Unless you are specifically asked to prove a theorem from the book, you may assume that the theorems in the textbook hold; i.e., you do not have to reprove the theorems in the textbook. When using a theorem from the textbook, make sure you provide enough detail so that it is clear which result you are using; e.g., say something like, By the theorem that shows every NFA has an equivalent DFA, it follows that... Problem 1 2 3 4 5 Total Points 1

1. [30 points] For each of the following, circle TRUE if the statement is correct. Otherwise, circle FALSE (a) TRUE FALSE Every regular language is also context-free. (b) TRUE FALSE Every context-free language is also regular. (c) TRUE FALSE Every Turing-decidable language is also context-free. (d) TRUE FALSE There is a language A that is recognized by a nondeterministic Turing machine that is not recognized by any deterministic Turing machine. (e) TRUE FALSE For any Turing machine M = (Q, Σ, Γ, δ, q 0, q accept, q reject ) and any string w Σ, M will either accept or reject w. (f) TRUE FALSE Two DFAs A and B are equivalent if and only if L(A) L(B) =. (g) TRUE FALSE A language A is Turing-recognizable if and only if some enumerator enumerates it. (h) TRUE FALSE The language A NFA = { N, w N is an NFA that accepts w } is Turing-decidable. (i) TRUE FALSE The class of Turing-recognizable languages is closed under union. (j) TRUE FALSE The class of Turing-decidable languages is closed under union. 2

2. [20 points] Give a short answer (at most two sentences) for each part below. No proofs are required, but be sure to define any notation that you use. (a) What does it mean for a context-free grammar to be in Chomsky normal form? (b) What is the difference between Turing-recognizable and Turing-decidable. (c) What is the Church-Turing Thesis? (d) Let T = { 0, 1, (, ),,,, e }. We may think of T as the set of symbols used by regular expressions over the alphabet {0, 1}; the only difference is that we use e for symbol ε, to avoid potential confusion. Give a CFG G with set of terminals T that generates exactly the regular expressions with alphabet {0, 1}. 3

3. [15 points] Give an example of two context-free languages A and B whose intersection C = A B is not context-free. Explain your answer, and follow these instructions: Provide CFGs for A and B. If we showed in class or in a homework that your language C is not contextfree, then you do not need to provide a proof of this fact; however, be sure to clearly state that your language C was proven to be non-context-free in class or in a homework. If we did not show your language C is context-free in class or in a homework, then you will need to provide an explicit proof of this fact. 4

4. [20 points] The Turing machine M below recognizes the language A = { 0 2n n 0 }. 0 0, L x x, L q 5, L q 1 q 2 q 3 0, R 0 x, R 0 x, R 0 0, R q reject q accept q 4 In each of the parts below, give the sequence of configurations that M enters when started on the indicated input string. (a) 000 (b) 00 Scratch-work area 5

5. [15 points] Consider the problem of testing whether an NFA and a regular expression are equivalent. Express this problem as a language and show that it is decidable. For this problem, you can apply any theorem that we went over in class without proving it, but make sure that you give enough details so that it is clear what theorem you are using (e.g., say something like, By the theorem that says the class of regular languages is closed under union, we can show that... ) 6