{ "topic": "gc-jvm", "type": "single_choice", "schema_version": "1.0.0", "generated": "2026-09-02T00:00:00Z", "questions": [ { "id": "sc-001", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "以下哪个不是 JVM 的 GC 类型?", "explanation": "三种主要 GC 类型是 Minor GC、Major GC 和 Full GC,没有 Super GC。", "source": null, "related": [], "options": { "A": "Minor GC", "B": "Major GC", "C": "Full GC", "D": "Super GC" }, "answer": "D" }, { "id": "sc-002", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "新生代通常使用哪种垃圾回收算法?", "explanation": "新生代使用复制算法(Copying),高效处理短生命周期对象。", "source": null, "related": [], "options": { "A": "标记-清除", "B": "标记-整理", "C": "复制算法", "D": "引用计数" }, "answer": "C" }, { "id": "sc-003", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "哪个垃圾收集器以低停顿为目标,并使用增量更新?", "explanation": "CMS(Concurrent Mark Sweep)以低停顿为目标,使用增量更新(Incremental Update)。", "source": null, "related": [], "options": { "A": "Serial", "B": "Parallel Scavenge", "C": "CMS", "D": "G1" }, "answer": "C" }, { "id": "sc-004", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "哪个垃圾收集器在 JDK 9 成为默认收集器,并支持停顿时间预测?", "explanation": "G1(Garbage First)在 JDK 9 成为默认收集器,支持可预测的停顿时间。", "source": null, "related": [], "options": { "A": "Serial", "B": "CMS", "C": "G1", "D": "ZGC" }, "answer": "C" }, { "id": "sc-005", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "ZGC 的设计目标是停顿时间低于______。", "explanation": "ZGC 设计目标是停顿时间低于 10ms,适合延迟敏感的应用。", "source": null, "related": [], "options": { "A": "100ms", "B": "50ms", "C": "10ms", "D": "1ms" }, "answer": "C" }, { "id": "sc-006", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "以下哪个属于 GC Root?", "explanation": "静态字段是 GC Root。其他 GC Root 还包括虚拟机栈局部变量、final static 常量、JNI 引用、synchronized 持有的对象。", "source": null, "related": [], "options": { "A": "堆中的局部变量", "B": "静态字段(static fields)", "C": "Eden 区中的对象", "D": "Survivor 区中的对象" }, "answer": "B" }, { "id": "sc-007", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "并发标记期间,当一个白色对象被黑色对象新增引用时,会产生什么问题?", "explanation": "这叫漏标(Missed Marking),存活对象可能因未被标记而被错误回收。", "source": null, "related": [], "options": { "A": "内存泄漏", "B": "漏标", "C": "栈溢出", "D": "死锁" }, "answer": "B" }, { "id": "sc-008", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "老年代使用哪种算法可以避免内存碎片,但 STW 时间更长?", "explanation": "标记-整理(Mark-Compact)通过移动对象消除碎片,但移动操作导致更长的 STW。", "source": null, "related": [], "options": { "A": "复制算法", "B": "标记-清除", "C": "标记-整理", "D": "引用计数" }, "answer": "C" }, { "id": "sc-009", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "哪个垃圾收集器支持 Mixed GC 并使用 SATB?", "explanation": "G1 支持 Mixed GC(同时收集新生代和老年代),并使用 SATB 进行并发标记。", "source": null, "related": [], "options": { "A": "Serial", "B": "CMS", "C": "G1", "D": "Parallel Scavenge" }, "answer": "C" }, { "id": "sc-010", "type": "single_choice", "difficulty": 3, "tags": [ "jvm", "gc", "heap" ], "question": "CMS 的初始标记(Initial Mark)阶段做什么?", "explanation": "CMS 初始标记阶段(需要 STW)枚举 GC Roots 的直接引用,标记为灰色,建立起始快照。", "source": null, "related": [], "options": { "A": "回收所有垃圾", "B": "枚举 GC Roots 直接引用并标记为灰色", "C": "移动对象以压缩内存", "D": "清除不可达对象" }, "answer": "B" } ] }