nerdexam
GIAC

GSSP-JAVA · Question #24

Mark works as a Programmer for InfoTech Inc. He creates a program that uses the following code. 1. class Book 2. { 3. Short f1= 15; 4. Book GetDetails(Book b1) 5. { 6. b1=null; 7. return b1; 8. } 9…

The correct answer is C. 2. See the full explanation below for the reasoning.

Question

Mark works as a Programmer for InfoTech Inc. He creates a program that uses the following code. 1. class Book 2. { 3. Short f1= 15; 4. Book GetDetails(Book b1) 5. { 6. b1=null; 7. return b1; 8. } 9. public static void main(String args[]) 10. { 11. Book b1 = new Book(); 12. Book b2 = new Book(); 13. Book b3 = b1.GetDetails(b2); 14. b1=null; 15. //code 16. } 17. } How many objects will be eligible for garbage collection when line 15 is reached?

Options

  • AIt cannot be determined.
  • B1
  • C2
  • D0

How the community answered

(38 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    84% (32)
  • D
    11% (4)

Community Discussion

No community discussion yet for this question.

Full GSSP-JAVA Practice