semester: 6 sub: theory of computation(160704)...semester: 6 sub: theory of computation(160704)...

13
Page 1 of 13 Venus International College of Technology Department of Computer Engineering Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the given relation determine the properties( reflexivity, symmetry, transitivity), which ones the relation has: R = {(1,1),(2,2),(3,3),(1,2)} and R = Ø 2. Give the definition of “Transitive Closure of a Relation” using induction. 2. Prove that √2 (square root of 2) is Irrational by method of Contradiction. 3. Define one-to-one, onto and bijection function. Check whether the function f: R R+, f(x) = x2 is “one to one” or “onto”. 4. Using Principle of Mathematical Induction, Prove that For every n >= 1, n Σ i 2 = n (n+1)(2n+1)/ 6 i=1 5. Using Principle of Mathematical Induction, prove that for every n >= 1, 7 + 13 + 19 + . . . + (6n + 1) = n(3n +4) 6. Define One-to-one and Onto Functions. Also explain Compositions and Inverse of functions. 7. Define the Strong Principle of Mathematical Induction. Prove the following using mathematical Induction. 7+ 13 + 19 + ………+ (6n+1) = n (3n+4) Question Bank

Upload: others

Post on 16-Feb-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 1 of 13

Venus International College of Technology

Department of Computer Engineering

Semester: 6 Sub: Theory of COmputation(160704)

MODULE-I Ch-Review Of Mathematical Terms And Theory

1. Answer the following

1. In the given relation determine the properties( reflexivity, symmetry, transitivity),

which ones the relation has: R = {(1,1),(2,2),(3,3),(1,2)} and R = Ø

2. Give the definition of “Transitive Closure of a Relation” using induction.

2. Prove that √2 (square root of 2) is Irrational by method of Contradiction.

3. Define one-to-one, onto and bijection function.

Check whether the function f: R � R+, f(x) = x2 is “one to one” or “onto”.

4. Using Principle of Mathematical Induction, Prove that

For every n >= 1,

n

Σ i2 = n (n+1)(2n+1)/ 6

i=1

5. Using Principle of Mathematical Induction, prove that for every n >= 1,

7 + 13 + 19 + . . . + (6n + 1) = n(3n +4)

6. Define One-to-one and Onto Functions. Also explain Compositions and Inverse of

functions.

7. Define the Strong Principle of Mathematical Induction. Prove the following using

mathematical Induction.

7+ 13 + 19 + ………+ (6n+1) = n (3n+4)

Question Bank

Page 2: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 2 of 13

MODULE-II Ch- Finite Automata

1. Convert the following NFA into FA.

2. Suppose that L1 and L2 are the subsets

Draw the FAs recognizing the following languages.

• L1 ∩ L2

• L1 – L2

3. Define Pumping Lemma. Use the Pumping Lemma to show that the following languages

are not regular.

• L = , 0n 1 02n / n ≥ 0 -

• L = , 0i 1j 0k / k > i+j }

4. Prove: Any Regular Language can be accepted by a finite automaton ( Kleene’s Theorem,

Part - I )

5. Attempt the following :

• Draw FA for (11+110)* 0

• Write a Regular Expression for the String of 0’s and 1’s in which string ends with 1 and

does not contain substring 00.

Page 3: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 3 of 13

6. Define δ* for!FA- NFA and NFA-Λ. Also Calculate δ* (1, ab) and δ* (1, abaab) from the

following transition table.

7. Minimize the following DFA (If Possible).

8. Draw an DFA that recognize the language of all strings of 0’s and 1’s of length at least 1

that, if they were interpreted as binary representation of integers, would represent evenly

divisible by 3. Your DFA should accept the string 0 but no other strings with leading 0’s.

9. Enlist applications where the finite automaton is useful. Also Find a string of minimum

length in {0,1}* not in the language corresponding to the regular expression : 1*(0+10)*1*

10. Explain the procedure for converting the given DFA into minimum number of state DFA.

Using this procedure convert the following DFA into minimum number of states DFA

(minimized FA) where Σ = ,0,1-.

11. Define Pumping Lemma for Regular Languages.

Prove that the language L = {an: n is a prime number} is not regular.

12. Check the validity of the following equality with proper reason.

( 0 0 * 1 ) * 1 = 1 + 0 ( 0 + 1 0 ) * 1 1

Page 4: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 4 of 13

13. Consider the following NFA-^.

[1] Convert this NFA-^ into its equivalent NFA.

[2] Take this NFA as an input and convert it into equivalent DFA

14. Write Regular Expressions for the following languages of all strings in {0,1}*

(i) Strings that do not end with 01.

(ii) Strings with odd numbers of 1’s (Ones).

15. Define Nondeterministic Finite Automata (NFA) and write down recursive definition of δ*

for NFA- Λ.

16. Give the recursive definition of PAL of Palindrome over any alphabet Σ.

17. Write definition of Finite Automata and draw FA for the strings:

(i) The string with next to last symbol as 0.

(ii) The string with number of 0s odd and number of 1s odd.

18. For the following Regular Expression draw an NFA- Λ recognizing the corresponding

languages.

(i) (00 + 1)* (10)*

(ii) 001*0*11

19. Compare FA, NFA and NFA- Λ with illustration.

20. Show that for any language L, L* = (L*)* = (L+)* = (L*)+

21. Answer the following

1. Define regular language and regular expressions.

2. Find regular expression for the following:

Language of all string that do not end with 01.

3. Describe the language corresponding to following: (1+01)*(0+01)*

22. Answer the following

Write theorem: For any NFA M =(Q,Σ,q0,A,δ) accepting a language L, there is an FA

M1 =(Q,Σ,q1,A1,δ1) that also accepts L.

23. Write Regular Expressions for the following languages of all strings in {0,1}*

(i) Strings that contains odd number of 0’s (zeroes).

(ii) Strings that begin or end with 00 or 11.

24. Write definition of finite automata and draw FA for the strings:

(i)The string in {0,1}* ending in 10 or 11.

(ii)The string corresponding to Regular expression {11}*{00}*

Page 5: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 5 of 13

25. Answer the following

1.Draw FA for regular expression: (111+100)*0

2. Let M1 and M2 be the FA in fig below for the language L1 and L2, find L1 U L2 and

L1 ∩ L2.

26. Answer the following

1. For following NFA find minimum FA accepting same language

2. Use the pumping lemma to show that following language is not regular:

L = {ww|w ϵ {0,1}*}

27. Answer the following

1. For following NFA find minimum FA accepting same language

2. Use the pumping lemma to show that following language is not regular:

L ={xy|x,y ϵ {0,1}* and y is either x or xr}

Page 6: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 6 of 13

28. Convert following NFA- Λ to NFA and FA.

29. Draw Finite Automata (FA) for following languages:

L1 = ,x / 11 is not a substring of x, x Є ,0,1-*-

L2 = ,x / x ends with 10, x Є ,0,1-* -

Find FA accepting languages (i) L1 ∩ L2 and (ii) L1 – L2

30. Convert the following NFA- Λ into FA.

31. Prove : The language accepted by any finite automaton is regular.

32. Minimize the following DFA (If Possible).

Page 7: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 7 of 13

33. Let M1, M2 and M3 be the FAs pictured in Figure below, recognizing languages L1, L2, and

L3 respectively.

Draw FAs recognizing the following languages.

i . L1 U L2

ii . L1 ∩ L2

iii . L1 - L2

iv. L1 ∩ L3

v. L3 - L2

Page 8: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 8 of 13

MODULE-III Ch- CFG (Context Free Grammar)

1. Prove: There are context-free languages L1 and L2 so that L1 ∩ L2 is not a CFL and

there is a CFL L so that L’ is not a CFL

2. Given the CFG G, find a CFG G’ in Chomsky Normal form generating L(G) – , Λ-

S → AaA | CA | BaB

A →aaBa | CDA | aa | DC

B →bB | bAB | bb | aS

C→ Ca | bC | D

D→ bD | Λ

3. Explain Derivation Tree, Expression Tree and Ambiguity with Example.

4. Define CFG and Design a CFG for the following language.

L = { 0i 1j 0k / j > i + k }

5. For the following CFG’s, describe the language it accepts.

1. S → SS | XaXaX | ^

X →bX | ^

2. S → aM | bS

M → aF | bS

F →aF | bF | ^

3. S →aS | bS | a | b | ^

6. Give definition of Context-Free Grammars and Regular Grammars.

7. Find CFG for the following languages.

1. L = { ai bj ak | j > i + k }

2. L = { ai bj ck | i = j or j = k }

8. Find unrestricted grammar to generate the following language,

{ an x bn | ≥ 0, x є ,a, b-*, |x| = n -

9. Given the context-free grammar G, find a CFG G’ in Chomsky Normal Form generating

L(G) – {^}.

G has production S S(S) | ^

10. Define Dead-End State with Example.

11. Define CFG. Prove that the following CFG is Ambiguous.

S → S + S | S * S | (S) | a

Write the unambiguous CFG for the above grammar.

12. Answer the following.

(i) Design a CFG for the following language.

L = { 0i1j0k / j > i + k }

(ii) Give the difference between Top Down Parsing And Bottom Up Parsing.

Page 9: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 9 of 13

13. Write theorem: If L1 and L2 are context free languages, then the language L1 U L2,

L1L2 and L1* are also CFLs.

14. 1.Find context free grammar generating following language

{aibjck | i = j or i = k}

2. Show that CFG S→ a|Sa|bSS|SSb|SbS is ambiguous.

3. find an equivalent unambiguous grammar for following:

S →A|B A →aAb|ab B→ abB|Ʌ

15. Explain bottom up parsing with example.

16. Define Context Free Grammar (CFG). Describe the language accepted by following

CFG:

S → aSa | bSb | a | b | Λ

17. Prove that the following CFG is Ambiguous.

S→ S + S | S * S | (S) | a

Write the unambiguous CFG for the above grammar. Draw Parse tree for the string

a + a * a.

18. Convert following CFG to equivalent Chomsky Normal Form(CNF).

S → AACD | ACD | AAC | CD | AC | C

A → aAb | ab

C → aC | a

D → aDa | bDb | aa | bb

19. Explain CNF(Chomsky’s Normal Form).

20. Let L be the language corresponding to the regular expression (011+1)* (01)*. Find

the CFG generating L.

21. Given the CFG G, find a CFG G’ in Chomsky Normal form generating L(G) – , Λ-

Page 10: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 10 of 13

MODULE-IV Ch- Pushdown Automata, CFL and NFL

1. Define PDA and design PDA for L = { x ∈ { a, b}* | na(x) > nb(x) }

2. Give transition table for deterministic PDA recognizing the following language.

{ an bn+m am | n,m ≥ 0)

3. Give transition table for deterministic PDA recognizing the following language.

{ ai bj ck | i, j, k ≥ 0 and j = i or j = k -

4. For the language L = { xcxr / x Є ,a,b-* - design a PDA(Push Down Automata) and trace

it for string “abcba”.

5. Design and draw a deterministic PDA accepting “Balanced strings of Brackets” which

are accepted by following CFG.

S→ SS | * S + | , S - | Λ

6. Design and draw a deterministic PDA accepting strings with more a’s than b’s. Trace it for

the string “abbabaa”.

7. Prove: The language pal= { x ∈ {a, b}* | x = xr} cannot be accepted by any

deterministic pushdown automaton.

8. Define CFG and Design a CFG for the following language.

L = { x ∈ ,0,1-* | n0(x) ≠ n1(x) -

9. Write PDA for following languages:

{ x ϵ { a,b,c}* | na(x) < nb(x) or na(x) < nc(x) }.

Page 11: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 11 of 13

MODULE-V Ch- Turing Machines, Recursive Language

1. Draw the TM for L = {ss | s ∈ (a, b)* }

2. Explain Universal TM and Church Turing Thesis.

3. Draw a transition diagram for a Turing machine accepting the following language.

{ an bn cn | n ≥ 0 -

4. Draw a transition diagram for a Turing machine accepting the following language.

, x є , a, b, c -* | na(x) = nb(x) = nc(x) }

5. Define Turing Machine. Describe its capabilities. Also write short notes on Universal

Turing Machine.

6. Draw a Turing Machine(TM) to accept Palindromes over {a,b}. (Even as well as Odd

Palindromes).

7. Draw the TM to copy string and delete a symbol.

Page 12: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 12 of 13

MODULE-VI Ch- Computation Functions, Measuring, Classifications And Complexity

1. Give definitions of the following.

[1] Initial Functions

[2] Composition

[3] The Primitive Recursive Functions

2. Explain in Brief:

Halting Problem

3. Explain the following

1. Primitive Recursive Operation & Function.

2.μ Recursive Functions.

4. Write theorem: Let f: Σ*1 →Σ*2. Then f is computable if and only if f is μ recursive.

Page 13: Semester: 6 Sub: Theory of COmputation(160704)...Semester: 6 Sub: Theory of COmputation(160704) MODULE-I Ch-Review Of Mathematical Terms And Theory 1. Answer the following 1. In the

Page 13 of 13

MODULE-VII Ch- Tractable And Intractable Problems

1. Differentiate the NP Hard and NP Complete Problems.

2. Explain Cook’s Theorem.

3. Give definitions of the following.

[1] Basic complexity Classes

[2] Step-counting Functions

[3] The Time and Space Complexity of a Turing Machine

4. Give definitions of the following.

[1] Polynomial-time Reducibility

[2] NP-hard and NP-complete languages

[3] The Sets P, NP, PSpace and NPSpace

5. Explain the following

1. Time and space complexity.

2. NP complete problem.

Subject Co-ordinator Head of the Department

Prof. Jalpa Shah Prof. Jayshree Upadhyay

Copy to:

(1) Student Notice Board

(2) Library Photocopy File

(3) Subject Coordinator File

(4) HoD- Subject File