(a) Each bit has 2 possible values, so a string of length 9 has 2⁹ = 512 possible values.
(b) Using the same reasoning, there are 2ⁿ possible strings of length n. So the number of strings of length 9 or less is the sum (denoted by S) of the first 9 powers of 2,
S = 2¹ + 2² + 2³ + ... + 2⁹
Then
2S = 2² + 2³ + 2⁴ + ... + 2¹⁰
Subtract S from 2S to get
2S - S = 2¹⁰ - 2¹
S = 1024 - 2
S = 1022