Skills101
← All practice quizzes

Quiz: JVM Memory and Garbage Collection

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Where your variables and objects really live inside the JVM, how stack frames work, when an object becomes eligible for garbage collection, how generational GC works, and how memory leaks still happen in Java.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    Where does the object created by Student s = new Student(); inside a method live?

  2. Question 2

    Which error is thrown when recursion never reaches a base case?

  3. Question 3

    What does this print?

    public class Main {
        static int sum(int n) {
            if (n == 0) return 0;
            return n + sum(n - 1);
        }
        public static void main(String[] args) {
            System.out.println(sum(4));
        }
    }
    
  4. Question 4

    When does an object become eligible for garbage collection?

  5. Question 5

    Two objects reference only each other, and no variable points to either. What happens?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →