JAVA DUMPS 19 (SCJP)

QUESTION NO: 6

Which statement is true?

A. Memory is reclaimed by calling Runtime.gc().

B. Objects are not collected if they are accessible from live threads.

C. Objects that have finalize() methods are never garbage collected.

D. Objects that have finalize() methods always have their finalize() methods called before

the program ends.

E. An OutOfMemory error is only thrown if a single block of memory cannot be found

that is large enough for a particular requirement.

Answer: B


 

QUESTION NO: 7

Given:

1. class A {

2. A() { }

3. }

4.

5. class B extends A {

6. }

Which two statements are true? (Choose two)

A. Class B's constructor is public.

B. Class B's constructor has no arguments.

C. Class B's constructor includes a call to this().

D. Class B's constructor includes a call to super().

Answer: B, D


 

QUESTION NO: 8

Given:

11. int i = 1,j = 10;

12. do {

13. if(i>j) {

14. break;

15. }

16. j--;

17. } while (++i <5);

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

What is the result?

A. i = 6 and j = 5

B. i = 5 and j = 5

C. i = 6 and j = 4

D. i = 5 and j = 6

E. i = 6 and j = 6

Answer: D


 

QUESTION NO: 9

Which statement is true?

A. Assertions can be enabled or disabled on a class-by-class basis.

B. Conditional compilation is used to allow tested classes to run at full speed.

C. Assertions are appropriate for checking the validity of arguments in a method.

D. The programmer can choose to execute a return statement or to throw an exception if

an assertion fails.

Answer: A


 

QUESTION NO: 10

You want a class to have access to members of another class in the same package. Which

is the most restrictive access that accomplishes this objective?

A. public

B. private

C. protected

D. transient

E. default access

Answer: E

1 comments:

Krishna said...

Here you can find the quality SCJP 1.5 questions,
SCJP 1.5 Questions

Post a Comment