(a) first of all execution will come to main(),here p=0 and q=1
now swap(p ,q) will be executed so value of p and q will be copied to a and b so now a=0 and b=1.
here a temporary variable is declared ,temp=a =>temp=0 ,a=b=>a=1 and b=temp=>b=0
but here actual parameters are not swapped ,formal parameters are swapped .(call by value)
(b) here p=0 , q=1 now swap(p,q) is called and here &a and &b is used so &a and &b will be stored in p and q now swapping will be done in actual parameters.
(c) here p=0,q=1 now swap(&p,&q) is called and a and p are pointer which will store the address of p and q respectively
now a temporary pointer is declared and temp =a means temp will store the address of a ,a=b means a will store the address of b ,b=temp means b will store the address of temp but here value of p and q is not swapped.
so option( 2) is correct