Regular Expressions & Languages

Answer & solution
Answer: D (no official key was published)
1. A finite automaton stores the current binary value modulo 35. Reading bit b replaces residue r by(2r+b) mod35.
2. Accept precisely residues r with r mod5=2 and r mod7≠4. This recognizes the language, so it is regular, D; leading zeros do not affect the construction.
3. Teaching check: The joint modulus 35 suffices because both congruence tests depend only on the value modulo 35. Starting at residue zero, scan bits left to right and update r←(2r+b) mod 35. A 35-state DFA with appropriate accepting residues is a constructive regularity proof.