solve the quiz(urgent)

grabage collection

I want the answer for this question ?

question no : 1

1.public class X (

2. public object m () {

3. object o = new float (3.14F);

4. object [] oa = new object [1];

5. oa[0]= o;

6. o = null;

7. return oa[0];

8. }

9. }

When is the float object created in line 3, eligible for garbage collection?

A. Just after line 5

B. Just after line 6

C. Just after line 7 (that is, as the method returns)

D. Never in this method.

please send the answers to the above question to my mail id satishmca2005@yahoo.com

question no : 2

Given:

10. public Object m() {

11. Object o = new Float(3.14F);

12. Object [] oa = new Object[1];

13. oa[0] = o;

14. o = null;

15. return oa[0];

16. }

When is the Float object, created in line 11, eligible for garbage collection?

A. Just after line 13.

B. Just after line 14.

C. Never in this method.

D. Just after line 15 (that is, as the method returns).

please send the answers to the above question to my mail id satishmca2005@yahoo.com

question no : 3

1. class Bar { }

1. class Test {

2. Bar doBar() {

3. Bar b = new Bar();

4. return b;

5. }

6. public static void main (String args[]) {

7. Test t = new Test();

8. Bar newBar = t.doBar();

9. System.out.println(搉ewBar?;

10. newBar = new Bar();

11. System.out.println(揻inishing?;

12. }

13. }

At what point is the Bar object, created on line 3, eligible for garbage collection?

A. After line 8.

B. After line 10.

C. After line 4, when doBar() completes.

D. After line 11, when main() completes.

please send the answers to the above question to my mail id satishmca2005@yahoo.com

question no : 4

12. void start() {

13. A a = new A();

14. B b = new B();

15. a.s(b);

16. b = null;

17. a = null;

18. System.out.println(搒tart completed?;

19. }

When is the B object, created in line 14, eligible for garbage collection?

A. After line 16.

B. After line 17.

C. After line 18 (when the methods ends).

D. There is no way to be absolutely certain.

E. The object is NOT eligible for garbage collection.

please send the answers to the above question to my mail id satishmca2005@yahoo.com

question no : 5

1. class TestA {

2. TestB b;

3. TestA() {

4. b = new TestB(this);

5. }

6. }

7. class TestB {

8. TestA a;

9. TestB(TestA a) {

10. this.a = a;

11. }

12. }

13. class TestAll {

14. public static void main (String args[]) {

15. new TestAll().makeThings();

16. // ...code continues on

17. }

18. void makeThings() {

19. TestA test = new TestA();

20. }

21. }

Which two statements are true after line 15, before main completes? (Choose two)

A. Line 15 causes a stack overflow.

B. An exception is thrown at runtime.

C. The object referenced by a is eligible for garbage collection.

D. The object referenced by b is eligible for garbage collection.

E. The object referenced by a is not eligible for garbage collection.

F. The object referenced by b is not eligible for garbage collection.

please send the answers to the above question to my mail id satishmca2005@yahoo.com

Quiz : 2

exception and other doubts

Question no 1 :

Given:

boolean bool = true;

if(bool = false) {

System.out.println("a");

} else if (bool) {

System.out.println("c");

} else if (!bool) {

System.out.println("c");

} else {

System.out.println("d");

}

What is the result?

A. a

B. b

C. c

D. d

E. Compilation fails.

please send the answers to the above question to my mail id satishmca2005@yahoo.com

Question no 2:

class Super {

public int i = 0;

public Super(String text) {

i = 1;

}

}

public class Sub extends Super {

public Sub(String text) {

i = 2;

}

public static void main(String args[]) {

Sub sub = new Sub("Hello");

System.out.println(sub.i);

}

}

What is the result?

A. 0

B. 1

C. 2

D. Compilation fails.

please send the answers to the above question to my mail id satishmca2005@yahoo.com

Question no 3 :

Given:

try {

int x = 0;

int y = 5 / x;

} catch (Exception e) {

System.out.println("Exception");

} catch (ArithmeticException ae) {

System.out.println("Arithmetic Exception");

}

System.out.println("finished");

What is the result?

A. finished

B. Exception

C. Compilation fails.

D. Arithmetic Exception

please send the answers to the above question to my mail id satishmca2005@yahoo.com

Question no 4 :

public class SyncTest{

public static void main(String[] args) {

final StringBuffer s1= new StringBuffer();

final StringBuffer s2= new StringBuffer();

new Thread () {

public void run() {

synchronized(s1) {

s2.append("A");

synchronized(s2) {

s2.append("B");

System.out.print(s1);

System.out.print(s2);

}

}

}

}.start();

new Thread() {

public void run() {

synchronized(s2) {

s2.append("C");

synchronized(s1) {

s1.append("D");

System.out.print(s2);

System.out.print(s1);

}

}

}

}.start();

}

}

Which two statements are true? (Choose Two)

A. The program prints "ABBCAD"

B. The program prints "CDDACB"

C. The program prints "ADCBADBC"

D. The output is a non-deterministic point because of a possible deadlock condition.

E. The output is dependent on the threading model of the system the program is

running on.

please send the answers to the above question to my mail id satishmca2005@yahoo.com

[6225 byte] By [satishmcaa] at [2007-9-23]
# 1
Stop spamming idiot. Do your homework yourself. http://forum.java.sun.com/thread.jspa?threadID=639847
EllaOfTheCindersa at 2007-7-11 > top of java,Java Essentials,New To Java...
# 2
Why not just give us your instructor's E-mail so we can sent the answers directly to him. That way you won't have to do anything.
dbulaia at 2007-7-11 > top of java,Java Essentials,New To Java...
# 3
Troll.
yawmarka at 2007-7-11 > top of java,Java Essentials,New To Java...
# 4
> Troll.Bridge.
Adeodatusa at 2007-7-11 > top of java,Java Essentials,New To Java...
# 5
Quiz1:1. A2. A3. A4. A5. AQuiz21.A2.A3.A4.A5.A
tnguyen1973a at 2007-7-11 > top of java,Java Essentials,New To Java...
# 6
> > Troll.> > Bridge.I always thought Trolls lived under the bridge--new breed of flying Troll.
morgalra at 2007-7-11 > top of java,Java Essentials,New To Java...
# 7
Quiz1:1. Gettysburg2. Harrisbug3. Hamburg4. Luxembourg5. 42Quiz21.Abraham Lincoln2.his mother3.my religion forbids me to answer this question4.any odd prime5.Phoenix Arizonakind regards,Jos
JosAHa at 2007-7-11 > top of java,Java Essentials,New To Java...
# 8
satishmca2005@yahoo.comEnjoy the spam.
jimmy_cricketa at 2007-7-11 > top of java,Java Essentials,New To Java...
# 9
> satishmca2005@yahoo.com> > Enjoy the spam.spam, Spam, SPAM! Wonderful SPAM!
Adeodatusa at 2007-7-11 > top of java,Java Essentials,New To Java...
# 10
> satishmca2005@yahoo.com> > Enjoy the spam.No matter what the OP did, I find this very unsympatheic: publishing someoneelse's email address without asking first is not done IMO.Jos
JosAHa at 2007-7-11 > top of java,Java Essentials,New To Java...
# 11
The OP posted it first.
nasch_a at 2007-7-11 > top of java,Java Essentials,New To Java...
# 12
> The OP posted it first.I see that now, but replicating it just for spam bait is not done IMO.kind regards,Jos
JosAHa at 2007-7-11 > top of java,Java Essentials,New To Java...
# 13
> > The OP posted it first.> > I see that now, but replicating it just for spam bait> is not done IMO.> yes it is. Spammers do it all the time :)I think it's a good penalty for terminal laziness too.
jwentinga at 2007-7-11 > top of java,Java Essentials,New To Java...
# 14
I'm impressed by the fact that the OP managed to write his e-mail address 9 times in his post, he did also cross-post to 3 different forums, so he is worth all the spam./Kaj
kajbja at 2007-7-11 > top of java,Java Essentials,New To Java...