Regular Expressions & Languages PYQ QUIZ GATE CS

Last Updated :
Discuss
Comments

Question 1

Consider the languages L1 = [Tex]\\phi [/Tex]and L2 = {a}. Which one of the following represents L1 L2* U L1*

 
  • {[Tex]\epsilon [/Tex]}

  • [Tex]\phi [/Tex]

  • a*

  • {[Tex]\epsilon [/Tex],a}

Question 2

Let P be a regular language and Q be context-free language such that Q ⊆ P. (For example, let P be the language represented by the regular expression p*q* and Q be {pn qn  | n ∈ N}). Then which of the following is ALWAYS regular? 

(A) P ∩ Q 

(B) P - Q 

(C) ∑* - P 

(D) ∑* - Q

  • A

  • B

  • C

  • D

Question 3

Let L = L1∩L2, where L1 and L2 are languages as defined below:

L1 = {am bm can bn | m, n >= 0}

L2 = {ai bj ck | i, j, k >= 0}

Then L is

  • Not recursive

  • Regular

  • Context free but not regular

  • Recursively enumerable but not context free.

Question 4

Which one of the following languages over the alphabet {0,1} is described by the regular expression: (0+1)*0(0+1)*0(0+1)* ?

  • The set of all strings containing the substring 00.

  • The set of all strings containing at most two 0’s.

  • The set of all strings containing at least two 0’s.

  • The set of all strings that begin and end with either 0 or 1.

Question 5

Match the following NFAs with the regular expressions they correspond to

 1. ϵ + 0(01*1 + 00) * 01*
2. ϵ + 0(10 *1 + 00) * 0
3. ϵ + 0(10 *1 + 10) *1
4. ϵ + 0(10 *1 + 10) *10 *
 
  • P - 2, Q - 1, R - 3, S - 4

  • P - 1, Q - 3, R - 2, S - 4

  • P - 1, Q - 2, R - 3, S - 4

  • P - 3, Q - 2, R - 1, S - 4

Question 6

Which of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string ϵ is divisible by three.

  • (0+1(01*0)*1)*

  • (0+11+10(1+00)*01)*

  • (0*(1(01*0)*1)*)*

  • (0+11+11(1+00)*00)*

Question 7

Let L⊆{0,1}∗ be an arbitrary regular language accepted by a minimal DFA with k states. Which one of the following languages must necessarily be accepted by a minimal DFA with k states?

  • L−{01}

  • L∪{01}

  • {0,1}*–L

  • L⋅L

Question 8

Consider the following statements.

I. If L1∪L2 is regular, then both L1 and L2 must be regular.
II. The class of regular languages is closed under infinite union.

Which of the above statements is/are TRUE ?

  • Ⅰ only

  • Ⅱ only

  • Both Ⅰ and Ⅱ

  • Neither Ⅰ nor Ⅱ

Question 9

Which one of the following regular expressions represents the set of all binary strings with an odd number of 1′s ?

  • ((0+1)*1(0+1)*1)*10*

  • (0*10*10*)*0*1

  • 10*(0*10*10*)*

  • (0*10*10*)*10*

  • None

Question 10

Which one of the following regular expressions represents the language: the set of all binary strings having two consecutive 0s and two consecutive 1s?


gatecs201611

  • A

  • B

  • C

  • D

There are 38 questions to complete.

Take a part in the ongoing discussion