Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Boone's Exam #65

 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This was taken from Boone's mock exam at:
http://www.geocities.com/SiliconValley/Orchard/9362/java/javacert/newboone40-70.html
Question #65
Question 65: Which statements about garbage collection are true?
Select all valid answers.
a.You can directly free the memory allocated by an object.
b.You can directly run the garbage collector whenever you want to.
c.The garbage collector informs your object when it is about to be garbage collected.
d.The garbage collector reclaims an object´┐Żs memory as soon as it becomes a candidate for garbage collection.
e.The garbage collector runs in low-memory situations.
He gives the answer as b,c,e
B is wrong though because while you can request the GC to run, you can not enforce it to run whenever you want to.
C I am not sure about, can anyone help me with that one.
E I know is true.
Thanks,
Bill
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,
Think you're right about b; if it read "You can directly invoke the gc.." then it would be true. Using 'run' is, IMHO, misleading.
As to c, according to Jamie Jaworski in Java 2 Certification one of the gc's activities is:
<quote>
Informing selected objects that they are no longer in use and that they should release any nonmemory resources.
</quote>
I think the informing bit has to do with the gc calling <code>finalize()</code> before destroying the object; since the Java Programming Language by Gosling and Arnold says the <code>finalize</code> method should be used to clean-up any non-memory items.
Hope that helps.
------------------
Jane
The cure for boredom is curiosity.
There is no cure for curiosity.
-- Dorothy Parker
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic