This is a snippet from the stanford slide
You can access the slides from this link : http://openclassroom.stanford.edu/MainFolder/DocumentPage.php?course=Compilers&doc=docs/slides.html
Coming back to the question
The variable p is live at Basic block 1
- as statement 2 uses p
- There is a direct path from 1→ 2
- No intervening assignment to p is there
Hence option D is eliminated
The variable p is not live at BB 2 as there is a assignment to p in BB4
The variable p is live at Basic block 4
- as statement 5 uses p
- There is a direct path from 4→ 5
- No intervening assignment to p is there
The variable p is live at Basic block 5
- as statement 2 uses p
- There is a direct path from 5→2
- No intervening assignment to p is there
Hence option (C) is the answer
You can also use USE(),IN(),OUT() sets, but i find this way more easy to analyse