set-2
51. Let be set of strings from alphabet. The Kleen closure of is given as
Show me the answer
Answer: 3.
Explanation:
- The Kleene closure of is defined as .
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 and are the regular expressions denoting the language and respectively, then which of the following is wrong?
- is regular expression denoting
- regular expression denoting
- is not regular expression
- is regular expression denoting
Show me the answer
Answer: 3. is not regular expression
Explanation:
- The empty set is a valid regular expression.
54. The regular expression denotes all strings
- With zero or more instances of and both simultaneously
- With one or more instances of and
- Equal to regular expression
- Any combination of ‘s and ‘s including null string
Show me the answer
Answer: 4. Any combination of ‘s and ‘s including null string
Explanation:
- The regular expression denotes any combination of ‘s and ‘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
Which of the following is not in ?
- Ababab
- Abbab
- Abababbbab
- Abbabbbab
Show me the answer
Answer: 1. Ababab
Explanation:
- The string does not fit the pattern .
57. In the figure shown, a DFA has start state and accepting state . Which of the following regular expression denoted the set of all words accepted by ?
- 001
Show me the answer
Answer: 2.
Explanation:
- The regular expression 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 , where the productions are numbered as shown
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 ?
- 62461
- 6262441
- 64642331
- 64264631
Show me the answer
Answer: 2. 6262441
Explanation:
- The sequence of reductions for the input corresponds to the production numbers 6, 2, 6, 2, 4, 4, 1.
62. Which sentence can be generated by
- Becddd
- abbbd
- aabccd
- ababccd
Show me the answer
Answer: 3. aabccd
Explanation:
- The string 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 .
- 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 is not context-free as it requires matching counts of ‘s, ‘s, and ‘s.
67. The language is a
- CFL
- Context-sensitive language
- Regular language
- Recursive enumerable language
Show me the answer
Answer: 2. Context-sensitive language
Explanation:
- The language is context-sensitive as it requires matching counts of ‘s, ‘s, and ‘s.
68. Which of the choice in an operator grammar equivalent for
Assume is start symbol
Show me the answer
Answer: 3.
Explanation:
- The grammar is equivalent to the given operator grammar.
69. Let and be language over represent by regular expression and respectively then
Show me the answer
Answer: 3.
Explanation:
- The regular expressions and are equivalent.
70. Let denote the language generated by the grammar then
- is regular but not
- is context free but not regular
- is not context free
Show me the answer
Answer: 3. is context free but not regular
Explanation:
- The language generated by the grammar is context-free but not regular.
71. Consider the regular expression …n times. The minimum state finite automation that recognizes the language represented by this regular expression contains
- states
- states
- states
- None of these
Show me the answer
Answer: 3. states
Explanation:
- The minimum state finite automaton for the regular expression repeated times requires 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 is represented by and the regular set represented by then
- and are uncomparable
Show me the answer
Answer: 4.
Explanation:
- The regular sets and are equivalent.
74. Which of the following can be recognized by a DFA
- The number 1, 2, 4 ……written in binary
- The number 1, 2, 4, ……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
Show me the answer
Answer: 1. The number 1, 2, 4 ……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
Show me the answer
Answer: 2.
Explanation:
- The string 1101 does not fit the pattern .
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 . Let ; value of is
Show me the answer
Answer: 2.
Explanation:
- The operation results in .
78. Which one of the following regular expressions over denotes the set of all string not containing 100 as a substring?
Show me the answer
Answer: 4.
Explanation:
- The regular expression ensures that the substring 100 is not present.
79. Which of the following languages over is accepted by deterministic push down automata?
Show me the answer
Answer: 1.
Explanation:
- The language is accepted by a deterministic pushdown automaton.
80. Two of following four regular expressions are equivalent, which two?
Show me the answer
Answer: 2. and 3.
Explanation:
- The regular expressions and 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
- is regular language
- The set of all strings of equal number of ‘s and ‘s defines a regular language
- gives the set
- 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 ‘s can be described by the regular expression:
- and
- 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 ‘s.
93. Which of the following pairs of regular expressions are not equivalent?
- and
- All of these
Show me the answer
Answer: 2.
Explanation:
- The regular expression 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
is equivalent to regular expression
- All of these
Show me the answer
Answer: 3.
Explanation:
- The CFG is equivalent to the regular expression .
96. Any string of terminals that can be generated by the following CFG is
- Has at least one ‘b’
- Has no consecutive ‘s or ‘s
- Should end in a ‘a’
- Has at least two ‘s
Show me the answer
Answer: 4. Has at least two ‘s
Explanation:
- The CFG generates strings with at least two ‘s.
97. The following CFG
Generates strings of terminals that have
- Equal number of ‘s and ‘s
- Odd number of ‘s and odd number of ‘s
- Even number of ‘s and even number of ‘s
- Odd number of ‘s and even number of ‘s
Show me the answer
Answer: 1. Equal number of ‘s and ‘s
Explanation:
- The CFG generates strings with an equal number of ‘s and ‘s.
98. The set can be generated by the CFG
- None of these
Show me the answer
Answer: 1.
Explanation:
- The CFG generates the set .
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?
- None of these
Show me the answer
Answer: 3.
Explanation:
- The CFG generates a non-regular language and cannot be simulated by an FSM.