Skip to content
GATEiit

GATE CSE 2024 Session 1 Q61: Strings of length ≤ 5 in neither 0* + 1* nor 01* + 10*

Question

Consider the following two regular expressions over the alphabet {0,1}\{0, 1\}:

r=0∗+1∗r = 0^* + 1^* s=01∗+10∗s = 01^* + 10^*

The total number of strings of length less than or equal to 5, which are neither in rr nor in ss, is _________

Try it: numerical answer: type the value

Numerical answer. No negative marking.
Show answer and explanation

Answer: 44 (official GATE 2024 final answer key)

Concept used: Complement counting with inclusion–exclusion.

First step: There are 26−1=632^6 - 1 = 63 strings of length 0 to 5; count those in rr, in ss, and in both.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2024 Session 1 CS question paper and final answer key, organised by IISc Bangalore. Question paper · Answer key