• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Khalid Mock Exam Garbage collection

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All
there are few questions from Khaalid Mock Exam
Since answers are not provided I would be thnakful if you give your views
Which statements describe guaranteed behavior of the garbage collection and finalization mechanisms?
a.Objects are deleted when they can no longer be accessed thru any reference
b.finalize method be eventually be called on every object
c.finalize method will neverbe called more than once on every object
d. an object will not garbage collected as long as it is possible for an active part of program to access it thru a reference
e. Grabage collector will use mark and sweep algorithm
I would rate b,c,d but e is doubtful case though it uses
mark and sweep algorithm but is it for every platform
this is confusing
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gaurav,
I want to answer your question.
a) is obviosly wrong.
b) is wrong, because the finalize will called once at an object
definitly(here is eventually the tricky word)
c, d are correct,
e) false
 
Ranch Hand
Posts: 477
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Thomas Beckmann:

b) is wrong, because the finalize will called once at an object
definitly(here is eventually the tricky word)


But the finalize method could not be called at all...are you sure it is wrong?
 
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic