Theory Of Computation (Toc) Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Sathya Bama
S
Sathya Bama
Community Contributor
Quizzes Created: 1 | Total Attempts: 3,419
Questions: 20 | Attempts: 3,422

SettingsSettingsSettings
Theory Of Computation (Toc) Quiz - Quiz

.


Questions and Answers
  • 1. 

    The FSM (Finite State Machine) machine pictured in the figure below represents what language? (ISRO-2018)  

    • A.

      Complements a given bit pattern

    • B.

      Finds 2’s complement of a given bit pattern

    • C.

      Increments a given bit pattern by 1

    • D.

      Changes the sign bit

    Correct Answer
    B. Finds 2’s complement of a given bit pattern
    Explanation
    The FSM machine pictured in the figure represents the process of finding the 2's complement of a given bit pattern. The 2's complement is a mathematical operation used in digital systems to represent negative numbers. This operation involves flipping the bits of the given pattern and adding 1 to the result. The FSM machine in the figure likely follows a specific set of states and transitions to perform this operation on the input bit pattern.

    Rate this question:

  • 2. 

    Let L = {w = (0+1)* | w has even number of 1’s}, i.e. L is the set of all bit strings with even number of 1’s. Which one of the regular expression below represents L ? (ISRO-2016)

    • A.

      (0*10*1)*

    • B.

      0*(10*10*)*

    • C.

      0*(10*1*)*0*

    • D.

      0*1(10*1)10*

    Correct Answer
    B. 0*(10*10*)*
    Explanation
    The regular expression 0*(10*10*)* represents the language L. This regular expression allows for any number of 0's at the beginning (including none), followed by any number of occurrences of the pattern 10*10* (which ensures an even number of 1's), and finally allows for any number of 0's at the end (including none). This covers all possible strings in L.

    Rate this question:

  • 3. 

    S → aSa ∣ bSb ∣ a ∣ b The language generated by the above grammar over the alphabet is the set of (ISRO 2016)

    • A.

      All palindromes

    • B.

      All odd length palindromes

    • C.

      Strings that begin and end with the same symbol

    • D.

      All even length palindromes

    Correct Answer
    B. All odd length palindromes
    Explanation
    The given grammar generates strings that are palindromes. This is because the production rules allow for the creation of strings that have the same symbol at the beginning and end (aSa or bSb), as well as individual symbols (a or b). Since palindromes are strings that read the same forwards and backwards, the language generated by this grammar is the set of all odd length palindromes.

    Rate this question:

  • 4. 

    The DFA generated from the following NFA? ISRO CS2013

    • A.

      Q0, q1, q2

    • B.

      [q0, q1], [q0, q2], [ ]

    • C.

      Q0, [q1, q2]

    • D.

      [q0, q1], q2

    Correct Answer
    A. Q0, q1, q2
    Explanation
    The given answer q0, q1, q2 represents the states of the DFA generated from the given NFA. In the NFA, q0 is the initial state and q1 and q2 are the other states. The answer correctly lists all the states of the DFA.

    Rate this question:

  • 5. 

    The number of states required by a Finite State Machine, to simulate the behaviour of a computer with a memory capable of storing ‘m’ words, each of length ‘n’ bits is?

    • A.

      M x 2^n

    • B.

      2m+n

    • C.

      2^mn

    • D.

      M+n

    Correct Answer
    C. 2^mn
    Explanation
    A Finite State Machine (FSM) is a mathematical model used to describe the behavior of a system. In this question, we are simulating the behavior of a computer with a memory capable of storing 'm' words, each of length 'n' bits.

    To represent all possible combinations of 'm' words, each of length 'n' bits, we need 2^n states. For each word, we have 2 possible values for each bit (0 or 1), so the total number of states required is 2^n.

    Since we have 'm' words, we multiply the number of states required for one word (2^n) by 'm'. Therefore, the correct answer is 2^mn.

    Rate this question:

  • 6. 

    The given finite automata represent which of the languages?

    • A.

      {1, 0}* {01}

    • B.

      {1, 0}* {1}

    • C.

      {1}{1, 0}* {1}

    • D.

      1*0* {0, 1}

    Correct Answer
    A. {1, 0}* {01}
    Explanation
    The given finite automata represents the language consisting of all strings that start with any number of 1s or 0s, followed by the string "01".

    Rate this question:

  • 7. 

    Let S denote the set of seven bit binary strings in which the first, the fourth, and the last bits are 1. The number of strings in S that are accepted by M is ( GATE-CS-2003)

    • A.

      1

    • B.

      5

    • C.

      7

    • D.

      8

    Correct Answer
    C. 7
    Explanation
    The set S consists of seven bit binary strings where the first, fourth, and last bits are 1. To find the number of strings in S that are accepted by M, we need to consider all possible combinations for the remaining four bits. Since each bit can be either 0 or 1, there are 2^4 = 16 possible combinations. However, we need to exclude the strings where all four remaining bits are 0, as they do not satisfy the condition. Therefore, the number of strings in S that are accepted by M is 16 - 1 = 15.

    Rate this question:

  • 8. 

    The finite state machine given in figure below recognizes : 

    • A.

      Any string of odd number of a’s

    • B.

      Any string of odd number of b’s

    • C.

      Any string of even number of a’s and odd number of b’s

    • D.

      Any string of odd number of a’s and odd number of b’s

    Correct Answer
    D. Any string of odd number of a’s and odd number of b’s
    Explanation
    The finite state machine shown in the figure recognizes any string of odd number of a's and odd number of b's. This is because the machine has two states, one for even number of a's and one for odd number of a's. Similarly, it has two states for even and odd number of b's. By transitioning between these states based on the input characters, the machine can determine if the number of a's and b's in the string is odd.

    Rate this question:

  • 9. 

    The automata represent which of the languages given below? Nielit Scentist-B [02-12-2018]

    • A.

      Ab*b*

    • B.

      A*b*

    • C.

      B*b

    • D.

      B*ab*

    Correct Answer
    D. B*ab*
    Explanation
    The automaton represents the language consisting of strings that start with zero or more occurrences of 'b', followed by 'a', and ending with zero or more occurrences of 'b'.

    Rate this question:

  • 10. 

    Which of the following languages over the alphabet {0,1} is described by the given regular expression: (0+1)*1(0+1)*1? Nielit Scentist-B [02-12-2018]

    • A.

      The set of all strings containing the substrings 11

    • B.

      The set of all string containing at most two 1’s

    • C.

      The set of all strings containing at least two 1’s

    • D.

      The set of all strings that begins and ends with only 0.

    Correct Answer
    C. The set of all strings containing at least two 1’s
    Explanation
    The regular expression (0+1)*1(0+1)*1 matches any string that contains at least two occurrences of the symbol 1. This means that the correct answer is "The set of all strings containing at least two 1's."

    Rate this question:

  • 11. 

    In the given language L={ab,aa,baa}, __ number of strings are in L* (1) baaaba (2) aabaaaa (3) baaabaaaabaa (4) baaabaaa (GATE CS 2012)

    • A.

      1, 2 and 3

    • B.

      2, 3 and 4

    • C.

      1, 2 and 4

    • D.

      1, 3 and 4

    Correct Answer
    C. 1, 2 and 4
    Explanation
    The language L* represents the set of all possible strings that can be formed by concatenating zero or more strings from L. In this case, the language L contains three strings: ab, aa, and baa.

    Option 1 (baaaba) is in L* because it can be formed by concatenating the string baa from L with the string aba from L*.

    Option 2 (aabaaaa) is in L* because it can be formed by concatenating the string aa from L with the string abaaa from L*.

    Option 3 (baaabaaaabaa) is not in L* because it cannot be formed by concatenating any combination of strings from L.

    Option 4 (baaabaaa) is in L* because it can be formed by concatenating the string baa from L with the string abaa from L*.

    Therefore, the correct answer is 1, 2, and 4.

    Rate this question:

  • 12. 

    Consider the languages L1 = and L2 = {a}. Which one of the following represents L1 L2*U L1*

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    B. B
    Explanation
    The correct answer is B because L1 represents the empty language, which means it contains no strings. L2* represents any number of occurrences of the string "a" or no occurrence at all. U represents the union operation, so L1 L2*U L1* will include any string from L1 followed by any number of "a"s or no "a"s at all, or any number of occurrences of "a" or no occurrence at all. Therefore, the language represented by B is the correct answer.

    Rate this question:

  • 13. 

    Consider the DFA given. GATE CS 2013 Which of the following are FALSE? 1. Complement of L(A) is context-free. 2. L(A) = L((11*0+0)(0 + 1)*0*1*) 3. For the language accepted by A, A is the minimal DFA. 4. A accepts all strings over {0, 1} of length at least 2.

    • A.

      1 and 3 only

    • B.

      2 and 4 only

    • C.

      2 and 3 only

    • D.

      3 and 4 only

    Correct Answer
    D. 3 and 4 only
    Explanation
    Option 3 is false because the minimal DFA for the language accepted by A would have fewer states than the given DFA. Option 4 is false because the DFA does not accept all strings over {0, 1} of length at least 2. The string "0" is not accepted by the DFA. Therefore, the correct answer is 3 and 4 only.

    Rate this question:

  • 14. 

    A deterministic finite automation (DFA)D with alphabet {a,b} is given below Which of the following finite state machines is a valid minimal DFA which accepts the same language as D?

    • A.

      Option 1

    • B.

      Option 2

    • C.

      Option 3

    • D.

      Option 4

    Correct Answer
    A. Option 1
    Explanation
    Option 1 is a valid minimal DFA which accepts the same language as D because it has the same number of states as D, and the transitions and accepting states are also the same. The only difference is that option 1 has a different arrangement of states, but it still represents the same language.

    Rate this question:

  • 15. 

    Which of the following statements is false? GATE CS 2008

    • A.

      Every NFA can be converted to an equivalent DFA

    • B.

      Every non-deterministic Turing machine can be converted to an equivalent deterministic Turing machine

    • C.

      Every regular language is also a context-free language

    • D.

      Every subset of a recursively enumerable set is recursive

    Correct Answer
    D. Every subset of a recursively enumerable set is recursive
    Explanation
    Every subset of a recursively enumerable set is recursive. This statement is false because not every subset of a recursively enumerable set is recursive. A recursively enumerable set is a set for which there exists a Turing machine that can enumerate all the elements of the set. However, a recursive set is a subset of a recursively enumerable set for which there exists a Turing machine that can decide membership in the set. Therefore, while every recursive set is a subset of a recursively enumerable set, not every subset of a recursively enumerable set is recursive.

    Rate this question:

  • 16. 

    The transition function for the language L = {w|na (w) and nb(w) are both odd} is given by: UGC NET CS 2015 Jun δ (q0, a) = q1 ; δ (q0, b) = q2 δ (q1, a) = q0 ; δ (q1, b) = q3 δ (q2, a) = q3 ; δ (q2, b) = q0 δ (q3, a) = q2 ; δ (q3, b) = q1 The initial and final states of the automata are:

    • A.

      Q0 and q0 respectively

    • B.

      Q0 and q1 respectively

    • C.

      Q0 and q2 respectively

    • D.

      Q0 and q3 respectively

    Correct Answer
    C. Q0 and q2 respectively
    Explanation
    The initial state of the automata is q0, which means that the automata starts in state q0. The final state of the automata is q2, which means that the automata accepts a string if it ends in state q2. Therefore, the initial and final states of the automata are q0 and q2 respectively.

    Rate this question:

  • 17. 

    Which of the following are not regular? UGC NET CS 2017 Jan (A) Strings of even number of a’s. (B) Strings of a’s, whose length is a prime number. (C)Set of all palindromes made up of a’s and b’s. (D)Strings of a’s whose length is a perfect square.

    • A.

      (A) and (B) only

    • B.

      (A), (B) and (C) only

    • C.

      (B), (C) and (D) only

    • D.

      (B) and (D) only

    Correct Answer
    B. (A), (B) and (C) only
    Explanation
    (A) Strings of even number of a's - This language is not regular because it cannot be recognized by a finite automaton. It requires counting the number of a's, which is beyond the capabilities of a finite automaton.
    (B) Strings of a's, whose length is a prime number - This language is not regular because it requires checking whether the length of the string is a prime number, which is not possible with a finite automaton.
    (C) Set of all palindromes made up of a's and b's - This language is not regular because it requires checking whether a string is a palindrome, which is not possible with a finite automaton.
    (D) Strings of a's whose length is a perfect square - This language is regular because it can be recognized by a finite automaton.

    Rate this question:

  • 18. 

    Which of the following are not regular? UGC NET CS 2017 Jan (A) Strings of even number of a’s. (B) Strings of a’s, whose length is a prime number. (C) Set of all palindromes made up of a’s and b’s. (D) Strings of a’s whose length is a perfect square.

    • A.

      (A) and (B) only

    • B.

      (A), (B) and (C) only

    • C.

      (B), (C) and (D) only

    • D.

      (B) and (D) only

    Correct Answer
    D. (B) and (D) only
    Explanation
    Option (B) states that the strings of a's, whose length is a prime number, are not regular. Regular languages can be recognized by finite automata, but the language of strings with a prime length cannot be recognized by any finite automaton. This is because the length of a prime number cannot be expressed as a product of smaller numbers, making it impossible to determine the number of states required to recognize such strings.

    Option (D) states that the strings of a's whose length is a perfect square are not regular. Similar to option (B), the language of strings with a perfect square length cannot be recognized by any finite automaton. This is because the number of states required to recognize such strings would need to be proportional to the square root of the length, which is not possible in a finite automaton.

    Rate this question:

  • 19. 

    The number of states in the minimum sized DFA that accepts the language defined by the regular expression (0+1)*(0+1)(0+1)* is __________________

    • A.

      2

    • B.

      3

    • C.

      4

    • D.

      5

    Correct Answer
    A. 2
    Explanation
    The regular expression (0+1)*(0+1)(0+1)* represents a language that accepts any combination of 0s and 1s, as long as it starts and ends with either a 0 or a 1. In a DFA, there would be two states: one for the starting and ending state, and another for the intermediate states. The DFA would transition between these two states based on the input symbols 0 and 1. Therefore, the correct answer is 2.

    Rate this question:

  • 20. 

    How many strings of length less than 4 contains the language described by the regular expression (x+y)*y(a+ab)*?

    • A.

      7

    • B.

      10

    • C.

      12

    • D.

      11

    Correct Answer
    A. 7
    Explanation
    The regular expression (x+y)*y(a+ab)* describes a language that consists of strings that start with any number of x's or y's, followed by a y, and then followed by any number of a's or ab's. To find the number of strings of length less than 4 that belong to this language, we need to consider all possible combinations of these characters. There are 3 possible lengths for the strings: 1, 2, or 3. For each length, we can count the number of strings that satisfy the regular expression. For length 1, the only possible string is "y". For length 2, the possible strings are "yy", "ya", "yb", and "yab". For length 3, the possible strings are "yyy", "yya", "yyb", "yyab", "yaa", "yab", and "yabb". Therefore, there are a total of 7 strings of length less than 4 that contain the language described by the regular expression.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Aug 29, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jul 26, 2019
    Quiz Created by
    Sathya Bama
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.