This question in my opinion is badly constructed for the next reason: it doesn't say anything about your 'present working directory'.
So the possible answers per my understanding are: A, C and D
A would be correct if you'd be at '/' directory
C would be correct if you'd be at '/programs/' directory
D would be correct if you'd be at '/programs/mine/' directory
Kelvin Okornoe wrote:
Please how does the phrase ".....if we compile from programs" change the answer to the question.
In my opinion, there are just too many assumptions to this question.... but, I guess it is acceptable. First, you have to assume that the classpath is not set -- neither the environment variable or the -cp switch. This means that the classpath is the default (current) directory. And since you are compiling from the programs directory, the classpath is the "programs" directory.
Second, you have to assume that you are following the norm in compiling -- not using the source or target switches of the compiler.
Given these assumptions, the answer is option C -- as that would be the best location to compile, based on that package.