I think answer will be C
look in b) q!=null it is ok
but p can be null as nothing is mentioned about p
now if p=head=null how can you run head->next i.e. Q to detect a loop
so to successful completion of the loop(program in this case) both P and Q have to be NOT NULL
so C) is the correct answer from my point of view here.