First you should notice that File Input/Output is not allowed. If its allowed then option (D) would be the correct answer. But as its not allowed hence it will not be the answer.
Correct answer is (B). Here is the explanation. A computer program which print it's own source code is called quine.
A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output. The standard terms for these programs in the computability theory and computer science literature are "self-replicating programs", "self-reproducing programs", and "self-copying programs".
It can print twice or thrice. But number of times should be fixed. It can not take input from user. Hence P3 will not be possible.