This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes some Qs from javahomepage??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "some Qs from javahomepage???" Watch "some Qs from javahomepage???" New topic
Author

some Qs from javahomepage???

sunilkumar ssuparasmul
Ranch Hand

Joined: Dec 13, 2000
Posts: 142
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"


"Winners don't do different things<br /> They do things differently"
Rishi Yagnik
Ranch Hand

Joined: Jan 04, 2001
Posts: 84
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

Joined: Dec 13, 2000
Posts: 142
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"
atin sehgal
Ranch Hand

Joined: Nov 12, 2000
Posts: 32
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..
bala G
Greenhorn

Joined: Jan 15, 2001
Posts: 6
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

Joined: Nov 12, 2000
Posts: 32
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....
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
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


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
sunilkumar ssuparasmul
Ranch Hand

Joined: Dec 13, 2000
Posts: 142
Thanka Ajith and others.My doubt was clarified.
------------------
"Winners don't do different things
They do things differently"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: some Qs from javahomepage???
 
Similar Threads
Garbage collection Question
GC
garbage collection
garbage collection
Garbage collection