Rasri Anand

Greenhorn
+ Follow
since Apr 19, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rasri Anand

I don't think there is any connection. I chose novice for Threads and GC but I got those questions right in the end.
Hi all,
It was my turn today to take the exam.
I found that 4 hrs were NOT sufficient enough for me to do justice to all the 161 questions.
I took time to double check each of the questions initially even the simpler ones ( and this probably cost me some time) therefore, by the time I reached the last 20-30 questions, I had to rush through.
These last few questions were all to do with "Threads" and "GC", and all were code intensive.
There were quite a few questions about String operations. Most to do with the immutable nature of Strings. And at least 7-8 questions dealt with POST-INCREMENT, PRE-INCREMENT operators. There were a few questions on the implementation of "hashCode" and "equals" methods.
The questions on assertions were quite simple and the material provided by SUN is more than enough.
I got atleast 5-6 questions on encapsulation. They were of the True or False type.
There was a question on LinkedHashSet. Rest were more to do with the hierarchy.
If I remember anything else important I will post the same. The exam was exhausting to say the least.
line.concat("world") will also return a new object. But that object 's refernce is not being stored anywhere.
When you do line = line.concat("world")
line is now pointing to the new object. So you are able to access it.
The answer is 13 because Strings are immutable.
line.concat("world") returns a new string object " hello world" but you are not storing the object refernce anywhere.
newline = "hello"\\ 5 chars after trim.
line = " hello "\8 chars
So the final result is 13.
Hi,
The url to applied reasoning mock exam doesn't seem to work. Can anyone point me to the correct location?
Thanks
The number 1-800 422-8020 is for both US and Canada. If you call them at this number and tell them that you are in Canada, I think they will charge your credit card accordingly.
Thanks for the explanation Clement. It helped.
This is from the boone exam Q.13:

At which point is the object referred to by the variable "first", eligible for garbage collection?
The answer given is:
After the line labelled d: has executed.

I thought since args[0] would still be referring to the object initially referred to by first, it cannot be eligible for garbage collection till args[0] = null has been executed.
Can somebody please explain this?
JQ+
You can find it here:
JQ+
In the first case since there are no leading blanks to remove, a new object is not created.So the answer is "Equal". My question is what happens in the other two cases. As far as I can see both LHS and RHS perform exactly the same operation on the same string literal. So they should share the same String object.
Or am I missing something here?
All variables defined in an interface are implicitly public, static and final.
That is why the variable "k" can be accessed directly, through the class name and also through any instance of the class. Since it is final you cannot make any changes to it.
In the same vein:
(from Abhilash's mock test)

case 1 prints "Equal".
Both case 2 & 3 print "Not Equal"
Can somebody please explain why?
I had completely missed that. Thanks.
This is Qno 62 from John Hunt's mock exam:
public final class Test4 implements A {
class Inner {
void test() {
if (Test4.this.flag); {
sample();
}
}
}
private boolean flag = false;
public void sample() {
System.out.println("Sample");
}
public Test4() {
(new Inner()).test();
}
public static void main(String args []) {
new Test4();
}
}

What is the result:
A. Prints out "Sample"
B. Program produces no output but terminates correctly.
C. Program does not terminate.
D. The program will not compile
Select the most appropriate answer.
I thought the answer should be B, as the flag has been set to false. Am I missing something very obvious here? The correct answer is A. I ran the code and it does print "Sample".