• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Jeanne Boyarsky - Assessment Test - Question 14  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Correct Answer: DEF


Thanks!
 
Marshal
Posts: 5987
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm thinking that you would pass a List via the constructor.  What do you think?  How would that work?
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

jnrohit Jain wrote:I do not understand which object can replace line 5 (blank line) to compile and execute code successfully.


Whatever object you create has to be assignable to a variable of type HenHouse. Are there any classes given that can be assigned to a variable of type HenHouse, if not can you create one?
 
Sheriff
Posts: 6743
466
BSD Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Liutauras Vilda
Sheriff
Posts: 6743
466
BSD Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Think, what this line can give you as a returned value? Maybe returned but not much in there? Maybe nothing returned at all in some cases?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!