• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Dans GC Mock - Problem ?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Dans Mock-Exam about GC (Study Guide Chapter 8, Mock 1) is a problem about the correct answer.

Which of the following are true statements and which of the following could be a result of attempting to compile and run the program?
a. Prints: XY
b. Prints: YX
c. Prints: XXYY
d. Prints: YYXX
e. Nothing is printed.
f. There is no guarantee that the garbage collector will run.
g. Compiler Error.
h. Run Time Error.
i. None of the above.
-------------------------------------
Dan says answers a,b,e,f .
But, if answer f is correct (and i would say, thats the only correct answer) all other answers are incorrect - or ?
Michael
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Taupitz:
In Dans Mock-Exam about GC (Study Guide Chapter 8, Mock 1) is a problem about the correct answer.

Which of the following are true statements and which of the following could be a result of attempting to compile and run the program?
a. Prints: XY
b. Prints: YX
c. Prints: XXYY
d. Prints: YYXX
e. Nothing is printed.
f. There is no guarantee that the garbage collector will run.
g. Compiler Error.
h. Run Time Error.
i. None of the above.
-------------------------------------
Dan says answers a,b,e,f .
But, if answer f is correct (and i would say, thats the only correct answer) all other answers are incorrect - or ?
Michael


The question asks you what 'could' happen. So, if the garbage collection runs and the objects of class B are garbage collected, 'a' and 'b' might happen. Otherwise, if the gc does not run (which is what 'f' says) then nothing will be printed.
 
Michael Taupitz
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx Vivek, i'd overseen this could. But is it correct to say - what could happen - or not.
Mayba all can happen - it could also happen a OutOfMemoryException - or ? ;-)
Okay, but this gives me a feeling for the real exam..... ;-)
Michael
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic