Lucy Das

+ Follow
since Jul 14, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lucy Das

Thanks a lot everyone.
Barry - sorry for posting all the questions in one go.. I just compiled all the doubts I had relating to one specific Mock exam.
Hi all,
The following questions are from Certification4Careers SCJP exams
I doubt some of the answers... your inputs will be greatly appreciated.Thanks in advance.
29. An inner class created inside a method can access
A. Any local variables of a method that contain an inner class.
B. Any instance variables of the enclosing class
C. Any final variables of the enclosing class or a method that contain an inner class.
D. None of the above
Ans is C. Me thinks its B,C
32. Please select invalid statement(s) for a thread
A. You can restart a dead thread
B. You can't call the methods of a dead thread
C. Both of the above
D. None of the above
The ans. is D. Isn't A invalid? I didn't think you could restart a dead thread.
38. Please select true statement for prefix operator(++x/--x).
A. The prefix operator(++x/--x) evaluates the value of the operand after increment/decrement operation.
B. The prefix operator(++x/--x) evaluates the value of the operand before increment/decrement operation.
C. Both A and B
D. None of the above
Ans is A. Am I missing something here? I thought it would be B.
65. 'null' is valid java type.
A. True
B. False
The answer is A. I guess the wording is unclear. -
How can null be a type?
SCJP Mock Exam 2
13. Consider following code:
public class OuterClass{
class InnerClass{
public void innerClassDemo(){
//Explicit instance of InnerClass
In above example, how can you explicitly create an instance of InnerClass?
A. InnerClass i=InnerClass();
B. InnerClass i=OuterClass.InnerClass();
C. InnerClass i=new OuterClass ().new InnerClass();
D. OuterClass.InnerClass i=new OuterClass.InnerClass();
Ans. is C,D; I picked C and that too I think it should be
OuterClass.InnerClass i = new OuterClass().new InnerClass();
In the question below, I am somehow missing the reason why the exception thrown by m5 (method 5) is not getting caught. The strange part is I changed the throws clause in the signature to "ColorException" and it still didn't catch it.
I know its something obvious but I just can't seem to put my finger on the spot.. Any help would be appreciated.
class ColorException extends Exception {}
class WhiteException extends ColorException {}
class White {
void m1() throws Exception {throw new ColorException();}
void m2() throws ColorException {throw new WhiteException();}
void m3() throws WhiteException {}
void m4() throws Exception {throw new Exception();}
void m5() throws WhiteException {throw new WhiteException();}
void m6() {}
public static void main (String[] args) {
White white = new White();
char a,b,c,d,f,g,h,i;
a = b = c = d = f = g = h = i = 'a';
try {
try {white.m1();} catch (ColorException e) {a++;} h++;
try {white.m2();} catch (ColorException e) {b++;} h++;
try {white.m3();} catch (ColorException e) {c++;} h++;
try {white.m4();} finally {d++;}
try {white.m5();} catch (ColorException e) {f++;} finally {h++;}
try {white.m6();} catch (Exception e) {g++;} finally {h++;}
} catch (Exception e) {i++;}

What is the result of attempting to compile and run the above program?
a. Prints: b,b,a,b,a,a,d,b
b. Prints: b,b,a,b,a,a,f,b
c. Prints: b,a,a,a,a,a,a,b
d. Prints: b,a,a,b,a,a,c,b
e. Prints: b,b,a,a,b,a,f,b
f. Prints: b,b,b,a,b,b,f,b
g. Runtime Exception
h. Compiler Error
i. None of the Above
The answer is a
Thanks Valentin.. That was helpful.
I could not find any documentation that substantiates the following...
Could anybody throw some light on this subject?
Thanks in advance.

Question 40.
A frame uses BorderLayout Management and has components added to all the regions. On resizing the Frame Some space becomes available. The space is alloted to the regions, in which Order of preference?

A. North , South, West, East and then Center.
B. North , West, South, Center and then Center.
C. Center, East, West, South and then North.
D. West, Center, South, North and then East
The answer is A.
Thanks Anthony.. appreciate your help.
17 years ago
Here's a question I found on a test referenced by called JavaQuestions Mock exam.
Question 65: Which statements about garbage collection are true?
Select all valid answers.

a. You can directly free the memory allocated by an object.
b. You can directly run the garbage collector whenever you want to.
c. The garbage collector informs your object when it is about to be garbage collected.
d. The garbage collector reclaims an object’s memory as soon as it becomes a candidate for garbage collection.
e. The garbage collector runs in low-memory situations.

I think the correct answer is 'e' only but the author indicates that its b,c,e.
Your thoughts will be greatly appreciated. Thanks in advance...
17 years ago
The article does not explain the string pool memory mgmt in detail so I still think Swarna's question is valid.
I found another question in a Mock Exam - Javacaps - Sample 1 - Question 12 that is similar to the one mentioned in Swarna's post..
Does anybody have any thoughts on the same?