• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q:65 on Barry Boone Exam

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
I selected option c & e as correct answer.but in the answer includes b also.How can we run GC , whenever we want...
IMO, we can just request to run not force.
can anybody explain me , what could be the right answer....
thanks in advance,
DS

 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only d should be correct answer
c is not correct because garbage collector cannot predict when
the object will not have any references to it.
b is incorrect because issuing command System.gc()
only suggests to start Garbage collector do not guarantees
e will be correct only if it were written as
"e.The garbage collector may run in low-memory situations."
I hope it clarifies your doubts
any other takers for it ?
Originally posted by Deepak Sachdeva:
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.
I selected option c & e as correct answer.but in the answer includes b also.How can we run GC , whenever we want...
IMO, we can just request to run not force.
can anybody explain me , what could be the right answer....
thanks in advance,
DS

 
Nirmala
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Deepak,
Here is the forum link which already discussed the same question.
http://www.javaranch.com/ubb/Forum24/HTML/002457.html
Hope this will help you
Thanks
Nirmala
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nirmala,
can u pl. tell me what are the correct options for this question,
thanks,
DS

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic