Top Banner

Click here to load reader

Multiple Choice Questions

Oct 31, 2014

ReportDownload

Documents

Multiple Choice Questions (Set I)In each of the following questions, choose the correct answer from the four choices provided. 1. The following grammar G = (N, T, P, S) N = {S, A, B} T = {a, b, c} P : S aSa S aAa A bB B bB B c is

a. is type 3 b. is type 2 but not type 3 c. is type 1 but not type 2 d. is type 0 but not type 12. The following grammar G = (N, T, P, S) N = {S, A, B, C, D, E} T = {a, b, c} P : S aAB AB CD C C CD CE aC b

bE

bc is

a. is type 3 b. is type 2 but not type 3 c. is type 1 but not type 2 d. is type 0 but not type 13. The following grammar G = (N, T, P, S) N = {S, A, B, C} T = {a, b, c} P : S aS A bB B cC C a is

a. is type 3 b. is type 2 but not type 3 c. is type 1 but not type 2 d. is type 0 but not type 14. The following grammar G = (N, T, P, S) N = {S, A, B, C, D, E} T = (a, b, c} P : S ABCD BCD DE

D D E E

aD a bE c is

a. is type 3 b. is type 2 but not type 3 c. is type 1 but not type 2 d. is type 0 but not type 15. Consider the following CFG S aB Bb B bS S bA Aa A aS

B aBB A bAA

Consider the following derivation S aB aaBB aaBb aabSb aabbAb aabbab

This derivation is

a. a leftmost derivation b. a rightmost derivation c. both leftmost and rightmost derivation

d. neither leftmost nor rightmost derivation6. Consider the following language L = {anbncndn|n 1} L is

a. CFL but not regular b. CSL but not CFL c. regular d. type 0 language but not type 17. Consider the following language L = {anbn|n 1} L is

a. CFL but not regular b. CSL but not CFL c. regular d. type 0 language but not type 18. Consider the following language L = {anbmcpdq|n, m, p, q 1} L is

a. CFL but not regular b. CSL but not CFL c. regular

d. type 0 language but not type 19. The following CFG is in S AB B CD B AD Bb D AD Dd Aa Ca

a. Chomsky normal form but not strong Chomsky normal form b. Weak Chomsky normal form but not Chomsky normal form c. Strong Chomsky normal form d. Greibach normal form10. The following CFG is in S aBB B bAA Aa Bb

a. Chomsky normal form but not strong Chomsky normal form b. Weak Chomsky normal form but not Chomsky normal form

c. Strong Chomsky normal form d. Greibach normal form11. Which of the following CF language is inherently ambiguous?

a. {anbncmdm|n, m 1} b. {anbmcpdq|n = p or m = q, n, m, p, q 1} c. {anbmcpdq|n m p q} d. {anbmcpdq|n m p q}12. Which string is not accepted by the following FSA?

a. 00111 b. 01010 c. 00110 d. 1101013. Which string is accepted by the following FSA?

a. 00111 b. 11011 c. 01101 d. 010114. Can a DFSA simulate a NFSA

a. No b. Yes c. sometimes d. depends on NFA15. Which of the following is true for an arbitrary language L.

a. b. L* = L+ {} c. L* = L+ d. L* = L+ {}16. The concept of FSA is much used in this part of the compiler

a. lexical analysis b. parser c. code generation d. code optimization17. The concept of grammar is much used in this part of the compiler

a. lexical analysis

b. parser c. code generation d. code optimization18. (a + b)(cd)*(a + b) denotes the following set

a. {a(cd)nb|n 1} b. {a(cd)na|n 1} {b(cd)nb/n 1} c. {a(cd)na|n 0} {a(cd)nb/n 0} {b(cd)na/n 0} {b(cd)nb/n 0} d. {acndnb|n 1}19. baa*c denotes the set

a. {bnamcp|n, m, p 1} b. {banc|n 0} c. {banc|n 1} d. {w|w is a string of a, b, c}20. The set of all strings over the alphabet = {a, b} (including ) is denoted by

a. (a + b)* b. (a + b)+ c. a+b+ d. a*b*21. Palindromes cant be recognized by any FSA because

a. FSA cannot remember arbitrarily large amount of information

b. FSA cannot deterministically fix the midpoint c. Even if the mid point is known an FSA cannot find whether the second half of the string matches the first half d. all of the above22. Let = {a, b, c, d, e}. The number of strings in * of length 4 such that no symbol is used more than once in a string is

a. 360 b. 120 c. 35 d. 3623. Which of the following denotes Chomskian hiearchy?

a. REG CFL CSL type0 b. CFL REG type0 CSL c. CSL type0 REG CFL d. CSL CFL REG type024. A language L is accepted by a FSA iff it is

a. CFL b. CSL c. recursive d. regular25. Which of the following regular expressions denotes a language comprising of all possible strings over = {a, b} of length nwhere n is a multiple of 3.

a. (a + b + aa + bb + aba + bba)*

b. (aaa + bbb)* c. ((a + b)(a + b)(a + b))* d. (aaa + ab + a) + (bbb + bb + a)26. A language is represented by a regular expression (a)*(a + ba). Which of the following string does not belong to the regular set represented by the above expression.

a. aaa b. aba c. ababa d. aa27. Which of the following is not primitive recursive but partially recursive?

a. McCarthys function b. Riemann function c. Ackermanns function d. Bounded function28. Consider the following right-linear grammar G = (N, T, P, S) N = {S} P : S aS|aA T = {a, b} A bA|b

Which of the following regular expression denotes L(G)?

a. (a + b)* b. a(ab)*b c. aa*bb*

d. a*b*29. Which of the following strings is not generated by the following grammar? S SaSbS|

a. aabb b. abab c. aababb d. aaabb30. Consider the following NFSA

The automaton accepts

a. all words of the form {(ab)na|n 1} b. all words that end with a and c. all words that end with a and not d. all words containing substring ba31. Consider a language L for which there exists a Turing machine (TM), T, that accepts every word in L and either rejects or loops for every word that is not in L. The language L is

a. NP hard b. NP complete c. recursive d. recursively enumerable32. Consider the following statements

I. II. III.

Recursive languages are closed under complementation Recursively enumerable languages are closed under union Recursively enumerable languages are closed under complementation

Which of the above statement are TRUE?

a. I only b. I and II c. I and III d. II and III33. Which of the following statement is wrong?

a. Any regular language can be generated by a context-free grammar b. Some non-regular languages cannot be generated by any CFG c. the intersection of a CFL and regular set is a CFL d. All non-regular languages can be generated by CFGs.34. Recursively enumerable languages are not closed under

a. union b. homomorphism c. complementation d. concatenation35. Which of the following problem is undecidable?

a. membership problem for CFL b. membership problem for regular sets

c. membership problem for CSL d. membership problem for type 0 languages36. Recursive languages are

a. a proper superset of CFL b. always recognized by PDA c. are also called type 0 languages d. always recognized by FSA37. R1 and R2 are regular sets. Which of the following is not true?

a. R1 R2 neet not be regular b. * R1 is regular c. R1 R2 is regular d.38.

is regular

Which of the following regular expression identity is true?

a. r(*) = r* b. (r*s*)* = (r + s)* c. (r + s)* = r* + s* d. r*s* = r* + s*39. Which one of the following statement is FALSE?

a. context-free languages are closed under union b. context-free languages are closed under concatenation c. context-free languages are closed under intersection

d. context-free languages are closed under Kleene closure40. Which of the following conversion is not possible (algorithmically)?

a. regular grammar to context-free grammar b. nondeterministic FSA to deterministic FSA c. nondeterministic PDA to deterministic PDA d. nondeterministic TM to deterministic TM

Answers1. 2. 3. 4. 5. 6. 7. 8. 9. 10. b c a d d b a c c d

11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28.

b a b b b a b c c a d b a d c c c c

29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40.

d c d b d c d a a b c c

Multiple Choice Questions (Set II)In each of the following questions, choose the correct answer from the four choices provided. 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?

a. P3 is decidable if P1 is reducible to P3 b. P3 is undecidable if P3 is reducible to P2

c. P3 is undecidable if P2 is reducible to P3 d. P3 is decidable if P3 is reducible to P2s complement2. 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.

a. P3 has polynomial time solution if P1 is polynomial time reducible to P3 b. P3 is NP complete if P3 is polynomial time reducible to P2 c. P3 is NP complete if P2 is reducible to P3 d. P3 has polynomial time complexity and P3 is reducible to P23. Consider the FSA M

The language recognized by M is

a. {w {a, b}* | every a in w is followed by exactly two bs} b. {w {a, b}* | every a in w is followed by atleast two bs} c. {w {a, b}* |w contains the substring abb} d. {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 Dfand 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. Dp Np

a. Df NfDp = Np

b. Df NfDp Np

c. Df = NfDp = Np

d. Df = Nf5. Consider the languages L1 = {anbncm|n, m > 0} and L2 = {anbmcm|n, m > 0} Which one of the following statements is false?

a. L1 L2 is a CFL b. L1 L2 is a CFL c. L1 L2 is inherently ambiguous d. L1 L2 is a CSL6. Consider the languages L1 = {anbmcndp|n, m, p