Below is Question 14 from "Jeanne Boyarsky" book Assessment Test at page xxxvii. I do not understand which object can replace line 5 (blank line) to compile and execute code successfully.
Q.14. Assuming we have a valid, non-null HenHouse object whose value is initialized by the
blank line shown here, which of the following are possible outputs of this application?
(Choose all that apply)
A. The code will not compile because of line 6.
B. The code will not compile because of lines 7–8.
C. The application will compile but not produce any output.
D. The application will output Cluck exactly once.
E. The application will output Cluck more than once.
F. The application will compile but produce an exception at runtime.
jnrohit Jain wrote: I do not understand which object can replace line 5 (blank line) to compile and execute code successfully.
The one, which implements HenHouse interface. However, this question isn't about that as book authors let you assume all is fine with that particular line in order to shorten code and train you on the particular topic this question is meant to test.
However, given answers as correct ones are correct.
Tricky part could be to understand what this question is asking by not reading it carefully. Exam also contains questions to which not paying careful attention could give an unexpected outcome.
which of the following are possible outputs of this application?
You need to read this question, on any possible input, what are the all possible outcomes?