set-2

51. Let LL be set of strings from alphabet. The Kleen closure of LL is given as

  1. L=i=0LiL' = \bigcup_{i=0} L^i

  2. L+=i=1LiL^+ = \bigcup_{i=1} L^i

  3. L=i=0LiL' = \bigcup_{i=0} L^i

  4. L+=i=1LiL^+ = \bigcup_{i=1} L^i

Show me the answer

Answer: 3. L=i=0LiL' = \bigcup_{i=0} L^i

Explanation:

  • The Kleene closure of LL is defined as L=i=0LiL' = \bigcup_{i=0} L^i.

52. If a source language supports some macro pre-processor functions then these functions can be implemented in

  1. Lexical analysis phase

  2. Code generation

  3. Parsing

  4. 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 e1e1 and e2e2 are the regular expressions denoting the language L1L1 and L2L2 respectively, then which of the following is wrong?

  1. {e1}+{e2}\{e_1\} + \{e_2\} is regular expression denoting L1L2L1 \cup L2

  2. e2e3e2 e3 regular expression denoting L1L2L1L2

  3. \emptyset is not regular expression

  4. {e1}\{e_1\}^* is regular expression denoting LL^*

Show me the answer

Answer: 3. \emptyset is not regular expression

Explanation:

  • The empty set \emptyset is a valid regular expression.

54. The regular expression (a+b)(a + b)^* denotes all strings

  1. With zero or more instances of aa and bb both simultaneously

  2. With one or more instances of aa and bb

  3. Equal to regular expression (a+b)(a^* + b)^*

  4. Any combination of aa's and bb's including null string

Show me the answer

Answer: 4. Any combination of aa's and bb's including null string

Explanation:

  • The regular expression (a+b)(a + b)^* denotes any combination of aa's and bb's, including the null string.

55. Every CFG can be transferred into equivalent

  1. Greiback normal form

  2. Either (a) or (b)

  3. CNF

  4. 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)R = (ab + abb)^* Which of the following is not in RR?

  1. Ababab

  2. Abbab

  3. Abababbbab

  4. Abbabbbab

Show me the answer

Answer: 1. Ababab

Explanation:

  • The string abababababab does not fit the pattern (ab+abb)(ab + abb)^*.

57. In the figure shown, a DFA mm has start state AA and accepting state DD. Which of the following regular expression denoted the set of all words accepted by mm?

  1. 001

  2. (0+1)011(0 + 1)^* 011

  3. 101010^* 1^* 0

  4. 100011^* 0^* 001

Show me the answer

Answer: 2. (0+1)011(0 + 1)^* 011

Explanation:

  • The regular expression (0+1)011(0 + 1)^* 011 matches the language accepted by the DFA.

58. Which of the following is most general phase-structured grammar?

  1. Regular

  2. Context-free

  3. Context-sensitive

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

  1. Finite state automation

  2. 2-way linear bounded automata

  3. Push down automata

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

  1. Finite state automata

  2. Push down automata

  3. 2-way linear bounded automata

  4. 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 GG, where the productions are numbered as shown

  1. EE+TE \rightarrow E + T

  2. ETE \rightarrow T

  3. TTFT \rightarrow T^* F

  4. TFT \rightarrow F

  5. FeF \rightarrow e

  6. FaF \rightarrow 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+aaa + a * a?

  1. 62461

  2. 6262441

  3. 64642331

  4. 64264631

Show me the answer

Answer: 2. 6262441

Explanation:

  • The sequence of reductions for the input a+aaa + a * a corresponds to the production numbers 6, 2, 6, 2, 4, 4, 1.

62. Which sentence can be generated by

SAs/bAS \rightarrow As/bA Ad/ccAA \rightarrow d/ccA

  1. Becddd

  2. abbbd

  3. aabccd

  4. ababccd

Show me the answer

Answer: 3. aabccd

Explanation:

  • The string aabccdaabccd can be generated by the given grammar.

63. Which of the following recognizes variables prefixes of the grammar?

  1. DFA

  2. NFA

  3. Both errors can be detected

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

  1. Only at compile time

  2. Only at run time

  3. Both at compile time and at run time

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

  1. High level language program into low level language program

  2. Source program into object program

  3. Program in high level language into program in low level language

  4. 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/n1,m1}L = \{a^n b^m c^n b^m / n \geq 1, m \geq 1\}.

  1. Is a context free

  2. Both (a) and (b)

  3. Is not context free

  4. None of these

Show me the answer

Answer: 3. Is not context free

Explanation:

  • The language LL is not context-free as it requires matching counts of aa's, bb's, and cc's.

67. The language L={0n1n2n where n>0}L = \{0n 1n 2n \text{ where } n > 0\} is a

  1. CFL

  2. Context-sensitive language

  3. Regular language

  4. Recursive enumerable language

Show me the answer

Answer: 2. Context-sensitive language

Explanation:

  • The language LL is context-sensitive as it requires matching counts of 00's, 11's, and 22's.

68. Which of the choice in an operator grammar equivalent for

SSAS/aS \rightarrow SAS/a AbSb/bA \rightarrow bSb/b Assume SS is start symbol

  1. SSAS/a,AbSb/bS \rightarrow SAS/a, A \rightarrow bSb/b

  2. SSbAbS/a,AbS \rightarrow SbAbS/a, A \rightarrow b

  3. SSbSbS/SbS/aS \rightarrow SbSbS/SbS/a

  4. SSbS/bS \rightarrow SbS/b

Show me the answer

Answer: 3. SSbSbS/SbS/aS \rightarrow SbSbS/SbS/a

Explanation:

  • The grammar SSbSbS/SbS/aS \rightarrow SbSbS/SbS/a is equivalent to the given operator grammar.

69. Let SS and TT be language over Σ={a,b}\Sigma = \{a, b\} represent by regular expression (a+b)(a + b^*) * and (a+b)(a + b)^* respectively then

  1. STS \subset T

  2. TST \subset S

  3. S=TS = T

  4. ST=0S \cap T = 0

Show me the answer

Answer: 3. S=TS = T

Explanation:

  • The regular expressions (a+b)(a + b^*) * and (a+b)(a + b)^* are equivalent.

70. Let LL denote the language generated by the grammar S050100S \rightarrow 050100 then

  1. L=0L = 0^*

  2. LL is regular but not 00^*

  3. LL is context free but not regular

  4. LL is not context free

Show me the answer

Answer: 3. LL is context free but not regular

Explanation:

  • The language LL generated by the grammar is context-free but not regular.

71. Consider the regular expression (0+1)(0+1)(0 + 1) (0 + 1)^*......n times. The minimum state finite automation that recognizes the language represented by this regular expression contains

  1. nn states

  2. n+2n + 2 states

  3. n+1n + 1 states

  4. None of these

Show me the answer

Answer: 3. n+1n + 1 states

Explanation:

  • The minimum state finite automaton for the regular expression (0+1)(0+1)(0 + 1) (0 + 1)^* repeated nn times requires n+1n + 1 states.

72. A grammar that is both left and right recursive for non-terminal is

  1. Ambiguous

  2. Information is not sufficient

  3. Unambiguous

  4. 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 AA is represented by A=(01+1)A = (01 + 1)^* and the regular set BB represented by B=[(01)1]B = [(01)^* 1^*] then

  1. ABA \subset B

  2. AA and BB are uncomparable

  3. BAB \subset A

  4. A=BA = B

Show me the answer

Answer: 4. A=BA = B

Explanation:

  • The regular sets AA and BB are equivalent.

74. Which of the following can be recognized by a DFA

  1. The number 1, 2, 4 ......xnx^n......written in binary

  2. The number 1, 2, 4, ......xnx^n......written in un binary

  3. The set of binary strings in which the number of zeros is the same as the number of ones

  4. The set {1,101,11011,1110111...}\{1, 101, 11011, 1110111 ...\}

Show me the answer

Answer: 1. The number 1, 2, 4 ......xnx^n......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

  1. 110(0+1)110'(0+1)

  2. (10)(01)(00+11)(10)^* (01)^* (00 + 11)^*

  3. 1(0+1)1011(0 + 1)^* 101

  4. [00+(11)0][00+(11)^* 0]

Show me the answer

Answer: 2. (10)(01)(00+11)(10)^* (01)^* (00 + 11)^*

Explanation:

  • The string 1101 does not fit the pattern (10)(01)(00+11)(10)^* (01)^* (00 + 11)^*.

76. Regarding the power of recognition of language, which of the following statements is false?

  1. The NDFA is equivalent to DFA

  2. NPDA is equivalent to DPDA

  3. Non-deterministic Turing machines are equivalent to deterministic push-down automata

  4. 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 ab=a+ya * b = a + y. Let c=abc = a * b; value of cac * a is

  1. a+ba + b

  2. aa

  3. 00

  4. 11

Show me the answer

Answer: 2. aa

Explanation:

  • The operation cac * a results in aa.

78. Which one of the following regular expressions over {0,1}\{0, 1\} denotes the set of all string not containing 100 as a substring?

  1. 0(1+0)0' (1 + 0)

  2. 1011' 01

  3. 010100' 1010

  4. 0(10+1)0' (10 + 1)

Show me the answer

Answer: 4. 0(10+1)0' (10 + 1)

Explanation:

  • The regular expression 0(10+1)0' (10 + 1) ensures that the substring 100 is not present.

79. Which of the following languages over {a,b,c}\{a, b, c\} is accepted by deterministic push down automata?

  1. {ωωb/ω(a,b)}\{\omega \subset \omega^b / \omega \in (a, b)\}

  2. {ωωb/ω{a,b,c}}\{\omega \omega^b / \omega \in \{a, b, c\}\}

  3. {abcm/n0}\{a^b c^m / n \geq 0\}

  4. {ω/ω is palindrome {a,b,c}}\{\omega / \omega \text{ is palindrome } \{a, b, c\}\}

Show me the answer

Answer: 1. {ωωb/ω(a,b)}\{\omega \subset \omega^b / \omega \in (a, b)\}

Explanation:

  • The language {ωωb/ω(a,b)}\{\omega \subset \omega^b / \omega \in (a, b)\} is accepted by a deterministic pushdown automaton.

80. Two of following four regular expressions are equivalent, which two?

  1. (00)(ϵ+0)(00)^* (\epsilon + 0)

  2. (00)(00)^*

  3. 00^*

  4. 0(00)0(00)^*

Show me the answer

Answer: 2. (00)(00)^* and 3. 00^*

Explanation:

  • The regular expressions (00)(00)^* and 00^* are equivalent.

81. The major difference between a Moore and Mealy machine is that

  1. The output of the former depends only on the present state and present input

  2. The output of the former depends only on the present state

  3. The output of the former depends only on the present input

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

  1. Any grammar

  2. Any unambiguous grammar

  3. Only CG

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

  1. A given grammar is regular

  2. A given grammar is not regular

  3. Whether two given regular expressions are equivalent or not

  4. 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?

  1. String of 0's whose length is a perfect square

  2. Set of all palindrome made up of 0's and 1's

  3. Set of all 0's whose length is prime

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

  1. A={anbn/n=0,1,2,3,}A = \{a^n b^n / n = 0, 1, 2, 3, \ldots\} is regular language

  2. The set BB of all strings of equal number of aa's and bb's defines a regular language

  3. L(AB)BL(A^* B^*) \cap B gives the set AA

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

  1. It cannot remember arbitrary large amount of information

  2. It cannot recognize grammars are regular

  3. It sometimes recognize grammars are not regular

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

  1. An FSM can't remember arbitrary information

  2. An FSM can't deterministically fix the mid point

  3. Both (A) and (B)

  4. 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)

  1. Of finite tape length, rewinding capability and unidirectional tape movement

  2. Of finite tape length, without rewinding and unidirectional tape movement

  3. Of finite tape length, rewinding capability and bidirectional tape movement

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

  1. Tape movement is confined to one direction

  2. It has no finite state control

  3. It has the capability to remember arbitrary long sequence of input symbols

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

  1. All strings

  2. ϵ\epsilon-alone

  3. No strings

  4. None of these

Show me the answer

Answer: 2. ϵ\epsilon-alone

Explanation:

  • The FSM recognizes only the empty string ϵ\epsilon.

91. In given picture, the FSM represents

  1. Mealy machine

  2. Kleen machine

  3. Moore machine

  4. 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 2a2a's can be described by the regular expression:

  1. (ab)a(ab)^*a and a(ba)a(ba)^*

  2. baba(a+b)b^*a^*b^*a(a + b)^*

  3. (a+b)aba(a+b)(a + b)^*ab^*a(a + b)^*

  4. 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 2a2a's.

93. Which of the following pairs of regular expressions are not equivalent?

  1. (ab)a(ab)^*a and a(ba)a(ba)^*

  2. baba(a+b)b^*a^*b^*a(a + b)^*

  3. (a+b)aba(a+b)(a + b)^*ab^*a(a + b)^*

  4. All of these

Show me the answer

Answer: 2. baba(a+b)b^*a^*b^*a(a + b)^*

Explanation:

  • The regular expression baba(a+b)b^*a^*b^*a(a + b)^* is not equivalent to the others.

94. Any given transition graph has an equivalent

  1. Regular expression

  2. NDFSM

  3. DFSM

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

SaS/bS/a/bS \rightarrow aS/bS/a/b is equivalent to regular expression

  1. (a+b)(a + b)

  2. (a+b)(a+b)(a + b)(a + b)

  3. (a+b)(a+b)(a + b)(a + b)

  4. All of these

Show me the answer

Answer: 3. (a+b)(a+b)(a + b)(a + b)

Explanation:

  • The CFG is equivalent to the regular expression (a+b)(a+b)(a + b)(a + b).

96. Any string of terminals that can be generated by the following CFG is

SXYS \rightarrow XY Xax/bx/aX \rightarrow ax/bx/a YYa/Yb/aY \rightarrow Ya/Yb/a

  1. Has at least one 'b'

  2. Has no consecutive aa's or bb's

  3. Should end in a 'a'

  4. Has at least two aa's

Show me the answer

Answer: 4. Has at least two aa's

Explanation:

  • The CFG generates strings with at least two aa's.

97. The following CFG

SaB/BaS \rightarrow aB/Ba Ab/aS/BaaA \rightarrow b/aS/Baa Ba/bS/aBBB \rightarrow a/bS/aBB Generates strings of terminals that have

  1. Equal number of aa's and bb's

  2. Odd number of aa's and odd number of bb's

  3. Even number of aa's and even number of aa's

  4. Odd number of aa's and even number of aa's

Show me the answer

Answer: 1. Equal number of aa's and bb's

Explanation:

  • The CFG generates strings with an equal number of aa's and bb's.

98. The set {anbn/n=1,2,3,}\{a^n b^n / n = 1, 2, 3, \ldots\} can be generated by the CFG

  1. Sab/aSbS \rightarrow ab/aSb

  2. Sab/aSb/ϵS \rightarrow ab/aSb/\epsilon

  3. SaaSbb/abS \rightarrow aaSbb/ab

  4. None of these

Show me the answer

Answer: 1. Sab/aSbS \rightarrow ab/aSb

Explanation:

  • The CFG Sab/aSbS \rightarrow ab/aSb generates the set {anbn/n=1,2,3,}\{a^n b^n / n = 1, 2, 3, \ldots\}.

99. Choose the correct statement

  1. All language can be generated CFG

  2. Any regular language has an equivalent CFG

  3. Some non-regular languages can't be generated by an CFG

  4. 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?

  1. SSa/aS \rightarrow Sa/a

  2. SabX,XcY,Ya/aXS \rightarrow abX, X \rightarrow cY, Y \rightarrow a/aX

  3. SaSb/abS \rightarrow aSb/ab

  4. None of these

Show me the answer

Answer: 3. SaSb/abS \rightarrow aSb/ab

Explanation:

  • The CFG SaSb/abS \rightarrow aSb/ab generates a non-regular language and cannot be simulated by an FSM.

Last updated