0% found this document useful (0 votes)
55 views20 pages

CAC Question Bank 24

The document is a question bank for the Computing Architecture and Computation course at Aditya Silver Oak Institute of Technology for the academic year 2023-24. It includes a comprehensive list of questions divided into modules covering topics such as programming language grammar, system programming, and regular grammar. Each question is associated with marks, course outcomes, and Bloom's Taxonomy levels.

Uploaded by

ashish1707shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views20 pages

CAC Question Bank 24

The document is a question bank for the Computing Architecture and Computation course at Aditya Silver Oak Institute of Technology for the academic year 2023-24. It includes a comprehensive list of questions divided into modules covering topics such as programming language grammar, system programming, and regular grammar. Each question is associated with marks, course outcomes, and Bloom's Taxonomy levels.

Uploaded by

ashish1707shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Aditya Silver Oak Institute of Technology

Department of Computer Engineering

Subject Name:Computing Architecture and Computation Semester : VII


Subject Code: 1010043426 Academic Year: 2023-24
Question Bank

Sr. Question Marks CO BTL


No

1 Define what a programming language grammar is and why it is important in 4 CO1 2


language design.

2. Explain the difference between context-free grammars and regular grammars 4 CO1 2
in the context of programming languages.

3 Provide examples of tokens, terminals, and non-terminals in a programming 4 CO1 3


language grammar.

4. Describe the different classes of grammars based on the Chomsky hierarchy 7 CO1 3
and their relevance in programming language theory.

5 Discuss the characteristics of regular, context-free, context-sensitive, and 7 CO1 3


recursively enumerable grammars.

6 What is ambiguity in the context of grammatical specification? 4 CO1 2

7 Define scanning and parsing in the context of language processing. 4 CO1 2

8 Explain the difference between lexical analysis and syntax analysis. 4 CO1 3

9 Explain the concept of top-down parsing and its importance in language 4 CO1 3
processing.

10 Compare and contrast top-down parsing with bottom-up parsing. 7 CO1 3

11 Describe the process of bottom-up parsing and its applications in language 4 CO1 3
processing.

12 What are language processor development tools, and why are they important 4 CO1 3
in software development?

13 Compare and contrast lexical analysis tools such as LEX with parser generators 4 CO1 3
like YACC

14 Provide an overview of LEX and its purpose in language processing. 4 CO1 2


Module 2: Elements of System Programming

1 Explain the elements of assembly language programming and their 4 CO2 3


significance.

2 Discuss the design considerations involved in developing an assembler. 4 CO2 2

3 Explain two pass design of assembler 7 CO2 3

4 Differentiate between various types of assemblers such as one-pass 7 CO2 3


assemblers, two-pass assemblers, and multipass assemblers.

5 What are the causes of the large semantic gap between high-level 4 CO2 3
programming languages and machine languages? How does it affect compiler
design?

6 Define binding and binding times in the context of compiling. Provide 4 CO2 2
examples of each.

7 Describe the data structures commonly used in compiling processes and their 4 CO2 2
role in efficient code generation.

8 Explain scope rules in programming languages and how they influence 4 CO2 3
compilation.

9 Discuss memory allocation strategies employed by compilers. 4 CO2 2

10 Outline the compilation process for expressions and control structures. 4 CO2 2

11 What is code optimization in compiling? Discuss various techniques used for 4 CO2 2
code optimization.

12 Provide an overview of interpretation and how it differs from compilation. 4 CO2 2

13 Explain the procedures involved in debugging programs using interpreters and 4 CO2 2
debuggers.

14 Classify debuggers based on their functionalities and usage scenarios. 4 CO2 2

15 Define macro definition and call in the context of macro processors. 4 CO2 2

16 Explain the process of macro expansion and its significance in code generation. 4 CO2 2

17 Discuss nested macro calls and their handling in macro processing. 4 CO2 2

18 What are the functions of a macro processor in software development? 4 CO2 2

19 Identify and discuss the design issues commonly encountered in macro 4 CO2 3
processors.

20 Introduce the concepts of linkers and loaders in the context of software 4 CO2 3
development.

21 Describe the design of a linker and its role in generating executable code. 7 CO2 3

22 Explain dynamic linking and its advantages in software development. 4 CO2 2

23 Discuss different loading schemes employed by loaders. 7 CO2 3

24 Compare and contrast the functionalities of linkers and loaders, highlighting 7 CO2 3
their respective roles in the compilation and execution process.

Module 3: Set, Functions and Regular Grammar

1 Using Principle of Mathematical Induction, prove that for every n >= 1, 4 CO3 4
N Σ i = n (n+1) / 2 i=0

2 Using Principle of Mathematical Induction, prove that for every n >= 1, 4 CO3 4
7 + 13 + 19 + . . . + (6n + 1) = n(3n +4)

3 Explain Equivalence Relation. 4 CO3 3

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

5 Using Principle of Mathematical Induction, Prove that For every n >= 1, 4 CO3 4
N Σ i2 = n (n+1)(2n+1)/ 6 i=1

6 Answer the following: 7 CO3 4


(i) Give recursive definition of each of the following sets.
a. The set T of positive integer divisible by 2 or 7.
b. The set U of all string in {0, 1}* containing the substring 00.
(ii) Prove that for any every n>=0, n (n2+5) is divisible by 6.

7 Answer the following: 7 CO3 4


(i) Given the relation R in A as R= {(1, 1), (2, 2), (2, 3), (3, 2), (4, 2), (4, 4)} is R
(a) reflexive (b) symmetric (c) transitive? (d) Antisymmetric?
(ii) Show that 2n > n3 for n >10 by Mathematical Induction.

8 Define relation. Define reflexive and transitive relation. A binary relation R on 7 CO3 4
NxN is defined as (a,b)R(c,d) if a ≤ c or b ≤ d. Prove that R is reflexive but not
transitive.

9 Define mathematical induction. 4 CO3 4


Prove that if 0 < a < 1 then (1-a) n ≥ 1 – na.

10 Using proof by contradiction, prove √3 is Not a rational number. 4 CO3 4

11 Define Mathematical Induction principle and prove that for any n>=4, n!>2n 4 CO3 4

12 Explain following 7 CO3 3


i. One to one and onto function
ii. Properties of equivalence relation.
13 Use the principle of mathematical induction to prove that 4 CO3 4
1 +3 +5 + … +r = n2 for all n>0 where r is an odd integer & n is the number of
terms in the sum. ( Note : r= 2n-1)

14 Let A = {1, 2, 3, 4, 5, 6} and R be a relation on A such that aRb iff a is a multiple 7 CO3 4
of b.
Write R. Check if the relation is i) Reflexive ii) Symmetric iii) Asymmetric iv)
Transitive

15 Answer the following 4 CO3 3


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)*

16 Answer the following 7 CO3 4


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.

17 Write theorem: For any NFA M =(Q,Σ,q0,A,δ) accepting a language L, there is an 7 CO3 4
FA M1 =(Q,Σ,q1,A1,δ1) that also accepts L.

18 Write Kleene’s Theorem part-I, Any regular language can be accepted by a 7 CO3 4
finite automation.

19 Answer the following 7 CO3 4


1. For following NFA find minimum FA accepting same language
20 Answer the following 7 CO3 4
1. For following NFA find minimum FA accepting same language

21 Write Regular Expressions for the following languages of all strings in {0,1}* 4 CO3 5
(i) Strings that do not end with 01.
(ii) Strings with odd numbers of 1’s (Ones).

22 Define Nondeterministic Finite Automata (NFA) and write down recursive 7 CO3 4
definition of δ* for NFA- Λ.

23 Write definition of Finite Automata and draw FA for the strings: 4 CO3 3
(i) The string with next to last symbol as 0.
(ii) The string with number of 0s odd and number of 1s odd.

24 Convert following NFA- Λ to NFA and FA 7 CO3 4


q δ (q, Λ) δ(q, 0) δ(q, 1)

A {B} {A} Ǿ

B {D} {C} Ǿ

C Ǿ Ǿ {B}

D Ǿ {D} Ǿ

25 For the following Regular Expression draw an NFA- Λ recognizing the 7 CO3 4
corresponding languages.
(i) (00 + 1)* (10)*
(ii) 001*0*11

26 Draw Finite Automata (FA) for following languages: 7 CO3 4


L1 = {x / 00 is not a substring of x }
L2 = {x / x ends with 01 }
Find FA accepting languages (i) L1 ∩ L2 and (ii) L2 – L1

27 Compare FA, NFA and NFA- Λ with illustration. 7 CO3 3

28 Convert the following NFA into FA. 7 CO3 4


29 Suppose that L1 and L2 are the subsets 7 CO3 3

Draw the FAs recognizing the following languages.


• L1 ∩ L2
• L1 – L2

30 Define δ* for! FA- NFA and NFA-Λ. Also Calculate δ* (1, ab) and δ* (1, abaab) 7 CO3 4
from the following transition table.
Q δ(q,a) δ ( q , b)

1 { 1 , 2} {1}

2 { 3} {3}

3 {4} {4}

4 {5} Ø

5 Ø {5}

31 Attempt the following : 7 CO3 4


• 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.

32 Languages L1 and L2 are the subsets given below. Where Σ = { 0 , 1 } 7 CO3 4


L1 = { x | 00 is not a substring of x }
L2 = { x | x ends with 01 }
Draw FAs recognizing the following languages
(i) L1 - L2 (ii) L1∩L2
33 Draw a DFA that recognize the language of all strings of 0’s and 1’s of length at 7 CO3 4
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.

34 Enlist applications where the finite automaton is useful. Also Find a string of 7 CO3 4
minimum length in {0,1}* not in the language corresponding to the regular
expression : 1*(0+10)*1*

35 Explain the procedure for converting the given DFA in to minimum number of 7 CO3 4
state DFA. Using this procedure convert the following DFA into minimum
number of states DFA (minimized FA) where Σ = {0,1}.
Q δ(q,a) δ(q,b)

- +1 {3} {2}

2 {4} {1}

3 {5} {4}

4 {4} {4}

5 {3} {2}

36 Define Dead-End State with Example. 4 CO3 3

37 Write Regular Expressions for the following languages of all strings in {0,1}* 4 CO3 4
(i) Strings that contains odd number of 0’s (zeroes).
(ii) Strings that begin or end with 00 or 11.

38 Write definition of finite automata and draw FA for the strings: 7 CO3 4
(i)The string in {0,1}* ending in 10 or 11.
(ii)The string corresponding to Regular expression {11}*{00}*

39 Convert following NFA- Λ to NFA and FA. 4 CO3 4


Q δ(q, Λ) δ(q, 0) δ(q, 1)

A {B,D} {A} Ǿ

B Ǿ {C} {E}

C Ǿ Ǿ {B}

D Ǿ {E} {D}

E Ǿ Ǿ Ǿ
40 Compare FA, NFA and NFA- Λ. For the following Regular Expression draw an 7 CO3 4
NFA-Λ recognizing the corresponding language. (0 + 1)* (10+01)* 11

41 Draw Finite Automata (FA) for following languages: 4 CO3 4


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

42 Write Regular Expressions for the following languages of all strings in 7 CO3 5
{0,1}*
(i) Strings that start with 1 and do not end with 10.
(ii) Strings with length 6 or less.

43 For the following Regular Expression draw an NFA- Λ recognizing the 7 CO3 4
corresponding language.
(0 + 1)* (10+110)* 1

44 Draw FA for accepting: 4 CO3 4


(i)The string in {0,1}* ending in 1 and not containing substring 00.
(ii)The strings with odd no. of 1’s and odd no. of 0’s

45 Convert the following NFA- Λ into FA. 7 CO3 4

46 Minimize the following DFA (If Possible). 7 CO3 4

47 Attempt the following : 7 CO3 4


● Draw FA for (a + b)* baaa.
Write a Regular Expression for the String of 0’s and 1’s in which number of 0’s
and 1’s are even.

48 Describe the language corresponding to following: (1+01)*(0+01)* 4 CO3 4


49 Find a regular expression corresponding to each of the following subsets of {0, 7 CO3 4
1}*.
i. The language of all strings that do not contain the substring 110.
ii. The language of all strings containing both 101 and 010 as substrings.
iii. The language of all strings in which both the number of 0's and the number
of l's are odd.

50 For each of the following regular expressions, draw an FA recognizing the 7 CO3 4
corresponding language.
i. 1(01 + 10)* + 0(11 + 10)*
ii. (010 + 00)*(10)*

51 Let M1, M2 and M3 be the FAs pictured in Figure below, recognizing languages 7 CO3 4
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

52 Define language. 7 CO3 4


Draw Deterministic Finite Automata for the following languages
i) L1 = { x ε (0,1)* | x contains 110111}
ii) L2 = { x ε (0,1)* | x contains odd number of zero and even number of 1}
iii) L3 = { x ε (0,1)* | x do not contains 110 }

53 Define NFA and NFA-Λ. Convert the following NFA to DFA 7 CO3 4
54 Minimize the following FSM 7 CO3 4

55 Write regular expression for the following languages 4 CO3 5


i) L1 = {x ε (0,1)* | x do not ends with 11}
ii) L2 = {x ε (0,1)* | x contains both 101 and 110}

56 Draw FA for each of the following RE. 7 CO3 5


i. (0+1)*(1+00)(0+1)*
ii. (0+1)*(01+110)
iii. (111+100)*0

57 For each of the RE draw NFA-ᴧ 7 CO3 4


i. (0+1)*(011+01010)(0+1)* ii.(0+1)(01)*(011)*

58 Find regular expression for following 7 CO3 4


i. Language of all strings containing exactly two 0’s.
ii. Language of all strings that begins or ends with 00 or 11.
iii. Language of all strings in which every 0 is followed immediately by 11.

59 Find minimum state FA recognizing the language corresponding to the 7 CO3 4


following RE.
i. (0*10+1*0)(01)* ii. (010)*1 + (1*0)*

60 Convert the NFA given in Table below to its corresponding DFA and draw the 7 CO3 4
DFA.

61 Write a regular expression for language L over {0,1} such that every string in L 4 CO3 4
i) Begins with 00 and ends with 11.
ii) Contains alternate 0 and 1.

62 Give recursive definitions of the extended transition functions, δ̂ ̂(i.e., for 7 CO3 4
strings) for DFA and NFA.

63 Consider the NFA-Λ depicted in following table: 7 CO3 5


(i) Compute the Λ-closure of each state.
(ii) Convert the NFA-Λ to a DFA.

64 Minimize the DFA shown in Figure 7 CO3 4

65 Using constructive approach determine NFA- Λ for the regular expression (0 + 7 CO3 5
1)*1(0 + 1).

66 Define language. 7 CO3 4


Draw Deterministic Finite Automata for the following languages
i) L1 = { x ε (0,1)* | x contains101}
ii) L2 = { x ε (0,1)* | x contains odd number of zero and ends with 00}
iii) L3 = { x ε (0,1)* | x ends with 11}

67 Figure shows NFA-^. Draw an FA accepting the same language. 7 CO3 5

68 What is the regular expression of following FA? 7 CO3 3

69 Draw NFA – Λ for ((0 + 1)*10 + (00)*(11)*)* Show step by step construction. 7 CO3 4
70 An NFA with states 1-5 and input alphabet {a, b} has the following transition 7 CO3 4
table.

71 Convert this NFA to FA 7 CO3 4

72 A language L {a, b}* is defined as follows: 7 CO3 4


1. a ϵ L
2. For any x ϵ L, ax ϵ L
3. For any x and y in L, all the strings bxy, xby and xyb are in L
4. No other strings are in L.
Prove that every element of L has more a’s than b’s.

73 Convert the following NDFA to DFA. 7 CO3 4

74 Write Regular Expression over the alphabets {a, b} consisting strings: 4 CO3 4
● Second last character as ‘a’
Starting with ‘a’ and ending with ‘b’

75 Construct fin finite automata for following left linear grammar: 7 CO3 4
S → X0 | Y1
X → Y1
Y → Y0 | 1

76 Convert the following NFA - Ʌ into its equivalent DFA that accepts the same 7 CO3 4
language:
77 Find a minimum-state FA for the following FA that recognizes the same 7 CO3 4
language using the minimization algorithm:

78 Define DFA and NFA and NFA- Λ 4 CO3 2

Module 4: Context Free Grammar

1 Write theorem: If L1 and L2 are context free languages, then the language L1 U 4 CO4 3
L2, L1⋂L2 and L1* are also CFLs.

2 Answer the following 7 CO4 3


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|Ʌ

3 Explain bottom up parsing with examples. 4 CO4 3

4 Define CFG. Prove that the following CFG is Ambiguous. 7 CO4 3


S → S + S | S * S | (S) | a
Write the unambiguous CFG for the above grammar.

5 Answer the following. 7 CO4 3


(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.

6 Prove: There are context-free languages L1 and L2 so that L1 ∩ L2 is not a CFL 4 CO4 3
and there is a CFL L so that L’ is not a CFL

7 Given the CFG G, find a CFG G’ in Chomsky Normal form generating L(G) – { Λ} 7 CO4 4
S→ AaA | CA | BaB
A→ aaBa | CDA | aa | DC
B→ bB | bAB | bb | aS
C→ Ca | bC | D
D→ bD | Λ

8 Explain Derivation Tree, Expression Tree and Ambiguity with Example. 4 CO4 3
9 For the following CFG’s, describe the language it accepts. 4 CO4 4
1. S → SS | XaXaX | ^
X → bX | ^
2. S→aM | bS
M→aF | bS
F→aF | bF | ^
3. S→aS | bS | a | b | ^

10 Find CFG for the following languages. 4 CO4 4


1. L = { aibjck | j > i + k }
2. L = { aibjck | i = j or j = k }

11 Given the context-free grammar G, find a CFG G’ in Chomsky Normal Form 4 CO4 4
generating L(G) – {^}. G has production S→S(S) | ^

12 Define Context Free Grammar (CFG). Describe the language accepted by 4 CO4 4
following CFG:
S→aSa | bSb | a | b | Λ

13 Prove that the following CFG is Ambiguous. 4 CO4 4


S→S + S | S * S | (S) | a
Write the unambiguous CFG for the above grammar. Draw Parse tree for the
string a + a * a.

14 Convert the following CFG to the equivalent Chomsky Normal Form(CNF). 7 CO4 4
S→AACD | ACD | AAC | CD | AC | C
A→aAb | ab
C→aC | a
D→aDa | bDb | aa | bb

15 Show that CFG S→a|Sa|bSS|SSb|SbS is ambiguous. 4 CO4 4

16 find an equivalent unambiguous grammar for following: 4 CO4 4


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

17 Let L be the language corresponding to the regular expression (011+1)* (01)*. 4 CO4 3
Find the CFG generating L.

18 Given the CFG G, find a CFG G’ in Chomsky Normal form generating L(G) – { Λ} 7 CO4 4
S→A | B | C
A→aAa | B
B→bB | bb
C→aCaa | D
D→baD | abD | aa

19 Define CFG and Design a CFG for the following language. 4 CO4 4
L = { x ∈ {0,1}* | n0(x) ≠ n1(x) }

20 Differentiate Regular Grammars and Context Sensitive Grammars. 4 CO4 3


21 Generate the Context-Free Grammars that give the following languages. 4 CO4 4
(i) {w | w contains at least three 1s}
(ii) {w | w starts and ends with the same symbol}

22 Define Context Free Grammar (CFG). Design CFG for Generating Following 4 CO4 4
Language:
(1) For Balanced Parenthesis
(2) Set of even length strings in {a, b, c, d}* with two middle symbol equal.

23 Design an ambiguous grammar for if-then-else statement that also generates 4 CO4 5
if-then statement. Re-write an equivalent unambiguous grammar. Prove that
Grammar is Unambiguous by tracing “ic1tic2taea”.

Module 5 - Pushdown Automata

1 Find CFG from given PDA that accepts the language {0n1n}. PDA is (Q, Σ, Г, δ, q, 7 CO4 4
Z, F) where Q={q, r}, Σ = {0, 1}, Г = {Z, X}, δ is defined by:

2 (1) Given the Context Free Grammar G, find a CFG G’ in Chomsky Normal 4 CO4 4
Form generating L(G) – { }
S → SS | A | B
A → SS | AS | a
B → /\
(2) Convert following CFG to PDA
S → 0S1 | 00 | 11

3 Given the Context Free Grammar G, find a CFG G’ in Chomsky Normal Form 7 CO4 4
generating L(G) – { }
1) S → aY | Ybb | Y
X → /\ | a
Y → aXY | bb | XXa
2) S → AA
A → B | BB
B → abB | b | bb

4 Define Context Free Grammar. Design a CFG for the following language. 4 CO4 4
L = { x ε (0,1)* | n0(x) = n1(x)}

5 For the following CFG, Find Chomsky normal form 4 CO4 4


S->AACD A->aAb|ᴧ C-> aC|a D->aDa|bDb|ᴧ
6 Convert the CFG, G ({S,A,B},{a,b},P , S) to CNF , where P is as follows 7 CO4 4
S --> aAbB A --> Ab | b B --> Ba | a

7 Prove that the following CFG is Ambiguous. 4 CO4 4


S -> S + S | S * S | a | b
Write the unambiguous CFG based on precedence rules for the above grammar.
Derive the parse tree for expression (a + a)*b from the unambiguous grammar.

8 Given the Context Free Grammar G, find a CFG G’ in Chomsky Normal Form 7 CO4 4
generating L(G) – { }
S → aY | Ybb | Y
X → /\ | a
Y → aXY | bb | XXa

9 Consider following grammar: 7 CO4 4


S → A1B
A → 0A | Λ
B → 0B | 1B | Λ
Give leftmost and rightmost derivations of the string 00101. Also draw the
parse tree corresponding to this string.

10 Consider following grammar: 7 CO4 4


S → ASB | Λ
A → aAS | a
B → SbS | A | bb
i. Eliminate useless symbols, if any.
ii. Eliminate Λ productions.

11 Prove that the following language is ambiguous and convert into unambiguous 4 CO4 4
E → E + E | E * E | id

12 Convert the following language in Chomsky normal form. 7 CO4 4


S→ASB | SAB A→ BC B→ bB | c C→e

13 (i) Write a CFG for solving simple (& parenthesized) expression, such as + and 7 CO4 4
*.
(ii) Also write CFG fir regular expression r = (a + b) (a + b + 0 + 1)* Use CFG
defined for part (i).
(iii) Derive the string (which is defined in part (ii)) a * (a + b00) by applying
left most derivation and right most derivation.

14 Define Context Free Grammar. Design a CFG for the language 4 CO4 4
L = { aibjck | i ≠ j + k }

15 Define Context Free Grammar. Find context-free grammar for the language: L = 4 CO4 4
{aibj | i < 2j}

16 Explain Union Rule and Concatenation Rule for Context-Free Grammar. 4 CO4 4

17 Decide whether the given language is a CFL, and prove your answer. 4 CO4 4
L = { xyx | x, y ϵ {a, b}* and |x| ≥ 1}

18 Define Context-Sensitive Grammar. What is the language of following 4 CO4 4


context-sensitive grammar?
S → aTb | ab
aT → aaTb | ac.

19 What is CNF? Convert the following CFG into CNF. 4 CO4 4


S → ASA | aB,
A → B | S,
B→b|ε

20 Consider the grammar: S→ABA, A→aA | ε, B→bB | ε 4 CO4 4


Is given grammar ambiguous? If so then remove ambiguity

21 Find context free grammar for the following language. 4 CO4 4


L1={ aibjck | i = j + k}, L2= (011+1)* (01)*, L3=(0+1)1*(1+(01)*)

22 Give the left linear grammar for RE (10)*1 4 CO4 4

23 Eliminate useless symbols, ε -productions and unit productions for the 4 CO4 4
following grammar:
S→0A0 | 1B1 | BB, A→C, B→S | A, C→S | ε

24 Give CFG for following languages: 4 CO4 4


1). L = a*b* 2). L = {an+2 bn | n >= 0}

25 Prove that – “If there is a CFG for the language L that has no Ʌ-productions, 4 CO4 4
then there is a CFG for L with no Ʌ-productions and no unit productions”.
Support your answer with the help of the following CFG: S →A | bb A →B | b B
→S | a

26 Convert the following CFG into its equivalent CNF: 4 CO4 4


S → TU | V
T → aTb | Ʌ
U→ cU | Ʌ
V →aVc | W
W →bW | Ʌ

27 Write transition table for PDA recognizing following language: { aibjck | j = i or j 7 CO5 4
= k }.

28 For the language L = { xcxr / x Є {a,b}* } design a PDA(Push Down Automata) 7 CO5 4
and trace it for string “abcba”.

29 Design and draw a deterministic PDA accepting “Balanced strings of Brackets” 7 CO5 4
which are accepted by following CFG.
S→ SS | [ S ] | { S } | Λ

30 Define PDA and design PDA for L = { x ∈ { a, b}* | na(x) > nb(x) } 7 CO5 5
31 Give transition table for deterministic PDA recognizing the following language. 7 CO5 4
{ an bn+m am | n,m ≥ 0)

32 Give transition table for deterministic PDA recognizing the following language. 7 CO5 4
{ aibjck | i, j, k ≥ 0 and j = i or j = k }

33 Design and draw a deterministic PDA accepting strings with more a’s than b’s. 7 CO5 5
Trace it for the string “abbabaa”.

34 Prove: The language pal= { x ∈ {a, b}* | x = xr } cannot be accepted by any 7 CO5 4
deterministic pushdown automaton.

35 Write PDA for following languages: 7 CO5 4


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

36 For the language L={set of strings over alphabet {a, b} with exactly twice as 7 CO5 4
many a’s as b’s} design a PDA (Push Down Automata) and trace it for the string
“abaabbaaaaabaab”

37 For the language L={ aibjck | i, j, k ≥ 0 and i + j = k } design a PDA (Push Down 7 CO5 4
Automata) and trace it for String “bbbbbccccc”

38 Given a CFG , G =( {S,A,B},{0,1},P,S) with P as follows 7 CO5 4


S --> 0B| 1A A --> 0S|1AA|0 B --> 1S| 0BB | 1
Design a PDA M corresponding to CFG, G. Show that the string 0001101110
belongs to CFL , L(G)

39 Consider following PDA machine M = ({p, q}, {0,1}, (x, z}, δ, q, Z) where δ is 7 CO5 5
given by
δ(q, 1, z) = (q, xz)
δ(q, 1, x) = (q, xx)
δ(q, ^, x) = (q,^)
δ(q, 0, x) = (p, x)
δ(p, 1, x) = (p, ɛ)
δ(p, 0, z) = (q, z)
Construct Equivalent CFG.

40 For the PDA, ( {q0, q1}, {0, 1}, {0, 1, z0}, δ, q0, z0, ϕ ), 7 CO5 5
where δ is
δ(q0, ɛ, z0) = {(q1, ɛ)}
δ(q0, 0, z0) = {(q0, 0z0)}
δ(q0, 0, 0) = {(q0, 00)}
δ(q0, 1, 0) = {(q0, 10)}
δ(q0, 1, 1) = {(q0, 11)}
δ(q0, 0, 1) = {(q1, ɛ)}
δ(q1, 0, 1) = {(q1, ɛ)}
δ(q1, 0, 0) = {(q1, ɛ)}
δ(q1, ɛ, z0) = {(q1, ɛ)}
Obtain CFG accepted by the above PDA.
41 Define PDA and give PDA to accept strings of palindrome. Show trace on the 7 CO5 4
string baab

42 Design pushdown automata to check well-formed parenthesis. 7 CO5 4

43 Convert the following CFG into its equivalent PDA. 7 CO5 4


S → AB
A → BB
B → AB
A→a
B→a|b

44 Show using the pumping lemma that the following language is not a CFL. 7 CO5 4
L={aibjck | i <j <k}

45 Explain push down automata with example. 7 CO5 4

46 Prove that the context-free languages are closed under union. 7 CO5 4

Module 6: Turing Machine

1 Write TM accepting Palindrome. 7 CO5 4

2 Write TM accepting {ss | s ϵ {a,b}*} 7 CO5 4

3 Define Turing Machine. Describe its capabilities. Also write short notes on 7 CO5 4
Universal Turing Machine.

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

5 Explain Universal TM and Church Turing Thesis 4 CO5 3

6 Explain Cook’s Theorem. 4 CO5 3

7 Draw a transition diagram for a Turing machine accepting the following 7 CO5 4
language. { an bn cn | n ≥ 0 }

8 Draw a transition diagram for a Turing machine accepting the following 7 CO5 4
language.
{ x є { a, b, c }* | na(x) = nb(x) = nc(x) }

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

10 Draw Turing Machine(TM) which recognizes words of the form { anbncn | n≥ 1 } 7 CO5 4

11 Design a Turing machine for deleting nth symbol from a string w from the 7 CO5 4
alphabet Σ = {0, 1}.

12 Give definition of Turing Machine. What do you mean by an instantaneous 4 CO5 4


description of a Turing Machine?
13 Define a Turing Machine. Design a Turing machine for deleting nth symbol 7 CO5 4
from a string w from the alphabet Σ ={0,1}.

14 Define Turing Machine and draw a TM to accept {a,b}*{aba}{a,b}* 7 CO5 4

15 Design a Turing machine to reverse the string over alphabet {0, 1} 7 CO5 3

16 Compare and contrast push down automata and Turing machine. 4 CO5 3

17 Enlist limitations of Turing machines. 4 CO5 2

18 Design a Turing machine which accepts the language consisting string which 7 CO5 3
contain aba as a substring over alphabets {a, b}

19 Draw a Turing Machine that accepts the language {anbnan | n ≥0} over {a,b}∗. 7 CO5 4
Also trace the TM on input string aaabbbaaa.

20 Draw a Turing Machine that accepts the language {xx | x ∈{a,b}∗}. Also trace 7 CO5 4
the TM on input string aa.

21 What is Turing Machine? Write advantages of TM over FSM. 7 CO5 2

Prof. Shalu Peshwani Dr. Jay Dave

Subject Coordinator Head of the Department

You might also like