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

Garbage collection

B pandoo
Ranch Hand

Joined: Nov 14, 2006
Posts: 37
Determine which of following statements are true(multiple options)

1)Garbage collection is performed by a low priority daemon thread.
2)garbage collection always uses mark and sweep algorithm
3)The finalize() method is invoked for the objects in the order in which they were created.
4)The finalize method is typically used to free up the resouces other than memory.
5)objects that are created and accessed locally within the method ,are eligible for garbage collection when the method returns.

please tell me which statements are true.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11328
    
  16

which do you think are true? what has your research found, and what doesn't make sense?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
B pandoo
Ranch Hand

Joined: Nov 14, 2006
Posts: 37
I believe the true statements are 3,4,5.
I want to clarify whether my answers are correct.
and then i know that statement 2 is wrong.May i know whether statement 1 is correct or wrong?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9390
    
    2

I guess the first one.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9390
    
    2

How can 3,4,5 be the correct options??
B pandoo
Ranch Hand

Joined: Nov 14, 2006
Posts: 37
i believe so.I am not sure.so only i am asking guidance from the group
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9390
    
    2

Hi,

There are many other algorithms apart from mark and sweep.
The finalize method does not run on objects created in any order.

The fourth one can be true.

Tha last one is definitely not true.
B pandoo
Ranch Hand

Joined: Nov 14, 2006
Posts: 37
thanks.what about option 1
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
It's great to discuss mock questions on this forum, but the authors of the questions really appreciate it when you credit them! For instance you can say:

"This question is from Dan Chisolm..."

Thanks!


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Abdul Rehman
Ranch Hand

Joined: Nov 07, 2006
Posts: 65
Option 1 is true. Garbage collection is indeed performed by a daemon thread.


SCJP 5.0 (100%)
Rick Reumann
Ranch Hand

Joined: Apr 03, 2001
Posts: 281
So what is the actual answer? ( 1 and 4 ?)
Krzysztof Koziol
Ranch Hand

Joined: Nov 19, 2006
Posts: 133

Hi,

In my opinion is 1,4 and 5.

Regards


SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCEA/OCMJEA 5.0
Dan Polak
Ranch Hand

Joined: Nov 06, 2006
Posts: 32
5 is not true Krzystof because we can create and start thread in that method


<a href="http://www.dantheman.pl" target="_blank" rel="nofollow">http://www.dantheman.pl</a>
krishnareddy mudiyala
Greenhorn

Joined: Nov 23, 2006
Posts: 9
Hi all,
This is my first post in the forum.
i think 1 and 4 are TRUE (99.99%).

------
Thanks to Head First Series
venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
Yes only 1 & 4 are correct
venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
Yes only 1 & 4 are correct
Abdul Rehman
Ranch Hand

Joined: Nov 07, 2006
Posts: 65
Is 2 correct or not?
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
I'm not sure the original question was quoted exactly, and especially for GC questions the EXACT wording is important - if that IS the exact wording then the question is suspect. Given all that, I don't think you guys have the correct answer yet - although I would say that before spending too much more time on this one, the thread originator should verify that the EXACT wording has been used.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
As Bert implies, so much time has been wasted on this simple issue. So, please, always give the exact origin or source of the mock questions.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
krishnareddy mudiyala
Greenhorn

Joined: Nov 23, 2006
Posts: 9
Yes questions is not clear but given that

1 true
2 cannot guarantee
3 false
4 true
5 true
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
I think 1 isn't always true. I would guess that's it's usually true, but I think you could create a Sun certified JVM that used a different technique.

Again - the wording on these mock GC questions has to be absolutely precise or the question is rendered meaningless - and this question falls squarely into the "imprecise" category. :roll:
 
wood burning stoves
 
subject: Garbage collection