aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Javacaps mock exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Javacaps mock exam" Watch "Javacaps mock exam" New topic
Author

Javacaps mock exam

Neha Sawant
Ranch Hand

Joined: Oct 11, 2001
Posts: 204
This question is from Javacaps mock 1 Q12
Here the answer given is A but since according to our final discussion string literals are not garbage collected then the answer should be D.
Am i right?

String string1 = "Test";
String string2 = "Today";
string1 = null;
string1 = string2;
A) 1
B) 2
C) 3
D) 0
another question no 11
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.
Ans given is A and C
but i feel it should be only C
Please someone help
Neha


nss
Nain Hwu
Ranch Hand

Joined: Sep 16, 2001
Posts: 139
Neha,
I agree with you 100%.
Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1242
I agree on the first one..
but the second one..
the GC does A) The garbage collector runs in low memory situations
so it is A and C.
correct me if i am wrong.
Neha Sawant
Ranch Hand

Joined: Oct 11, 2001
Posts: 204
But FEING you cannot be sure when GC occurs so you cannot make a conclusion like the one mentioned
Correct me if i am wrong
Regards
Neha
vishal avad
Ranch Hand

Joined: Nov 29, 2001
Posts: 45
hi neha
u can not sure when GC is going to run but its true that it runs in low memory situations.
but it is not sure that whether it able to free up the memory or not
i m agree on 1.
amit mawkin
Ranch Hand

Joined: Oct 31, 2001
Posts: 73
I agree with Fei

------------------
coffee drinker


regards, Amit
coffee drinker and Sun Certified Programmer for Java 2 Platform
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
hi,
i agree with vishal.
-maulin.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javacaps mock exam