51. Let L be set of strings from alphabet. The Kleen closure of L is given as
L′=⋃i=0Li
L+=⋃i=1Li
L′=⋃i=0Li
L+=⋃i=1Li
Show me the answer
Answer: 3. L′=⋃i=0Li
Explanation:
The Kleene closure of L is defined as L′=⋃i=0Li.
52. If a source language supports some macro pre-processor functions then these functions can be implemented in
Lexical analysis phase
Code generation
Parsing
Syntax analysis phase
Show me the answer
Answer: 1. Lexical analysis phase
Explanation:
Macro pre-processor functions are typically implemented in the lexical analysis phase.
53. If e1 and e2 are the regular expressions denoting the language L1 and L2 respectively, then which of the following is wrong?
{e1}+{e2} is regular expression denoting L1∪L2
e2e3 regular expression denoting L1L2
∅ is not regular expression
{e1}∗ is regular expression denoting L∗
Show me the answer
Answer: 3. ∅ is not regular expression
Explanation:
The empty set ∅ is a valid regular expression.
54. The regular expression (a+b)∗ denotes all strings
With zero or more instances of a and b both simultaneously
With one or more instances of a and b
Equal to regular expression (a∗+b)∗
Any combination of a's and b's including null string
Show me the answer
Answer: 4. Any combination of a's and b's including null string
Explanation:
The regular expression (a+b)∗ denotes any combination of a's and b's, including the null string.
55. Every CFG can be transferred into equivalent
Greiback normal form
Either (a) or (b)
CNF
All of the above
Show me the answer
Answer: 4. All of the above
Explanation:
Every context-free grammar (CFG) can be converted into Greibach Normal Form (GNF) or Chomsky Normal Form (CNF).
56. Consider the following regular expression
R=(ab+abb)∗
Which of the following is not in R?
Ababab
Abbab
Abababbbab
Abbabbbab
Show me the answer
Answer: 1. Ababab
Explanation:
The string ababab does not fit the pattern (ab+abb)∗.
57. In the figure shown, a DFA m has start state A and accepting state D. Which of the following regular expression denoted the set of all words accepted by m?
001
(0+1)∗011
10∗1∗0
1∗0∗001
Show me the answer
Answer: 2. (0+1)∗011
Explanation:
The regular expression (0+1)∗011 matches the language accepted by the DFA.
58. Which of the following is most general phase-structured grammar?
Regular
Context-free
Context-sensitive
None of these
Show me the answer
Answer: 3. Context-sensitive
Explanation:
Context-sensitive grammars are the most general phase-structured grammars.
59. Context-free grammar can be recognized by
Finite state automation
2-way linear bounded automata
Push down automata
Both (B) and (C) above
Show me the answer
Answer: 4. Both (B) and (C) above
Explanation:
Context-free grammars can be recognized by pushdown automata and 2-way linear bounded automata.
60. Context sensitive grammar (CSG) can be recognized by
Finite state automata
Push down automata
2-way linear bounded automata
None of these
Show me the answer
Answer: 3. 2-way linear bounded automata
Explanation:
Context-sensitive grammars are recognized by 2-way linear bounded automata.
61. Consider the grammar G, where the productions are numbered as shown
E→E+T
E→T
T→T∗F
T→F
F→e
F→a
If a shift-reduce (bottom-up) parser writes the production number used immediately after performing any reduction, what will be printed if the parser input is a+a∗a?
62461
6262441
64642331
64264631
Show me the answer
Answer: 2. 6262441
Explanation:
The sequence of reductions for the input a+a∗a corresponds to the production numbers 6, 2, 6, 2, 4, 4, 1.
62. Which sentence can be generated by
S→As/bAA→d/ccA
Becddd
abbbd
aabccd
ababccd
Show me the answer
Answer: 3. aabccd
Explanation:
The string aabccd can be generated by the given grammar.
63. Which of the following recognizes variables prefixes of the grammar?
DFA
NFA
Both errors can be detected
None of these
Show me the answer
Answer: 1. DFA
Explanation:
A Deterministic Finite Automaton (DFA) can recognize variable prefixes of the grammar.
64. Dynamic errors can be detected
Only at compile time
Only at run time
Both at compile time and at run time
None of these
Show me the answer
Answer: 2. Only at run time
Explanation:
Dynamic errors are detected during the execution (run time) of the program.
65. Compiler is a software which converts
High level language program into low level language program
Source program into object program
Program in high level language into program in low level language
Program in source language into program in object language
Show me the answer
Answer: 2. Source program into object program
Explanation:
A compiler converts the source program into an object program.
66. The language L={anbmcnbm/n≥1,m≥1}.
Is a context free
Both (a) and (b)
Is not context free
None of these
Show me the answer
Answer: 3. Is not context free
Explanation:
The language L is not context-free as it requires matching counts of a's, b's, and c's.
67. The language L={0n1n2n where n>0} is a
CFL
Context-sensitive language
Regular language
Recursive enumerable language
Show me the answer
Answer: 2. Context-sensitive language
Explanation:
The language L is context-sensitive as it requires matching counts of 0's, 1's, and 2's.
68. Which of the choice in an operator grammar equivalent for
S→SAS/aA→bSb/b
Assume S is start symbol
S→SAS/a,A→bSb/b
S→SbAbS/a,A→b
S→SbSbS/SbS/a
S→SbS/b
Show me the answer
Answer: 3. S→SbSbS/SbS/a
Explanation:
The grammar S→SbSbS/SbS/a is equivalent to the given operator grammar.
69. Let S and T be language over Σ={a,b} represent by regular expression (a+b∗)∗ and (a+b)∗ respectively then
S⊂T
T⊂S
S=T
S∩T=0
Show me the answer
Answer: 3. S=T
Explanation:
The regular expressions (a+b∗)∗ and (a+b)∗ are equivalent.
70. Let L denote the language generated by the grammar S→050100 then
L=0∗
L is regular but not 0∗
L is context free but not regular
L is not context free
Show me the answer
Answer: 3. L is context free but not regular
Explanation:
The language L generated by the grammar is context-free but not regular.
71. Consider the regular expression (0+1)(0+1)∗......n times. The minimum state finite automation that recognizes the language represented by this regular expression contains
n states
n+2 states
n+1 states
None of these
Show me the answer
Answer: 3. n+1 states
Explanation:
The minimum state finite automaton for the regular expression (0+1)(0+1)∗ repeated n times requires n+1 states.
72. A grammar that is both left and right recursive for non-terminal is
Ambiguous
Information is not sufficient
Unambiguous
None of these
Show me the answer
Answer: 1. Ambiguous
Explanation:
A grammar that is both left and right recursive for a non-terminal is ambiguous.
73. If the regular set A is represented by A=(01+1)∗ and the regular set B represented by B=[(01)∗1∗] then
A⊂B
A and B are uncomparable
B⊂A
A=B
Show me the answer
Answer: 4. A=B
Explanation:
The regular sets A and B are equivalent.
74. Which of the following can be recognized by a DFA
The number 1, 2, 4 ......xn......written in binary
The number 1, 2, 4, ......xn......written in un binary
The set of binary strings in which the number of zeros is the same as the number of ones
The set {1,101,11011,1110111...}
Show me the answer
Answer: 1. The number 1, 2, 4 ......xn......written in binary
Explanation:
A DFA can recognize the set of numbers written in binary.
75. The string 1101 does not belong to the set represented by
110′(0+1)
(10)∗(01)∗(00+11)∗
1(0+1)∗101
[00+(11)∗0]
Show me the answer
Answer: 2. (10)∗(01)∗(00+11)∗
Explanation:
The string 1101 does not fit the pattern (10)∗(01)∗(00+11)∗.
76. Regarding the power of recognition of language, which of the following statements is false?
The NDFA is equivalent to DFA
NPDA is equivalent to DPDA
Non-deterministic Turing machines are equivalent to deterministic push-down automata
Multi-tape Turing-machine are equivalent to Single-Tape Turing machine
Show me the answer
Answer: 3. Non-deterministic Turing machines are equivalent to deterministic push-down automata
Explanation:
Non-deterministic Turing machines are more powerful than deterministic push-down automata.
77. Let ∗ be defined as a∗b=a+y. Let c=a∗b; value of c∗a is
a+b
a
0
1
Show me the answer
Answer: 2. a
Explanation:
The operation c∗a results in a.
78. Which one of the following regular expressions over {0,1} denotes the set of all string not containing 100 as a substring?
0′(1+0)
1′01
0′1010
0′(10+1)
Show me the answer
Answer: 4. 0′(10+1)
Explanation:
The regular expression 0′(10+1) ensures that the substring 100 is not present.
79. Which of the following languages over {a,b,c} is accepted by deterministic push down automata?
{ω⊂ωb/ω∈(a,b)}
{ωωb/ω∈{a,b,c}}
{abcm/n≥0}
{ω/ω is palindrome {a,b,c}}
Show me the answer
Answer: 1. {ω⊂ωb/ω∈(a,b)}
Explanation:
The language {ω⊂ωb/ω∈(a,b)} is accepted by a deterministic pushdown automaton.
80. Two of following four regular expressions are equivalent, which two?
(00)∗(ϵ+0)
(00)∗
0∗
0(00)∗
Show me the answer
Answer: 2. (00)∗ and 3. 0∗
Explanation:
The regular expressions (00)∗ and 0∗ are equivalent.
81. The major difference between a Moore and Mealy machine is that
The output of the former depends only on the present state and present input
The output of the former depends only on the present state
The output of the former depends only on the present input
All of these
Show me the answer
Answer: 2. The output of the former depends only on the present state
Explanation:
In a Moore machine, the output depends only on the present state, while in a Mealy machine, it depends on both the present state and input.
82. Finite state machine can recognize
Any grammar
Any unambiguous grammar
Only CG
Only regular grammar
Show me the answer
Answer: 4. Only regular grammar
Explanation:
Finite state machines can recognize only regular grammars.
83. Pumping Lemma is generally used for proving
A given grammar is regular
A given grammar is not regular
Whether two given regular expressions are equivalent or not
None of these
Show me the answer
Answer: 2. A given grammar is not regular
Explanation:
The Pumping Lemma is used to prove that a language is not regular.
84. Which of the following is not regular?
String of 0's whose length is a perfect square
Set of all palindrome made up of 0's and 1's
Set of all 0's whose length is prime
All of these
Show me the answer
Answer: 4. All of these
Explanation:
None of the given languages are regular.
85. Choose the correct statements
A={anbn/n=0,1,2,3,…} is regular language
The set B of all strings of equal number of a's and b's defines a regular language
L(A∗B∗)∩B gives the set A
None of these
Show me the answer
Answer: 4. None of these
Explanation:
None of the statements are correct regarding regular languages.
86. The basic limitations of finite state machine is that
It cannot remember arbitrary large amount of information
It cannot recognize grammars are regular
It sometimes recognize grammars are not regular
All of these
Show me the answer
Answer: 1. It cannot remember arbitrary large amount of information
Explanation:
Finite state machines have limited memory and cannot remember arbitrarily large amounts of information.
87. Palindrome cannot be recognized by any FSM because
An FSM can't remember arbitrary information
An FSM can't deterministically fix the mid point
Both (A) and (B)
None of these
Show me the answer
Answer: 3. Both (A) and (B)
Explanation:
Finite state machines cannot recognize palindromes due to their inability to remember arbitrary information and fix the mid-point.
88. An FSM can be considered to be a TM (Turing machine)
Of finite tape length, rewinding capability and unidirectional tape movement
Of finite tape length, without rewinding and unidirectional tape movement
Of finite tape length, rewinding capability and bidirectional tape movement
All of these
Show me the answer
Answer: 2. Of finite tape length, without rewinding and unidirectional tape movement
Explanation:
A finite state machine can be considered a Turing machine with finite tape length, no rewinding, and unidirectional tape movement.
89. Turing machine is more powerful than FSM because
Tape movement is confined to one direction
It has no finite state control
It has the capability to remember arbitrary long sequence of input symbols
None of these
Show me the answer
Answer: 3. It has the capability to remember arbitrary long sequence of input symbols
Explanation:
Turing machines are more powerful due to their ability to remember arbitrarily long sequences of input symbols.
90. For given picture the FSM recognizes
All strings
ϵ-alone
No strings
None of these
Show me the answer
Answer: 2. ϵ-alone
Explanation:
The FSM recognizes only the empty string ϵ.
91. In given picture, the FSM represents
Mealy machine
Kleen machine
Moore machine
All of these
Show me the answer
Answer: 1. Mealy machine
Explanation:
The FSM represents a Mealy machine as its output depends on both the current state and input.
92. The language of all words with at least 2a's can be described by the regular expression:
(ab)∗a and a(ba)∗
b∗a∗b∗a(a+b)∗
(a+b)∗ab∗a(a+b)∗
All of these
Show me the answer
Answer: 4. All of these
Explanation:
All the given regular expressions describe the language of words with at least 2a's.
93. Which of the following pairs of regular expressions are not equivalent?
(ab)∗a and a(ba)∗
b∗a∗b∗a(a+b)∗
(a+b)∗ab∗a(a+b)∗
All of these
Show me the answer
Answer: 2. b∗a∗b∗a(a+b)∗
Explanation:
The regular expression b∗a∗b∗a(a+b)∗ is not equivalent to the others.
94. Any given transition graph has an equivalent
Regular expression
NDFSM
DFSM
All of these
Show me the answer
Answer: 4. All of these
Explanation:
A transition graph can be converted into a regular expression, NDFSM, or DFSM.
95. The following CFG
S→aS/bS/a/b is equivalent to regular expression
(a+b)
(a+b)(a+b)
(a+b)(a+b)
All of these
Show me the answer
Answer: 3. (a+b)(a+b)
Explanation:
The CFG is equivalent to the regular expression (a+b)(a+b).
96. Any string of terminals that can be generated by the following CFG is
S→XYX→ax/bx/aY→Ya/Yb/a
Has at least one 'b'
Has no consecutive a's or b's
Should end in a 'a'
Has at least two a's
Show me the answer
Answer: 4. Has at least two a's
Explanation:
The CFG generates strings with at least two a's.
97. The following CFG
S→aB/BaA→b/aS/BaaB→a/bS/aBB
Generates strings of terminals that have
Equal number of a's and b's
Odd number of a's and odd number of b's
Even number of a's and even number of a's
Odd number of a's and even number of a's
Show me the answer
Answer: 1. Equal number of a's and b's
Explanation:
The CFG generates strings with an equal number of a's and b's.
98. The set {anbn/n=1,2,3,…} can be generated by the CFG
S→ab/aSb
S→ab/aSb/ϵ
S→aaSbb/ab
None of these
Show me the answer
Answer: 1. S→ab/aSb
Explanation:
The CFG S→ab/aSb generates the set {anbn/n=1,2,3,…}.
99. Choose the correct statement
All language can be generated CFG
Any regular language has an equivalent CFG
Some non-regular languages can't be generated by an CFG
Some regular language can't be simulated by an FSM
Show me the answer
Answer: 2. Any regular language has an equivalent CFG
Explanation:
Every regular language can be represented by a context-free grammar (CFG).
100. Which of the following CFG's can't be simulated by an FSM?
S→Sa/a
S→abX,X→cY,Y→a/aX
S→aSb/ab
None of these
Show me the answer
Answer: 3. S→aSb/ab
Explanation:
The CFG S→aSb/ab generates a non-regular language and cannot be simulated by an FSM.