All bitstrings

2^10

at least five 0s

five0 = 64 + 28 + 12 + 5 + 2 + 1

at least five 1s

five1 = 64 + 28 + 12 + 5 + 2 + 1

The intersection has 2 elements  0000011111 and 1111100000

Thus the answer to Exercise 42 in Section 4.1 is

five0 + five1 - 2

I want to illustrate how to verify this in Mathematica

I will start with a simple problem with positive integers. How many integers between 10 and 99 are divisible with 5 but not with 7.  First create all integers in question,

Range[10, 99]

Then select as required and ask for the length of the list that Mathematica create

Select[Range[10, 99], 
      And[IntegerQ[#/5], Not[IntegerQ[#/7]]] &]

Length[
      Select[Range[10, 99], 
        And[IntegerQ[#/5], Not[IntegerQ[#/7]]] &]]

Similarly with much larger numbers.

Length[
      Select[Range[1000, 9999], 
        And[IntegerQ[#/5], Not[IntegerQ[#/7]]] &]]

To do this with strings we first create all strings of length 3. For that we need the Mathematica package

<<DiscreteMath`Combinatorica`

Strings[{0, 1}, 3]

Now we work with a single string to calculate how many consecutive 0s it has.  We use the command Split

Split[{0, 1, 1, 0, 0, 0, 1, 0, 0, 1}]

Next we select only the lists with 0s

Select[
      Split[{0, 1, 1, 0, 0, 0, 1, 0, 0, 
          1}], (#[[1]] == 
            0) &]

Next we calculate the individual lengths

Length[#] & /@ 
      Select[Split[{0, 1, 1, 0, 0, 0, 1, 0, 0, 
            1}], (#[[1]] == 
              0) &]

Finally we calculate the maximum of this list

Max[Length[#] & /@ 
        Select[Split[{0, 1, 1, 0, 0, 0, 1, 0, 0, 
              1}], (#[[1]] == 
                0) &]]

Given any string, the above command will calculate the maximum number of consecutive 0s in that string.

I will make the above command into a function with a string as input:

Clear[MaxCons0s, MaxCons1s, str];
MaxCons0s[str_] := 
        Max[Length[#] & /@ 
            Select[Split[
                str], (#[[1]] == 
                    0) &]];
MaxCons1s[str_] := 
      Max[Length[#] & /@ 
          Select[Split[
              str], (#[[1]] == 
                  1) &]]

MaxCons0s[{0, 1, 1, 0, 0, 0, 1, 0, 0, 1}]

MaxCons1s[{0, 1, 1, 0, 0, 0, 1, 0, 0, 1}]

Length[
      Select[Strings[{0, 1}, 
          10], 
(MaxCons0s[#]) == 
            5 &]]

Length[
      Select[Strings[{0, 1}, 10], (MaxCons0s[#]) > 4 &]]

So, our calculation above was correct.

Finally

Length[
      Select[Strings[{0, 1}, 10], 
        Or[(MaxCons0s[#]) > 4, (MaxCons1s[#]) > 4] &]]

Problem 43 in 4.1

Length[
      Select[Strings[{0, 1}, 8], 
        And[(MaxCons0s[#]) > 2, (MaxCons1s[#]) > 3] &]]

Select[Strings[{0, 1}, 8], 
      And[(MaxCons0s[#]) > 2, (MaxCons1s[#]) > 3] &]