Which of the following jobs are NOT performed by Garbage Collector?

  1. Freeing memory on the stack.

  2. Avoiding memory leaks.

  3. Freeing memory occupied by unreferenced objects.

  4. Closing unclosed database collections.

  5. Closing unclosed files.


Correct Option: A,D,E

AI Explanation

To answer this question, let's go through each option and determine whether it is performed by the Garbage Collector:

Option A) Freeing memory on the stack - This option is NOT performed by the Garbage Collector. The Garbage Collector is responsible for freeing memory occupied by objects on the heap, not on the stack.

Option B) Avoiding memory leaks - This option is performed by the Garbage Collector. The Garbage Collector identifies and collects memory that is no longer referenced, preventing memory leaks.

Option C) Freeing memory occupied by unreferenced objects - This option is performed by the Garbage Collector. The Garbage Collector identifies objects that are no longer referenced by the program and frees the memory occupied by those objects.

Option D) Closing unclosed database collections - This option is NOT performed by the Garbage Collector. Closing unclosed database collections is typically the responsibility of the programmer or the database management system, not the Garbage Collector.

Option E) Closing unclosed files - This option is NOT performed by the Garbage Collector. Closing unclosed files is typically the responsibility of the programmer or the operating system, not the Garbage Collector.

Therefore, the correct answer is A, D, and E. These options are not performed by the Garbage Collector.

Find more quizzes: