Your reasoning is right .lets confirm ii by taking a example.let linked list contain 5 node numbered 0,1,2,3,4 at the end the while loop p->next =null and p will will be pointed to 4 and q will have address of 3 . So for option b q->next =null means we are breaking the link between 3 and 4;
next we are assigning p to head which means now we have address of node 4 in head in next statement p->next=head; assigning same address to its next which does not add node 4 to front of the list.