MCQOPTIONS
Saved Bookmarks
This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following statements is/are false? 1. For every non-deterministic Turing machine, there exists an equivalent deterministic Turing machine. 2. Turing recognisable languages are closed under union and complementation. 3. Turing decidable languages are closed under intersection and complementation. 4. Turing recognisable languages are closed under union and intersection. |
| A. | 1 and 4 only |
| B. | 1 and 3 only |
| C. | 2 only |
| D. | 3 only |
| Answer» D. 3 only | |
| 2. |
Let < M > be the encoding of a Turing machine as a string over = {0, 1}. Let L = {| M is a Turing machine that accepts a string of length 2014}. Then, L is |
| A. | decidable and recursively enumerable |
| B. | undecidable but recursively enumerable |
| C. | undecidable and not recursively enumerable |
| D. | decidable but not recursively enumerable |
| Answer» C. undecidable and not recursively enumerable | |
| 3. |
Consider the following statements. I. The complement of every Turing decidable language is Turing decidable II. There exists some language which is in NP but is not Turing decidableIII. If L is a language in NP, L is Turing decidable Which of the above statements is/are true? |
| A. | Only II |
| B. | Only III |
| C. | Only I and II |
| D. | Only I and III |
| Answer» E. | |
| 4. |
Let L(R) be the language represented by regular expression R. Let L(G) be the language generated by a context free grammar G. Let L(M) be the language accepted by a Turing machine M. Which of the following decision problems are undecidable? I. Given a regular expression R and a string w, is w L(R)? II. Given a context-free grammar G. is L(G) = ? III. Given a context-free grammar G. is L(G) = * for some alphabet ? IV. Given a Turing machine M and a string w, is w L(M)? |
| A. | I and IV only |
| B. | II and III only |
| C. | II, III and IV only |
| D. | III and IV only |
| Answer» E. | |
| 5. |
Consider the following two problems on undirected graphs : ‐ Given, G (V, E), does G have an independent set of size |V| - 4? ‐ Given, G (V, E), does G have an independent set of size 5? Which one of the following is true? |
| A. | a is in P and b is NP-complete |
| B. | a is NP-complete b is in P |
| C. | Both a and b are NP-complete |
| D. | Both a and b are in P |
| Answer» B. a is NP-complete b is in P | |
| 6. |
The language { am bn cm + n | m , n > 1 } is |
| A. | regular |
| B. | context-free but not regular |
| C. | context-senstitive but not context-free |
| D. | type-0 but not context-sensitive |
| Answer» C. context-senstitive but not context-free | |
| 7. |
For S (0 + 1)* let d(s) denotes the decimal value of s (e.g., d(101) = 5) Which one of the following statements is true? |
| A. | L is recursively enumerable but not recursive |
| B. | L is recursively but not context-free |
| C. | L is context-free but not regular |
| D. | L is regular |
| Answer» E. | |
| 8. |
The language L = { 0p 2 1i | i 0 } over the alphabet {0, 1, 2} is |
| A. | not recursive |
| B. | is recursive and is a deterministic CFL |
| C. | is a regular language |
| D. | is not a deterministic CFL but a CFL |
| Answer» C. is a regular language | |
| 9. |
Which of the following is true for the language {ap | p is a prime}? |
| A. | It is not accepted by a turning machine |
| B. | It is regular but not context-free |
| C. | It is context-free but not regular |
| D. | It is neither regular nor context-free, but accepted by a turing machine |
| Answer» E. | |
| 10. |
Which of the following are decidable? 1. Whether the intersection of two regular languages is infinite. 2. Whether a given context-free language is regular.3. Whether two push-down automata accept the same language. 4. Whether a given grammar is context-free |
| A. | 1 and 2 |
| B. | 1 and 4 |
| C. | 2 and 3 |
| D. | 2 and 4 |
| Answer» C. 2 and 3 | |
| 11. |
If L and L are recursively enumerable, then L is |
| A. | regular |
| B. | context-free |
| C. | context-sensitive |
| D. | recursive |
| Answer» E. | |
| 12. |
Let L1 = L1 L2 , where L1 and L2 are languages as defined belowL1 = { am bm c an bn | m , n 0 }L2 = { ai bj ck | i , j , k 0 }Then L is |
| A. | not recursive |
| B. | regular |
| C. | context-free but not regular |
| D. | recursively enumerable but not context-free |
| Answer» D. recursively enumerable but not context-free | |
| 13. |
Let P be a regular language and Q be a context free language such that Q P. For example, let P be the language represented by the regular expression p*q* and Q be ( Qn pn qn | n N ) Then which of the following is always regular? |
| A. | P Q |
| B. | P - Q |
| C. | |
| D. | * - P |
| E. | * - Q |
| Answer» D. * - P | |
| 14. |
Consider the languages L1 = and L2 = {a}. Which one of the following represents L1 L2 * L1 *? |
| A. | { } |
| B. | |
| C. | a* |
| D. | ( , a) |
| Answer» B. | |
| 15. |
If L1 = { an | n 0 } and L2 = { bn | n 0 } , consider (I) L1 .L2 is a regular language (II) L1 .L2 = {an bn | n 0} Which one of the following is CORRECT? |
| A. | Only (I) |
| B. | Only (II) |
| C. | Both (I) and (II) |
| D. | Neither (I) nor (II) |
| Answer» B. Only (II) | |
| 16. |
Consider the alphabet = {0, 1}, the null/empty string and the sets of strings X0, X1, and X2 generated by the corresponding non-terminals of a regular grammar X0, X1, and X2 are related as follows. X0 = 1 X1 X1 = 0 X1 + 1 X2X2 = 0 X1 + { } Which one of the following choices precisely represents the strings in X0 ? |
| A. | 10(0*+(10)*)1 |
| B. | 10(0*+(10*)*1 |
| C. | 1(0+10)*1 |
| D. | 10(0+10)*1+110(0+10)*1 |
| Answer» D. 10(0+10)*1+110(0+10)*1 | |
| 17. |
Consider the following two statements: I. If all states of an NFA are accepting states then the language accepted by the NFA is *. II. There exists a regular language A such that for all languages B, A B is regular. Which one of the following is CORRECT? |
| A. | Only I is true |
| B. | Only II is true |
| C. | Both I and II are true |
| D. | Both I and II are false |
| Answer» C. Both I and II are true | |
| 18. |
The length of the shortest string NOT in the language (over = {a, b}) of the following regular expression is______________. a*b* (ba)*a* |
| A. | 0 |
| B. | 3 |
| C. | 6 |
| D. | 9 |
| Answer» C. 6 | |
| 19. |
S aSa |bSb| a | b; The language generated by the above grammar over the alphabet {a, b} is the set of |
| A. | all palindromes |
| B. | all odd length palindromes |
| C. | strings that begin and with the same symbol |
| D. | all even length palindromes |
| Answer» C. strings that begin and with the same symbol | |
| 20. |
Consider the following grammar: stmt - > if expr then expr else expr; stmt | o expr - > term relop term | term term - > id | number id - > a | b | c number - > [0-9] where relop is a relational operator (e.g., , ...), o refers to the empty statement, and if, then, else are terminals. Consider a program P following the above grammar containing ten if terminals. The number of control flow paths in P is ________. For example, the program if e1 then e2 else e3 has 2 control flow paths, e1 e2 and e1 e3. |
| A. | 1024 |
| B. | 512 |
| C. | 128 |
| D. | 64 |
| Answer» B. 512 | |
| 21. |
Let W be any string of length n in {0, 1}*. Let L be the set of all sub-strings of W. What is the minimum number of states in a non-deterministic finite automata that accept L? |
| A. | n 1 |
| B. | n |
| C. | n + 1 |
| D. | 2 |
| E. | |
| Answer» D. 2 | |
| 22. |
Given an arbitrary Non-deterministic Finite Automata (NFA) with N states, the maximum number of states in an equivalent minimized DFA is at least |
| A. | N |
| B. | |
| C. | 2 |
| D. | 2N |
| E. | N! |
| Answer» C. 2 | |
| 23. |
Consider the context-free grammars over the alphabet {a, b, c} given below. S and T are non-terminals. G1 : S aSb / T, T CT | G2 : S bSa T, T cT | The language L(G1) L(G2) is |
| A. | Finite. |
| B. | Not finite but regular. |
| C. | Context-Free but not regular. |
| D. | Recursive but not context-free. |
| Answer» C. Context-Free but not regular. | |
| 24. |
If G is a grammar with productions S SaS | aSb | bSa | SS | where S is the start variable, then which one of the following strings is not generated by G ? |
| A. | abab |
| B. | aaab |
| C. | abbaa |
| D. | babba |
| Answer» E. | |
| 25. |
Language L1 is defined by the grammar: S1 aS1 b | Language L2 is defined by the grammar: S2 abS2 | Consider the following statements: P : L1 is regular Q : L2 is regular Which one of the following is TRUE? |
| A. | Both P and Q are true |
| B. | P is true and Q is false |
| C. | P is false and Q is true |
| D. | Both P and Q are false |
| Answer» D. Both P and Q are false | |
| 26. |
Which of the following is/are undecidable? 1. G is a CFG. Is L(G) = ? 2. G is a CFG. Is L(G) = * ? 3. M is a Turing machine. Is L(M) regular? 4. A is a DFA and N is an NFA. Is L(A) = L(N)? |
| A. | 3 only |
| B. | 3 and 4 only |
| C. | 1, 2 and 3 only |
| D. | 2 and 3 only |
| Answer» E. | |
| 27. |
Let L1 , L2 be any two context-free languages and R be any regular language. Then which of the following is/are CORRECT ? I. L1 L2 is context-free. II. L1 is context-free. III. L1 R is context-free. IV. L1 L2 is context-free. |
| A. | I , II and IV only |
| B. | I and III only |
| C. | II and IV only |
| D. | I only |
| Answer» C. II and IV only | |
| 28. |
Which of the following decision problems are undecidable? I. Given NFAs N1 and N2, is L(N1) L(N2) = ? II. Given a CFG G = (N, , P, S) and a string x *, does x L(G) ? III. Given CFGs G1 and G2 is L(G1) = L(G2)? IV. Given a TM M, is L(M) = ? |
| A. | I and IV only |
| B. | II and III only |
| C. | III and IV only |
| D. | II and IV only |
| Answer» D. II and IV only | |
| 29. |
Consider the following languages over the alphabet = {a, b, c}. Let L1 = { an bn cm | m , n 0 } and L2 = { { am bn cn | m , n 0 } Which of the following are context-free languages? I. L1 L2 II. L1 L2 |
| A. | I only |
| B. | II only |
| C. | I and II |
| D. | Neither I nor II |
| Answer» B. II only | |
| 30. |
Let G = ({S}, {a, b}, R, S) be a context-free grammar where the rule set R is S aSb | SS | Which of the following statements is true? |
| A. | G is not ambiguous |
| B. | There exist X, Y L(G) such that XY L(G) |
| C. | There is a deterministic push-down automata that accepts L(G) |
| D. | We can find a deterministic finite state automata that accepts L(G) |
| Answer» D. We can find a deterministic finite state automata that accepts L(G) | |
| 31. |
Let X be a recursive language and Y be a recursively enumerable but not recursive language. Let W and Z be two languages such that Y reduces to W, and Z reduces to X (reduction means the standard many-one reduction). Which one of the following statements is TRUE? |
| A. | W can be recursively enumerable and Z is recursive. |
| B. | W can be recursive and Z is recursively enumerable. |
| C. | W is not recursively enumerable and Z is recursive. |
| D. | W is not recursively enumerable and Z is not recursive. |
| Answer» D. W is not recursively enumerable and Z is not recursive. | |
| 32. |
Consider the following languages. L1 = {ap | p is a prime number} L2 = {an bm c2m | n 0, m 0} L3 = {an bn c2n | n 0} L4 = {an bn | n 1} Which of the following are CORRECT? I. L1 is context-free but not regular. II. L2 is not context-free. III. L3 is not context-free but recursive. IV. L4 is deterministic context-free. |
| A. | I, II and IV only |
| B. | II and III only |
| C. | I and IV only |
| D. | III and IV only |
| Answer» E. | |
| 33. |
The minimum possible number of states of a deterministic finite automata that accepts the regular language L = {w1 aw2 | w1 ,w2 {a, b}*, | w1 | = 2, |w2 | 3} is ________. |
| A. | 4 |
| B. | 8 |
| C. | 10 |
| D. | 0 |
| Answer» C. 10 | |
| 34. |
For any two languages L1 and L2 such that L1 is context-free and L2 is recursively enumerable but not recursive, which of the following is/are necessarily true? I. L1 (complement of L1) is recursive II. L2 (complement of L2) is recursive III. L1 is context - free IV. L1 L2 is recursively enumerable |
| A. | I only |
| B. | III only |
| C. | III and IV only |
| D. | I and IV only |
| Answer» E. | |
| 35. |
Consider the following types of languages: L1 : Regular, L2 : Context-free, L3 : Recursive, L4 : Recursively enumerable. Which of the following is/are TRUE? I. L3 L4 is recursively enumerable II. L2 L3 is recursive III. L1* L2 is context-free IV. L1 L2 is context-free |
| A. | I only |
| B. | I and III only |
| C. | I and IV only |
| D. | I, II and III only |
| Answer» E. | |
| 36. |
Which of the following statements are true? 1. Every left-recursive grammar can be converted to a right-recursive grammar and vice-versa. 2. All -productions can be removed from any context free grammar by suitable transformations. 3. The language generated by a context-free grammar all of whose productions are of the form X W or X WY (where, W is a string of terminals and Y is non terminal), is always regular. 4. The derivation trees of strings generated by a context free grammar in Chomsky Normal Form are always binary trees. |
| A. | 1, 2, 3 and 4 |
| B. | 2, 3 and 4 |
| C. | 1, 3 and 4 |
| D. | 1, 2 and 4 |
| Answer» D. 1, 2 and 4 | |
| 37. |
Consider the following statements about the context-free grammar: G = { S SS, S ab, S ba, S } 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? |
| A. | 1 only |
| B. | 1 and 3 |
| C. | 2 and 3 |
| D. | 1, 2 and 3 |
| Answer» C. 2 and 3 | |
| 38. |
Which of the following is true? |
| A. | Every subset of a regular set is regular |
| B. | Every finite subset of a non-regular set is regular |
| C. | The union of two non-regular sets is regular |
| D. | Infinite union of finite sets is regular |
| Answer» C. The union of two non-regular sets is regular | |
| 39. |
Which of the following are regular sets? 1. { an b2m | n 0, m 0 } 2. { an bm | n = 2m } 3. { an bm | n m } 4. { xcy | x, y, {a,b}* } |
| A. | 1 and 4 |
| B. | 1 and 3 |
| C. | 1 only |
| D. | 4 only |
| Answer» B. 1 and 3 | |
| 40. |
A minimum state deterministic finite automata accepting the language L = {W | W {0, 1}*, number of 0's and 1's in W are divisible by 3 and 5, respectively as. |
| A. | 15 states |
| B. | 11 states |
| C. | 10 states |
| D. | 9 states |
| Answer» B. 11 states | |
| 41. |
Consider the following problem X: Given a turing machine M over the input alphabet S, any state q of M and a word W S *, does the computation of M on W visit the state q? Which of the following statements about X is correct? |
| A. | X is decidable |
| B. | X is undecidable but partially decidable |
| C. | X is undecidable and not even partially decidable |
| D. | X is not a decision problem |
| Answer» C. X is undecidable and not even partially decidable | |
| 42. |
The language accepted by this automata is given by the regular expression |
| A. | b * ab * ab * ab |
| B. | (a + b)* |
| C. | b* a (a + b)* |
| D. | b * ab * ab * |
| Answer» C. b* a (a + b)* | |
| 43. |
S aSa |bSb| a | b; The |
| A. | all palindromes |
| B. | all odd length palindromes |
| C. | strings that begin and with the same symbol |
| D. | all even length palindromes |
| Answer» C. strings that begin and with the same symbol | |
| 44. |
Let L = {W (0, 1) * | W has even number of 1s}, i.e., L is the set of all bit strings with even number of 1's. Which one of the regular expressions below represents L? |
| A. | (0* 10* 1)* |
| B. | 0 * (10* 10*)* |
| C. | 0 * (10 *1)* 0* |
| D. | 0 * 1(10 * 1) * 10 * |
| Answer» C. 0 * (10 *1)* 0* | |
| 45. |
The minimum state automata equivalent to the above FSA has the following number of states |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | 4 |
| Answer» C. 3 | |
| 46. |
A minimum state deterministic finite automata accepting the language L = {W | W {0, 1}*, number of 0's and 1's in W are divisible by 3 and 5, respectively as. |
| A. | 15 states |
| B. | 11 states |
| C. | 10 states |
| D. | 9 states |
| Answer» B. 11 states | |
| 47. |
Which one of the following languages over the alphabet {0 1} is described by the regular expression (0 + 1) * 0(0 + 1) *? |
| A. | The set of all strings containing the substring 00 |
| B. | The set of all strings containing at most two 0's |
| C. | The set of all strings containing at least two 0's |
| D. | The set of all strings that begin and end with either 0 or 1. |
| Answer» D. The set of all strings that begin and end with either 0 or 1. | |
| 48. |
Definition of a language L with alphabet {a} is given as following and n is a positive integer constant. What is the minimum number of states needed in a DFA to recognize L? |
| A. | k + 1 |
| B. | n + 1 |
| C. | 2n + 1 |
| D. | 2k + 1 |
| Answer» C. 2n + 1 | |
| 49. |
The regular expression 0* (10)* denotes the same set as |
| A. | (1* 0)*1* |
| B. | 0 + (0 + 10)* |
| C. | (0 + 1)* 10 (0 + 1)* |
| D. | None of these |
| Answer» E. | |
| 50. |
Consider the context-free grammars over the alphabet {a, b, c} given below. S and T are non-terminals. |
| A. | Finite. |
| B. | Not finite but regular. |
| C. | Context-Free but not regular. |
| D. | Recursive but not context-free. |
| Answer» C. Context-Free but not regular. | |