aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes mock q on garbage collection 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 "mock q on garbage collection" Watch "mock q on garbage collection" New topic
Author

mock q on garbage collection

sandu sudhakar
Greenhorn

Joined: Nov 17, 2004
Posts: 4
Which of the following statements about garbage collection are true?

A) The garbage collector runs in low memory situations
B) You can run the garbage collector when ever you want.
C) When it runs, it releases the memory allocated by an object, which is no more in use.
D) Garbage collector immediately runs when you set the references to null.

I expect the answer to be C.
But given answer is A,C.
Not convinced about A. Garbage collector frees memory. But does it have something to do with low memory situation?
Sudhakar Namasivayam
Greenhorn

Joined: Sep 09, 2004
Posts: 11
The main purpose of having a garbage collector is to free up space so that more memory is available for applications.. So the option is kinda obvious..


Regards,<br />Sudhakar<br /> <br />SCJP 1.4
Manikandan Jayaraman
Ranch Hand

Joined: Sep 15, 2004
Posts: 230
Hi, As always said, please mention the link of this mock test or atleast the name of the mock test. Else it is very hard for us to check on that.

Even I find choice A to be a less appropriate one. As mentioned in K&B book, one thing is for sure. The Garbage Collector will run once, DEFINITELY before your JVM crashes due to low memory.

I dont accept choice A for sure anyways. Hope you dont get such ambiguous questions in your exam


Regards,<br />Mani<br />SCJP 1.4 (95%)<br />SCWCD 1.4 (94%)
sandu sudhakar
Greenhorn

Joined: Nov 17, 2004
Posts: 4
Hi, Thanks for the response.

---------------------------------------------------------------------------
The main purpose of having a garbage collector is to free up space so that more memory is available for applications.. So the option is kinda obvious..
--------------------------------------------------------------------------

But garbage collector runs in high memory situations too..that's why I'm against choice A.

----------------------------------------------------------------------------please mention the link of this mock test or atleast the name of the mock test. Else it is very hard for us to check on that.
---------------------------------------------------------------------------
http://www.javacaps.com/scjp_mockexams1.html
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
It didn't say the Garbage Collector runs only in low memory situations.


Mike Gershman
SCJP 1.4, SCWCD in process
sandu sudhakar
Greenhorn

Joined: Nov 17, 2004
Posts: 4
I got it..
 
Don't get me started about those stupid light bulbs.
 
subject: mock q on garbage collection