GATE Computer ScienceVery hardGATE CS (PYQ pattern)
How many binary strings of length 12 contain no two consecutive 1s and, read as a binary number (leading zeros allowed), are divisible by 3?
- A. 144
- B. 132
- C. 116
- D. 125
Correct answer: D. 125
Run the product of the mod-3 remainder tracker and the 'last symbol was 1' flag for 12 steps (2·3 = 6 live states): the accepted count is 125; 377 strings avoid 11, and only about a third are multiples of 3.
More Theory of Computation questions
- How many binary strings of length 12 have the number of occurrences of 01 equal to the number of occurrences of 10?
- How many strings of length 10 over {a, b, c} contain neither ab nor ba as a substring?
- Taking Brzozowski quotients: let L = L(r) with r = a(bab) over {a, b}. A regular expression for the set of strings w such that bw ∈ L is
- Grammar G: S → ASB | ε; A → aAS | a; B → SbS | A | bb. After eliminating all ε-productions in the standard way (every way of deleting…
- Grammar G: S → AB | ASB | ε; A → a | aA | aAS; B → A | Sb | SbS | b | bS | bb. After eliminating the unit production(s) B → A (copy A's…
- In the grammar S → AB | aC | b; A → a | aE; B → bB | bD; C → c | cC; D → dD; E → e (start S), how many variables are useless (not…