GATE 2001
60 questions
MCQ 601-mark 60
Questions 41–45 of 60
Consider the following languages :
L1 = {ww| w {a,b}*}
L2 = {w w {a,b} *, is the reverse of w}
L3 = {| i is an integer}
L4 ={ | i is an integer}
Which of the languages are regular ?
L1 = {ww| w {a,b}*}
L2 = {w w {a,b} *, is the reverse of w}
L3 = {| i is an integer}
L4 ={ | i is an integer}
Which of the languages are regular ?
Answer: (D)
: the prefixes are pairwise distinguishable. The suffix takes into but takes () out of it. A DFA would need infinitely many states. Not regular.
: the same prefixes work with the suffix : is in but is not. Not regular.
: this is the set of strings of 0s of even length, with regular expression . Regular.
: let be the pumping length and take . Pumping up once gives a length between and , which is less than , so it is not a perfect square. Not regular.
So only is regular.
Answer: (D)
: the same prefixes work with the suffix : is in but is not. Not regular.
: this is the set of strings of 0s of even length, with regular expression . Regular.
: let be the pumping length and take . Pumping up once gives a length between and , which is less than , so it is not a perfect square. Not regular.
So only is regular.
Answer: (D)
Consider the following two statements :
S1: {} is a regular language
S2 : {} is a regular language
Which of the following statements is correct?
S1: {} is a regular language
S2 : {} is a regular language
Which of the following statements is correct?
Answer: (A)
S1 is regular. The language is , the strings of 0s of even length at least 2. A DFA on the alphabet with 3 states works: start, odd count, even count (final). The empty string is not accepted, so the start state is not final and needs its own state.
S2 is not regular. Let be the pumping length and take , which is in S2 with and . The pumped part lies in the first symbols, which are all 0. Pumping it down gives with , and then the number of final 0s is not . So the string is not in S2.
So only S1 is correct.
Answer: (A)
S2 is not regular. Let be the pumping length and take , which is in S2 with and . The pumped part lies in the first symbols, which are all 0. Pumping it down gives with , and then the number of final 0s is not . So the string is not in S2.
So only S1 is correct.
Answer: (A)
Which of the following statements true ?
Answer: (B)
- (B) is true: if and have grammars with start symbols and , add . This is a grammar for .
- (A) is false: a CFL may need a non-deterministic PDA. For example, needs a guess of where the middle is, and no DPDA can accept it.
- (C) is false: , and both are CFLs but the intersection is not.
- (D) is false: if CFLs were closed under complement, then with union they would be closed under intersection (since ), and (C) shows they are not.
Answer: (B)
- (A) is false: a CFL may need a non-deterministic PDA. For example, needs a guess of where the middle is, and no DPDA can accept it.
- (C) is false: , and both are CFLs but the intersection is not.
- (D) is false: if CFLs were closed under complement, then with union they would be closed under intersection (since ), and (C) shows they are not.
Answer: (B)
Consider the following problem x .
Given a Turing machine M over the input alphabet , any state q of M. And a word w ) does the computation of M on w visit the state q ?
Which of the following statements about x is correct ?
Given a Turing machine M over the input alphabet , any state q of M. And a word w ) does the computation of M on w visit the state q ?
Which of the following statements about x is correct ?
Answer: (B)
Partially decidable. Take the TM and make its only final state (all other final states become non-final), with M' stopping as soon as it enters . Run on this new machine . If M reaches on (the yes case), accepts. So the problem is partially decidable. If M never reaches , may run forever, so it gives no answer in the no case.
Undecidable. Reduce the halting problem to it. Given , build from M by adding a new state , and making every halting situation of M (a state and symbol with no move) go to . Then visits on exactly when M halts on w. A decider for the state entry problem would then decide the halting problem, which is impossible.
So x is undecidable but partially decidable.
Answer: (B)
Undecidable. Reduce the halting problem to it. Given , build from M by adding a new state , and making every halting situation of M (a state and symbol with no move) go to . Then visits on exactly when M halts on w. A decider for the state entry problem would then decide the halting problem, which is impossible.
So x is undecidable but partially decidable.
Answer: (B)
Which of the following statements is false ?
Answer: (A)
Correct Option: A
(A) We cannot have different Left Most Derivation and Right Most Derivation parse trees, BUT we can certainly have different LMD and RMD for a given string. (Here, LMD and RMD mean the order of the productions used in the derivation, and this order can be different.)
(D) is not the false statement, because IT IS TRUE that any LR(k) grammar IS NEVER AMBIGUOUS. So an ambiguous grammar can never be LR(K) for any k, however large k becomes.
(B) and (C) cannot be the answer, because LL(1) is a top-down parser and LALR is more powerful than SLR. So both are TRUE.