GATE Computer ScienceHardGATE CS (PYQ pattern)
How many binary strings of length 12 have the number of occurrences of 01 equal to the number of occurrences of 10?
- A. 1024
- B. 2112
- C. 2048
- D. 1792
Correct answer: C. 2048
The counts of 01 and 10 are equal exactly when the first and last symbols are equal, which holds for half of all strings: 2¹² / 2 = 2048.
More Theory of Computation questions
- 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…
- In the grammar S → AB | CD; A → aA | BC; B → b | CC; C → AC | c | ε; D → d | DA; E → eE | ε (start S), how many variables are nullable…