JAVA DUMPS 16 (SCJP)

QUESTION NO: 85

Given:

12. float f[][][] = new float[3][][];

13. float f0 = 1.0f;

14. float[][] farray = new float[1][1];

What is valid?

A. f[0] = f0;

B. f[0] = farray;

C. f[0] = farray[0];

D. f[0] = farray[0][0];

Answer: B


 

QUESTION NO: 86

Given:

11. for (int i =0; i < 4; i +=2) {

12. System.out.print(i + "");

13. }

14. System.out.println(i);

What is the result?

A. 0 2 4

B. 0 2 4 5

C. 0 1 2 3 4

D. Compilation fails.

E. An exception is thrown at runtime.

Answer: D


 

QUESTION NO: 87

Given:

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.printIn("start 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.

Answer: C


 

QUESTION NO: 88

Given:

1. public class Exception Test {

2. class TestException extends Exception {}

3. public void runTest() throws TestException {}

4. public void test() /* Point X */ {

5. runTest();

6. }

7. }

At Point X on line 4, which code is necessary to make the code compile?

A. No code is necessary.

B. throws Exception

C. catch ( Exception e )

D. throws RuntimeException

E. catch ( TestException e)

Answer: B


 

QUESTION NO: 89

Given:

11. int i = 0;

12. while (true) {

13. if(i==4) {

14. break;

15. }

16. ++i;

17. }

18. System.out.println("i="+i);

What is the result?

A. i = 0

B. i = 3

C. i = 4

D. i = 5

E. Compilation fails.

Answer: C


 

QUESTION NO: 90

Given:

11. try {

12. int x = 0;

13. int y = 5 / x;

14. } catch (Exception e) {

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

16. } catch (ArithmeticException ae) {

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

18. }

19. System.out.println("finished");

What is the result?

A. finished

B. Exception

C. Compilation fails.

D. Arithmetic Exception

Answer: C


 

QUESTION NO: 91

Given:

1. public class Test { }

What is the prototype of the default constructor?

A. Test()

B. Test(void)

C. public Test()

D. public Test(void)

E. public void Test()

Answer: A

2 comments:

Anonymous said...

The answer for question no:91 is C.

Anonymous said...

The correct answer for 91 is C.
C. public Test()

The default constructor of a class has the same access modifier with which the class has been declared. For example, the default constructor of a public class is implicitly given the public access.

http://www.ucertify.com/article/constructors.html

Post a Comment