In P1, we can see the variable 'a' of integer datatype as both global variable (int a = 5; before creating the main function) and local variable (int a = 7; inside the main function). So, P1 will compile without any error.
In P2, we can see that the variable 'a' of integer datatype is created two times with different values (5 and 7), which makes it invalid. So, P2 will face an error during compilation.
In P3, we can see that the variable 'a' is declared two times with different datatypes (int and float), which makes it invlaid. So, P3 will face an error during compilation.
Therefore, the correct option is A) Only P1 will compile without any error.