Vijay -
When you are given a code listing the questions will almost all look like this:
Given:
What is the result?
A) Hello cruel world
B) no output is produced
C) Compilation fails at line 2
D) Compilation fails at line 3
E) An exception is thrown at runtime
A few things to note:
The answers will almost always be sorted from shortest to longest.
If the code line numbers don't start from '1', it is assumed you are looking in the middle of a source file.
It is rare that the exam will ask you why the compiler failed. (More frequently the exam will ask you where compilation failed).
The infamous 'What is the result?' is kind of a catch-all question, it allows for sucessful output, or compiler errors, or runtime exceptions, to all be gramatically acceptable answers.
-Bert