• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

some Qs from javahomepage???

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) Which statements about garbage collection are true?
Select all valid answers.

1-You can directly free the memory allocated by an object.
2-You can directly run the garbage collector whenever you want to.
3-The garbage collector informs your object when it is about to be garbage collected.
4-The garbage collector reclaims an object�s memory as soon as it becomes a candidate for garbage collection.
5-The garbage collector runs in low-memory situations.
Ans is 2,3,5 .BUT I GUESS IT IS ONLY 3.please explain.

Question 64: Returning a value of false in Java 1.0.2 from an event handler:
Select the one right answer.

1)passes that event is passed up the container hierarchy
2)stops that event from being passed up the container hierarchy
3)has no effect on whether the event is passed up the container heirarchy
ANs is 1.How? and also i wanted to know that do questions abt deprecated mathods appear in exam?

------------------
"Winners don't do different things
They do things differently"
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi sunil
i think garbage collection can be run by System.gc() and garbage collection always runs in low memory situation as it is a lower priority thread so 2,5 is correct.
bye correct me if i am wrong
 
sunilkumar ssuparasmul
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rishi,
Garbafe collector can ONLY be invoked by System.gc(). you can never know when it will run.
I guess 5 is right as i misinterpreted the question as "garbage collector always runs in low priority".But for 2 i dont think so can somebody throw light on it

Thanks in advance,
sunil.s
------------------
"Winners don't do different things
They do things differently"
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
According to me the following shd be the answer
5) true-->GC always runs in low memory situation .
4) false-->The garbage collector reclaims an object�s memory as soon as it becomes a candidate for garbage collection.
There is no surity if GC will ever run even if object is a candidate for Garbage collection
3) Not sure-->The garbage collector informs your object when it is about to be garbage collected.
Am not sur whether it will be true.
2) True-->You can directly run the garbage collector whenever you want to.i think we can call system.gc() method but whether the object will be garbage collected is not a surity...
1) False-You can directly free the memory allocated by an object. Not possible in java..GC does this work.
Hope this helps...

Help me abt my doubts...
regards..
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
TRUE:The GC can be invoked any time
Every object inherits it.
It informs the object before collecting
False:There is no telling when the GC will exec.
Ref:jwrski certification guide
HOpe it helps
[This message has been edited by bala G (edited January 15, 2001).]
 
atin sehgal
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How 2 is false some one please eplain..
i dont get it.
If by this question he is reffering to the method that can be clled or is he simply means abt GC..

Plz reply....
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1-You can directly free the memory allocated by an object.
False.
This is not C++!! Garbage collector does this for you.
2-You can directly run the garbage collector whenever you want to.
False.
You can only suggest to JVM that the GC be run. This is only a request and it is not guaranteed that GC will actually run immediately after your request.
3-The garbage collector informs your object when it is about to be garbage collected.
True!
Remember the finalize() method??
4-The garbage collector reclaims an object�s memory as soon as it becomes a candidate for garbage collection.
False.
No body ( not even God ) can tell when GC will run.
5-The garbage collector runs in low-memory situations.
False.
You can easily write a program that runs out of memory

Hope that helps,
Ajith
 
sunilkumar ssuparasmul
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanka Ajith and others.My doubt was clarified.
------------------
"Winners don't do different things
They do things differently"
 
If you're gonna buy things, buy this thing and I get a fat kickback:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic