my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Q:65 on Barry Boone Exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Q:65 on Barry Boone Exam" Watch "Q:65 on Barry Boone Exam" New topic
Author

Q:65 on Barry Boone Exam

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Jun 09, 2000
Posts: 410
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


SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Nirmala
Ranch Hand

Joined: Jun 28, 2000
Posts: 93
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

Joined: Nov 22, 2008
Posts: 18944
Nirmala,
can u pl. tell me what are the correct options for this question,
thanks,
DS

 
GeeCON Prague 2014
 
subject: Q:65 on Barry Boone Exam