jQuery in Action, 2nd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Mughal's Mock Exam-Garbage Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Mughal Watch "Mughal New topic
Author

Mughal's Mock Exam-Garbage Collection

Betty Reynolds
Ranch Hand

Joined: Feb 16, 2000
Posts: 111
I got this wrong the first time I went through the exam because of the reason below, and the more I think about, the more I think this question is in error.

The answer given is c and d. "Very little is guaranteed about the behavior of the garbage collection and finalization mechanisms. The (c) and (d) statements are two of the things that are guaranteed."
Well nothing about the language can be guaranteed--almost anything is subject to change in the future. We can only base our answers on what is true now. Therefore, (e) is correct also.
The Java Tutorial states:

The Java platform has a garbage collector that periodically frees the memory used by objects that are no longer needed. The Java garbage collector is a mark-sweep garbage collector. A mark-sweep garbage collector scans dynamic memory areas for objects and marks those that are referenced. After all possible paths to objects are investigated, unmarked objects (unreferenced objects) are known to be garbage and are collected. (A more complete description of Java's garbage collection algorithm might be "a compacting, mark-sweep collector with some conservative scanning.")

Also, Peter van der Linden in Just Java 2 states "The current Java implementatin from Sun uses the "mark and sweep" garbage collection algorithm" (p. 297).

[This message has been edited by Betty Reynolds (edited April 10, 2000).]
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Betty,
Can you post the MockExam name and the qstn no. please?
Thank you.
regds
maha anna
Betty Reynolds
Ranch Hand

Joined: Feb 16, 2000
Posts: 111
It's the mock exam associated with this book.
Mughal & Rassmussen's A Programmer's Guide to Java Certification
Sometimes referred to at this site as "Khalid's test."
I can't post the question #. It's different every time around because the questions get "shuffled" randomly before they are presented. In the book, which is good by the way, the question number is #30.

[This message has been edited by Betty Reynolds (edited April 10, 2000).]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
as i understand it, gc implementation is not specified in the java specifications so an implementation is free to use whatever algorithm it wishes. the sun jdk uses the mark and sweep but other implementations of the jdk may use a different algorithm
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Mughal's Mock Exam-Garbage Collection
 
Similar Threads
finalize()
GC question from Khalid
JQ+ question: GC and finalize()
A question about garbage collection and finalization mechanisms
Mock question