Theory Bridge Exam Example Questions Version of June 6, 2008

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

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

Theory of Computations Spring 2016 Practice Final Exam Solutions

Theory of Computations Spring 2016 Practice Final

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

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

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

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

Multiple Choice Questions

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

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

CS 44 Exam #2 February 14, 2001

CT32 COMPUTER NETWORKS DEC 2015

14.1 Encoding for different models of computation

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

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

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

UNIT I PART A PART B

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

JNTUWORLD. Code No: R

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Decision Properties for Context-free Languages

CSE Qualifying Exam, Spring February 2, 2008


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

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

Theory of Computation, Homework 3 Sample Solution

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

Outline. Language Hierarchy

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

Midterm I - Solution CS164, Spring 2014

(Refer Slide Time: 0:19)

CSE 105 THEORY OF COMPUTATION

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata

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

Computability and Complexity Sample Exam Questions

(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

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

Final Exam 1, CS154. April 21, 2010

Final Course Review. Reading: Chapters 1-9

Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Sets Fall / 31

CSC-461 Exam #2 April 16, 2014

Recursively Enumerable Languages, Turing Machines, and Decidability

Computer Sciences Department

Actually talking about Turing machines this time

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

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

Theory of Programming Languages COMP360

AUBER (Models of Computation, Languages and Automata) EXERCISES

CS402 - Theory of Automata Glossary By

Introduction to Computers & Programming

Midterm I (Solutions) CS164, Spring 2002

Turing Machine Languages

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued

Formal Languages and Automata

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

Converting a DFA to a Regular Expression JP

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

1 Parsing (25 pts, 5 each)

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

QUESTION BANK. Unit 1. Introduction to Finite Automata

Theory of Computation

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Languages and Compilers

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

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

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

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

Models of Computation II: Grammars and Pushdown Automata

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

Learn Smart and Grow with world

III. Supplementary Materials

Lexical Analysis. Lexical analysis is the first phase of compilation: The file is converted from ASCII to tokens. It must be fast!

Problems, Languages, Machines, Computability, Complexity

CS402 - Theory of Automata FAQs By

CMPSCI 250: Introduction to Computation. Lecture 20: Deterministic and Nondeterministic Finite Automata David Mix Barrington 16 April 2013

THEORY OF COMPUTATION

The Big Picture. Chapter 3

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

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

Lecture 6,

CS/B.Tech/CSE/IT/EVEN/SEM-4/CS-402/ ItIauIafIaAblll~AladUnrtel1ity

CIT3130: Theory of Computation. Regular languages

Enumerations and Turing Machines

CSE 105 THEORY OF COMPUTATION

CpSc 421 Final Solutions

Chapter Seven: Regular Expressions

Solutions to Homework 10

Conversion of Fuzzy Regular Expressions to Fuzzy Automata using the Follow Automata

1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string?

COMP Logic for Computer Scientists. Lecture 25

(a) Give inductive definitions of the relations M N and M N of single-step and many-step β-reduction between λ-terms M and N. (You may assume the

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

Exercises Computational Complexity

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

A Characterization of the Chomsky Hierarchy by String Turing Machines

CSE 105 THEORY OF COMPUTATION

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

Transcription:

Theory Bridge Exam Example Questions Version of June 6, 2008 This is a collection of sample theory bridge exam questions. This is just to get some idea of the format of the bridge exam and the level of difficulty. These example questions do not guarantee anything about the topics of the questions on your bridge exam and they do not guarantee the exact level of difficulty of the questions on your bridge exam. The actual bridge exam will consist of three or four questions of equal weight. Most of these example questions are are more suitable for a three-question exam than a four-question exam. Procedures of the Theory Bridge Exam 1. The only things that you are allowed to have out during the exam are pen(s), pencil(s), an eraser, and a simple watch. Please note that you are not allowed to use a cell phone, PDA, etc. as a clock. 2. Please silence your cellphones etc. 3. Do not share your supplies with others and do not talk with others. 4. Use only scrap paper provided by us. 5. Please also hand in your scrap paper when you are done. 6. Understanding the questions is part of the exam; you are not allowed to ask questions during the exam. 7. You only have to explain your answer if this is stated in the question. 8. If you use a theorem/construction from your book, please state what you are using where. 9. You may only leave the room after you finish your exam, and if you finish during the last ten minutes of allotted time you must remain seated in the room until time is up. 10. When time is called, you should stop writing immediately, you should remain seated, and you should remain seated without talking until all exams have been collected. 11. Your answers should be to the point. Notation Used in the Sample Questions Unfortunately, not every book uses the same notation. Here is some notation used in these sample questions. The empty string (sometimes called the null string) is denoted by Λ (you may have seen it denoted by λ, ǫ, or ε). A DFA is a deterministic finite automaton, an NFA is a nondeterministic finite automaton without Λ transitions, and an NFA-Λ is a nondeterministic finite automaton that may have Λ transitions. 1

1. Let Σ = {0,1}. In this question, every string over Σ is viewed as a binary natural number. Leading 0s are allowed. For example, 00100 is viewed as the number 4. Λ is viewed as the number 0. Look at the following list of six languages. L 1 = {x Σ x 16}. L 2 = {x Σ x is a square and x < 1000}. L 3 = {x Σ x is not divisible by 3}. L 4 = {x Σ x is divisible by 666}. L 5 = {xy x,y Σ and x y = 12}. Here, denotes multiplication. L 6 = {xy x,y Σ, x = y, and x and y represent the same number}. (a) Which of the languages from the list are regular? (b) Which of the languages from the list contain Λ? (c) Draw the transition diagram of a DFA that accepts one of the languages from the list or give a regular expression that represents one of the languages from the list. Also state which language you chose. 2

2. Let Σ = {a,b}. Let double be the function from Σ to Σ that doubles each character in a string. For example, double(baaba) = bbaaaabbaa. (a) What is double(aabaa)? (b) What is double(λ)? (c) Suppose x {a,b} and the length of x is k. What is the length of double(x)? (d) Give a recursive (inductive) definition of function double from Σ to Σ. For L a language over Σ, define double(l) as follows: double(l) = {double(x) x L}. (e) Let A be the language {ab,bbb,baba}. What is double(a)? (f) List all languages B over Σ that have the property that double(b) = B. (g) For each of the following statements, circle the right answer. i. If L is a regular language over Σ, then double(l) is regular. True / False. ii. If L is a finite language over Σ, then double(l) is finite. True / False. iii. If L Σ is not regular, then double(l) is not regular. True / False. iv. If L 1 and L 2 are regular languages over Σ, then L 1 L 2 is regular. True / False. v. If L 1 and L 2 are finite languages over Σ, then L 1 L 2 is finite. True / False. vi. If L 1 Σ and L 2 Σ are not regular, then L 1 L 2 is not regular. True / False. 3

3. This question is about the subset construction. Recall that this is the construction that is used to construct a DFA that accepts the same language as a given NFA. In this question, take Σ = {a,b,c}. (a) If you literally apply the subset construction to an NFA with k states, how many states will the corresponding FA have? (b) Give a simple example of a minimal NFA such that the FA obtained by literally applying the subset construction is not minimal. (A minimal NFA is an NFA such that no equivalent NFA has fewer states.) For your answer, draw the transition diagram of the NFA, the transition diagram of the FA obtained by applying the subset construction, and briefly argue that the FA is not minimal. (c) Give a simple example of a minimal NFA such that the FA obtained by literally applying the subset construction is minimal. For your answer, draw the transition diagram of the NFA, the transition diagram of the FA obtained by applying the subset construction, and briefly argue that the FA is minimal. 4

4. Suppose that P NP and that the alphabet is {a,b,c}. Draw a Venn diagram that shows the relationships between the following classes of languages: (a) NP (b) P (c) the deterministic context-free languages (d) the languages that can be accepted by an NFA-Λ (e) the languages that can be accepted by a nondeterministic Turing machine with 25 tapes (f) the languages that can be accepted by a Turing machine that halts on all inputs (g) the languages that can be generated by an unrestricted grammar (h) the languages that have an algorithmic solution (i) the languages whose complement is recursively enumerable (j) the recursive languages (k) the recursively enumerable languages (l) the regular languages 5

5. (a) Suppose that the alphabet is {0,1}. For every class of languages in the table, you have to state whether the class is closed under complementation, concatenation, and intersection. Write yes in a box if the class is closed under the operation, write no if the class is not closed under the operation, and write nobody knows if nobody knows whether or not the class is closed under the operation. closed under Complementation Concatenation Intersection NP P The context-free languages The recursively enumerable languages The recursive languages (b) For one of the boxes where you answered no, give an explicit example that shows why that particular class is not closed under that particular operation. (Clearly state which box you chose.) (c) For one of the boxes where you answered yes, informally argue why that particular class is closed under that particular operation. (Clearly state which box you chose.) 6

6. Consider the following grammar G: (a) Show that this grammar is ambiguous. S Λ 01S 10S 0S1 1S0 S01 S10 1S S1 At first glance, it may seem that the language generated by G is However, this is not true. L = {x {0,1} n 0 (x) n 1 (x)}. (b) For both of the following statements, circle true is the statement is true, and circle false if the statement is false. i. L L(G) true / false ii. L(G) L true / false (c) Show that L(G) L. (d) Give a context-free grammar that generates L. (It suffices to give the rules.) 7

7. Let L = {a i b k c i d k i,k 0}. (a) Explain informally why L doesn t seem to be a context-free language. (b) Prove that L is not context-free. 8

8. Consider the following decision problem ALLORNOTHING CFG : Given a CFG G, is L(G) {,Σ }? (In other words, given a CFG G, is it the case that G generates no strings or all strings?) You may use the fact that the membership problem for CFGs (Given a CFG G and a string x, is x L(G)?) and the emptyness problem for CFGs (Given a CFG G, is L(G) =?) are decidable. You may also use the fact that ALL CFG (Given a CFG G, is L(G) = Σ?) is undecidable. (a) Show that ALLORNOTHING CFG is undecidable. (Hint: use the undecidability of ALL CFG.) (b) Show that ALLORNOTHING CFG is in core. (c) Is ALLORNOTHING CFG in RE? Briefly explain your answer. 9

9. (From Martin) A Post machine is similar to a PDA, but with the following differences. It is deterministic, it has a queue instead of a stack, and it doesn t have a separate input tape (at the start of the computation, the input will be on the queue). Items can be added only to the rear of the queue, and deleted only from the front. Assume that there is a marker Z 0 initially on the queue following the input. For example, if the input is abb, then at the start of the computation, the contents of the queue are abbz 0, the symbol a is at the front of the queue and the symbol Z 0 is at the rear of the queue. A single move of the Post machine depends on the state and the symbol currently at the front of the queue. A move has three components: the resulting state, an indication of whether or not to remove the current symobol from the front of the queue, and what string to add to the rear of the queue. Construct a Post machine to accept the language {a n b n c n n 0}. Draw a transition diagram, explain the notation used in your transition diagram, and give a short explanation of your Post machine, so that we can understand it. 10

10. Consider the following decision problem. (If this were a question on the real bridge exam, the definitions of clique, independent set, and the problem INDEPENDENT SET would be included.) IS-OR-CLIQUE = { (G,k) G is a graph, k is an integer, and (a) Show that IS-OR-CLIQUE is in NP. G has a clique of size k or an independent set of size k}. (b) Give an explicit example that shows that the function f defined as f(g,k) = (G,k) is not a polynomial-time many-one reduction from INDEPENDENT-SET to IS-OR-CLIQUE. (c) Show that IS-OR-CLIQUE is NP-complete. 11