Saturday 26 January 2013

TOC mCQ Two

1.Consider three decision problems P1, P2 and P3. It is known that P1 is decidable and P2 is undecidable. Which one of the following is TRUE?
  1. P3 is decidable if P1 is reducible to P3
  2. P3 is undecidable if P3 is reducible to P2
  3. P3 is undecidable if P2 is reducible to P3
  4. P3 is decidable if P3 is reducible to P2’s complement
2.Consider three problems P1, P2 and P3. It is known that P1 has polynomial time solution and P2 is NP-complete and P3 is in NP. Which one of the following is true.
  1. P3 has polynomial time solution if P1 is polynomial time reducible to P3
  2. P3 is NP complete if P3 is polynomial time reducible to P2
  3. P3 is NP complete if P2 is reducible to P3
  4. P3 has polynomial time complexity and P3 is reducible to P2
3.Consider the FSA M
The language recognized by M is
  1. {w ∊ {a, b}* | every a in w is followed by exactly two b’s}
  2. {w ∊ {a, b}* | every a in w is followed by atleast two b’s}
  3. {w ∊ {a, b}* |w contains the substring ‘abb’}
  4. {w ∊ {a, b}* |w does not contain ‘aa’ as substring}
4.Let Nf and Np denote the classes of languages accepted by nondeterministic FSA and nondeterministic PDA, respectively. Let Df and Dp denote the classes of languages accepted by deterministic FSA and PDA respectively. Which of the following is TRUE?
Some of these questions have appeared in GATE examinations.
  1. DfNf
DpNp
  1. DfNf
Dp = Np
  1. Df = Nf
DpNp
  1. Df = Nf
Dp = Np
5.Consider the languages
L1 = {anbncm|n, m > 0} and L2 = {anbmcm|n, m > 0}
Which one of the following statements is false?
  1. L1L2 is a CFL
  2. L1L2 is a CFL
  3. L1L2 is inherently ambiguous
  4. L1L2 is a CSL
6.Consider the languages
L1 = {anbmcndp|n, m, p > 0} and L2 = {anbmcpdm|n, m, p> 0}
Which one of the following statements is false?
  1. L1L2 is a CFL
  2. L1L2 is a CFL
  3. L1L2 is inherently ambiguous
  4. L1L2 is a CSL
7.Consider the languages
L1 = {anbmcmdn|n, m > 0} and L2 = {anbncmdm|n, m > 0}
Which one of the following statements is false?
  1. L1L2 is a CFL
  2. L1L2 is a CFL
  3. L1 and L2 are CFL
  4. L1L2 is a CSL
8.Let L and be a language and its complement. Which one of the following possibilities will not hold?
  1. L and are recursive
  2. L is recursively enumerable but not recursive is not recursively enumerable
  3. L and are not recursively enumerable
  4. L and are recursively enumerable but not recursive
9.Let L1 be a recursive language and let L2 be a recursively enumerable language which is not recursive. Which one of the following is TRUE?
  1. is recursive, is recursively enumerable.
  2. is recursive, is not recursively enumerable.
  3. and are recursively enumerable.
  4. is recursively enumerable and is recursive.
10.Consider the languages
L1 = {wwR|w ∊ {0,1}*}
L2 = {wcwR|w ∊ {0,1}*}
L3 = {ww|w ∊ {0,1}*}
Which one of the following is TRUE?
  1. L1 is deterministic CFL
  2. L2 is deterministic CFL
  3. L3 is a CFL but not a deterministic CFL
  4. L3 is deterministic CFL
11.Let S be a NP–complete problem and Q and R be two other problems not known to be in NP. Q is polynomial time reducible to S and S is polynomial time reducible to R. Which one of the following statements is TRUE?
  1. R is NP complete
  2. R is NP hard
  3. Q is NP complete
  4. Q is NP hard
12.L1 = {an + m bn cm|n, m ≥ 0}
L2 = {an + m bn + m cm|n, m ≥ 0}
L3 = {an + m bn + m cm + n|n, m ≥ 0}
Which of these languages are not CF.
  1. L1 only
  2. L3 only
  3. L1 and L2
  4. L2 and L3
13.If s is a string over (0+1)* then let m0 (s) denote the number of 0’s in s and n1 (s) the number of 1’s in s. Which one of the following languages is not regular?
  1. L = {s ∊ (0+1)*|n0(s) is a 3-digit prime}
  2. L = {s ∊ (0+1)*|for every prefix s′ of s, |n0 (s′) − n1(s′)| ≤ 2}
  3. L = {s ∊ (0+1)*‖n0(s) − n1(s)| ≤ 4}
  4. L = {s ∊ (0+1)*|n0(s) mod 7 = n1(s) mod 5 = 0}
14.For s ∊ (0+1)*let d(s) denote the decimal value of s (eg. D(|0|) = 5).
Let L = {s ∊ (0+1)*|d(s) mod 5 = 2 and d(s) mod 7 ≠ 4}
Which one of the following statements is TRUE?
  1. L is recursively enumerable but not recursive
  2. L is recursive, but not context-free
  3. L is context-free, but not regular
  4. L is regular
15.Let FHAM be the problem of finding a Hamiltonian cycle in a graph G and DHAM be the problem of determining if a Hamiltonial cycle exists in a graph. Which one of the following is TRUE?
  1. Both FHAM and DHAM are NP-hard
  2. FHAM is NP hard, but DHAM is not
  3. DHAM is NP hard, but FHAM is not
  4. Neither FHAM nor DHAM is NP hard
16.Consider the following statements about the context-free grammar G = {SSS, Sab, Sba, Sc}
  1. G is ambiguous
  2. G produces all strings with equal number of a’s and b’s
  3. G can be accepted by a deterministic PDA
Which combination below expresses all the true statements about G?
  1. I only
  2. I and III only
  3. II and III only
  4. I, II and III
17.Let L1 be a regular language and L2 a deterministic CFL. L3 is recursively enumerable but not recursive. Which one of the following statement is FALSE?
  1. L1L2 is a DCFL
  2. L3L1 is recursive
  3. L1L2 is context-free
  4. L1L2L3 is recursively enumerable
18.Consider the regular language L = (111 + 11111)*. The minimum number of states in any DFA accepting the language is
  1. 3
  2. 5
  3. 8
  4. 9
19.Which one of the following grammars generates the language L = {aibj|ij}.
  1. SAC|CB
    CaCb|a|b
    AaA|ε
    BBb|ε
  2. SaS|Sb|a|b
  3. SAC|CB
    CaCb|ε
    AaA|ε
    BBb|ε
  4. SAC|CB
    CaCb|ε
    AaA|a
    BbB|b
20.In the above correct grammar what is the minimum length of the derivation (number of steps starting from S) to generate the string a1 bm with lm?
  1. max(l, m) + 2
  2. l + m + 2
  3. l + m + 3
  4. max(l, m) + 3
21.Consider SSS|a.
What is the number of different derivation trees for aaaaa
  1. 3
  2. 5
  3. 7
  4. 14
22.Which one of the following grammar generates L = {ai bj ck|ik, i, j, k ≥ 1}
  1. SAC|CB
    AaA|a
    BBc|c
    CaCc|bD|b
    DbD|b
  2. SaS|aA
    AbA|bB
    BcB|c
  3. SAB
    AaAb|ab
    BbBc|bc
  4. SAC|CB
    AaA|ε
    BBc|ε
    CaCc|ε|bD
    DbD|b|ε
23.A minimum state deterministic automaton accepting the language L = {w|w ∊ {0,1}*, the number of 0’s and 1’s in w are divisible by 3 and 5 respectively} has
  1. 15 states
  2. 11 states
  3. 10 states
  4. 9 states
24.The language L = {0i21i / i ≥ 0} over the alphabet {0, 1, 2} is
  1. not recursive
  2. is recursive and is a deterministic CFL
  3. is a regular language
  4. is not a deterministic CFL but a CFL
25.Which of the following languages is regular?
  1. {wwR|w ∊ {0, 1}+}
  2. {wwRx|w, x ∊ {0, 1}+}
  3. {w x w R|w, x ∊ {0, 1}+}
  4. {xwwR|w, x ∊ {0, 1}+}
26.Let Σ = {0, 1}, L1 = Σ* and L2 = {0n 1n|n ≥ 1} then the languages L1L2 and L2 are respectively
  1. regular, regular
  2. regular, not regular
  3. not regular, regular
  4. not regular, not regular
27.Which of the following statements is false?
  1. The halting problem for Turing machines is undecidable
  2. determining whether a context-free grammar is ambiguous is un-decidable
  3. given two arbitrary context-free grammar, G1 and G2, it is undecidable with L(G1) = L(G2)
  4. given two regular grammars G1 and G2, it is undecidable whether L(G1) = L(G2)
28.Two of the following four regular expressions are equivalent. Which two?
  1. (00)* (0 + ε)
  2. (00)*
  3. 0*
  4. 0(00)*
  1. (i) and (ii)
  2. (ii) and (iii)
  3. (i) and (iii)
  4. (iii) and (iv)
29.Let L ⊆ Σ* where Σ = {a, b}. Which of the following is true?
  1. L = {x|x has an equal number of a’s and b’s } is regular
  2. L = {an bn | n ≥ 1} is regular
  3. L = {am bn | m, n ≥ 1} is regular
  4. L = {x|x has more a’s than b’s} is regular
30.Define for a CFL L, init (L) = {u | uvL for some v ∊ {0, 1}*}. In other words init (L) is the set of prefixes of L. Let L = {w|w ∊ {0, 1}+, w has equal number of 0’s and 1’s}. Then init (L) is
  1. the set of all binary strings with unequal number of 0’s and 1’s
  2. the set of all binary stings including ε
  3. the set of all binary strings with exactly one more 0 than the number of 1’s or one more 1 than the number of 0’s.
  4. none of the above
31.If L1 and L2 are CFL and R a regular set, one of the languages below is not necessarily a CFL. Which one?
  1. L1L2
  2. L1L2
  3. L1L2
  4. L1R
32.The grammar whose productions are
stmt〉 → if 〈id〉 then 〈stmt
stmt〉 → if 〈id〉 then 〈stmt〉 else 〈stmt
stmt〉 → 〈id〉 := 〈id
id〉 → a|b|c|d|f
is ambiguous because
  1. the sentence if a then if b then c := d has more than one derivation trees
  2. the leftmost and rightmost derivation of the sentence if a then if b then c := d give rise to different parse trees
  3. the sentence if a then if b then c := d else c := f has more than two parse trees
  4. the sentence if a then if b then c := d else c := f has two parse trees
33.Which one of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a substring?
  1. 0*(11*0)*
  2. 0*1010*
  3. 0*1*01
  4. 0*(10 + 1)*
34.Which one of the following is not decidable?
  1. given a Turing machine M, a string s, and an integer k, M accepts s with k steps
  2. equivalence of two given Turing machines
  3. language accepted by a given DFSA is nonempty
  4. language generated by a CFG is nonempty
35.Which of the following languages over {a, b, c} is accepted by a deterministic PDA?
  1. {wbwR|w ∊ {a, c}*}
  2. {wwR|w ∊ {a, b, c}*}
  3. {anbncn|n ≥ 1}
  4. {w|w is a palindrome over {a, b, c}}
36.Which of the following instances of the post correspondence problem has a viable sequence (a solution)?
  1. {(b, bb), (bb, bab), (bab, abb), (abb, babb)}
  2. {(ab, aba), (baa, aa), (aba, baa)}
  3. {(ab, abb), (ba, aaa), (aa, a)}
  4. none of the above
37.It is undecidable, whether
  1. an arbitrary TM has 15 states
  2. an arbitrary TM halts after 10 steps
  3. an arbitrary TM ever prints a specific letter
  4. an arbitrary TM accepts a string w in 5 steps
38.Let r = 1(1+0)*, s = 11*0 and t = 1*0 be three regular expressions and R, S, T the regular sets corresponding to them. Which of the following is true?
  1. SR
  2. RS
  3. TS
  4. RT
39.Which one of the following is the strongest correct statement about a finite language L over a finite alphabet Σ?
  1. L is undecidable
  2. L is recursive
  3. L is a CSL
  4. L is a regular set
40.Which of the following statements is TRUE?
  1. infinite union of regular sets is regular
  2. infinite union of finite sets is regular
  3. finite union of finite sets is regular
  4. complement of a finite set need not be regular

    Answers

    1.c
    2.c
    3.b
    4.c
    5.a
    6.a
    7.b
    8.d
    9.b
    10.b
    11.b
    12.d
    13.c
    14.d
    15.a
    16.b
    17.b
    18.d
    19.a
    20.a
    21.d
    22.a
    23.a
    24.b
    25.c
    26.b
    27.d
    28.c
    29.c
    30.b
    31.c
    32.d
    33.d
    34.b
    35.a
    36.c
    37.c
    38.a
    39.d
    40.c

7 comments:

  1. hello sir, thanks for the questions,
    currently i am preparing for gate exam and under lot of stress also due to bad competition , around 1-2 lac people given gate exam last year for cs an 2% had crossed 50 mark but unfortunately the mtech seats in iit elapse for just 800 airs hence very much stressed as i m not so intelligent....but i am trying from past 4 months....and really seen lots of ups and downs...my friends got placements in company's.... sometimes it feels rather going for this i should also go for job search in industrial area...but then i think getting a 10k job with just 9-8 hrs php..or android application making won't help in long run.....hence at the end just started preparing for gate....god knows what gonna happen..... i am also depreesed as if i fail to get admission then i will elapse about my 1 year after passout....therefore no experience and elapsed 1 year hence not remain fresher and kicked of market.....hmmmm thats a life of medeokar ...... well bit frustrated and seeking out websites for gate previous solutions i see your site.... well seem to be you have also struggled.... don't know what to say..... its getting late also so at the end just want to say ...nice blog keep it up...hope you became successful teacher...i don't know what gonna happen to me.... suicide or seat ..... lets pray for best..... good luck and make a good site....

    ReplyDelete
  2. Dear deepak
    if yu are trying with o much confident, and hard working.
    it will definetely pay you,
    suicide is not a solutions for any problem.
    it shows that you dont have courage to handle the situation.

    be optimistic, you can do any thing you wanna do.
    just hard work and confidence needed, my blessings are always with you, keep it on.

    thanks for praising blog, i just want that no one came to me and says, sir padhne ko material nai mil rha.
    bcoz jab koi computer science ka student ye bolta hai, to lagta hai, CS sucks. as Internet is made of by CS, if we didn't find material on CS, shame on us.

    lastly, good luck for GATE 2013, sure you can do it with better better AIR.

    always waiting for your precious comments

    ReplyDelete
  3. thank you...sir lets hope for the best....btw ssc combine graduate and ibps forms are out in case if you are interested.... and good luck for future .... will comment next time when gate paper will over....seya!

    ReplyDelete
  4. Can u explin if possible.. why is option d the answer of q 27 ... a b and c are correct , i know so answer is definately d .. i know that .. but how can one prove that statement in option d is decidable..i refered to some solution which said we can create some dfa etc. but i felt it incomplete.. pls reply if some1 knows the reason...!!

    ReplyDelete
  5. Can u explin if possible.. why is option d the answer of q 27 ... a b and c are correct , i know so answer is definately d .. i know that .. but how can one prove that statement in option d is decidable..i refered to some solution which said we can create some dfa etc. but i felt it incomplete.. pls reply if some1 knows the reason...!!

    ReplyDelete
  6. why is d the ans for q27/.. a b and c are true which leaves d as answer but can any1 prove for me that the equality of 2 languages given by 2 regular grammars is decidable ..

    ReplyDelete
  7. Hello, JAY TELI
    thanks for your response/query.
    As regular languages are meant for finite things i.e. finite memory dats why we say we can do decidable decidable things with them.
    I know its will not sufffice for any TOC aspirant to prove it, but its a glimpse, i will try to concince more you ASAP.

    ReplyDelete