wood burning stoves 2.0*
The moose likes Mock Exam Errata and the fly likes MindQ  q.no.37,42,45 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "MindQ  q.no.37,42,45" Watch "MindQ  q.no.37,42,45" New topic
Author

MindQ q.no.37,42,45

Alokesh Phukan
Greenhorn

Joined: May 24, 2001
Posts: 21
Dear Friends,
These q's are from the MindQ Test
45. Which methods does java.lang.Math include for trigonometric computations?
a) sin()
b) cos()
c) tan()
d) aSin()
e) aCos()
f) aTan()
g) toDegree()
Ans given: a,b,c
Doubt: are aSin, aCos, aTan not trigonometric computations ?
42. Which method below can change a String object, s ?
a) equals( s )
b) substring( s )
c) concat( s )
d) toUpperCase( s )
e) none of the above will change s
Ans given:e
Doubt:What is it testing? Strings being immutable or the method calls ?
37. Which of the following statements about Java's garbage collection are true?
a) The garbage collector can be invoked explicitly using a Runtime object.
b) The finalize method is always called before an object is garbage collected.
c) Any class that includes a finalize method should invoke its superclass' finalize method.
d) Garbage collection behavior is very predictable.
Ans given:a,b,c
Doubt: b?. finalize won't be called more than once for an object.(i.e what if it has failed once??)
Would be great if you could resolve these doubts.
Thanking in advance,
Alokesh
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
45. Got you on case! There is no such method as aCos, aTan, aSin. They are acos, asin, atan.
42. Strings are immutable so no method can change them.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Haining Mu
Ranch Hand

Joined: Jun 01, 2001
Posts: 51
45. Which methods does java.lang.Math include for trigonometric computations?
a) sin()
b) cos()
c) tan()
d) aSin()
e) aCos()
f) aTan()
g) toDegree()
Ans given: a,b,c
Doubt: are aSin, aCos, aTan not trigonometric computations ?

asin, acos,atan are, but not the ones with CAPITAL letters.

42. Which method below can change a String object, s ?
a) equals( s )
b) substring( s )
c) concat( s )
d) toUpperCase( s )
e) none of the above will change s
Ans given:e
Doubt:What is it testing? Strings being immutable or the method calls ?

both. Because all those methods will not change string 's'. Some of them construct and return new ones, but the content of string object which 's' referenced to never changed.
Alokesh Phukan
Greenhorn

Joined: May 24, 2001
Posts: 21
Thanks Thomas, Haining !
Silly of me to not notice the case.
So I gather my doubts on Q 37 are valid ?
Regards
Alokesh
yaeger rosenberg
Greenhorn

Joined: Aug 04, 2001
Posts: 6
I have a question about the last of the three? first, when you invoke gc() don't you do it as System.gc() or Runtime(?).gc(), so you are not really invoking it from a runtime OBJECT (it looks like a static invocation)?
Also, I don't really understand (and I can't get to the SUN site right now): when you make a call to gc(), are you guaranteed that the garbage collector will run? The wording of response a. "the garbage collector can be invoked explicitly" sounds like you are forcing it to run. Is it true that a call to gc() forces the garbage collector to run, but does not guarantee it will collect anything, or does a call to gc() suggest that the collector be run? I would have selected b and c. Is the response a. even talking about a call to gc()? Is a. just an ambiguous answer, and I am worrying too much?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I would say that the question is poorly worded.
------------------
Tom - SCJP --- Co-Moderator of the Programmer Certification Forums
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
You can explicitly invoke the garbage collector using System.gc() or Runtime.getRuntime().gc() BUT there is no guarantee the gc will run.
The finalize() method of any object will only be called once by the garbage collector; even if it fails, the gc will never call it again; however, you can explicitly invoke finalize() as often as you like.
Hope that helps.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I wonder, is finalize() part of the certification? The objectives for garbage collection state, "State the behavior that is guaranteed by the garbage collection system, and write code that explicitly makes objects eligible for collection." RHE makes no mention of finalize(). I only had one gc question and it wasn't about finalize().
------------------
Tom - SCJP --- Co-Moderator of the Programmer Certification Forums
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
It's not really part of the gc objective; but a question on finalize() could come up in relation to java.lang as it's defined in java.lang.Object; so doesn't hurt to be familiar with it.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I am wondering if anyone has ever had a finalize() question. RHE doesn't mention the topic at all.
------------------
Tom - SCJP --- Co-Moderator of the Programmer Certification Forums
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MindQ q.no.37,42,45
 
Similar Threads
GC question on MindQ no. 37
mindQ no.37
Urgent Help needed immediate
mindQ question
MindQ (Q.37) GC