UGC-NET Dec 2012 · Asymptotic Analysis & Recurrences

MCQ · 2 marks · Problem PROG-DIVC-0058

The number of bit strings of length eight that will either start with a 1 bit or end with two bits 00 shall be
  1. A
    32
  2. B
    64
  3. C
    128
  4. D
    160

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solution\[\boxed{|A\cup B|=|A|+|B|-|A\cap B|}\]\(A\): start with 1, the other 7 bits free: \(2^7=128\). \(B\): end with 00, the other 6 bits free: \(2^6=64\). \(A\cap B\): first bit 1 and last two bits 00, 5 bits free: \(2^5=32\).\[|A\cup B|=128+64-32=160.\]Answer: D

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com