141. What is the purpose of the 'String.formatted()' method (Java 15+)?
- a) To format numbers
- b) As an instance version of String.format()
- c) To normalize strings
- d) To optimize string storage
Answer: B - Allows string formatting directly on template strings.
142. Which is not a valid Java primitive wrapper class method?
- a) Integer.parseInt()
- b) Boolean.valueOf()
- c) Float.toHexString()
- d) Double.toDecimal()
Answer: D - There's no toDecimal() method in Double class.
143. What is the purpose of the 'ProcessBuilder' class?
- a) To build Java processes
- b) To manage OS processes
- c) To construct JVM arguments
- d) To optimize process creation
Answer: B - Creates and manages operating system processes.
144. Which is not a valid Java memory collector?
- a) Serial
- b) Parallel
- c) G1
- d) Zipper
Answer: D - There's no Zipper garbage collector (but there is ZGC).
145. What is the purpose of the 'StampedLock' class?
- a) To serialize file access
- b) To optimize read-heavy access
- c) To implement optimistic locking
- d) To replace synchronized blocks
Answer: C - Provides capability for optimistic reads (Java 8+).
146. Which is not a valid Java class file constant pool entry type?
- a) CONSTANT_Class
- b) CONSTANT_Field
- c) CONSTANT_Methodref
- d) CONSTANT_String
Answer: B - There's CONSTANT_Fieldref but not CONSTANT_Field.
147. What is the purpose of the 'MethodHandles' class?
- a) To reflect on methods
- b) To create method pointers
- c) To optimize method calls
- d) To implement callbacks
Answer: B - Provides low-level method handles (Java 7+).
148. Which is not a valid Java annotation target?
- a) TYPE
- b) FIELD
- c) EXECUTION
- d) PARAMETER
Answer: C - There's no EXECUTION target (but there is METHOD).
149. What is the purpose of the 'Lookup' class?
- a) To find files
- b) To access private members
- c) To implement search algorithms
- d) To optimize reflection
Answer: B - Provides controlled access to private members via MethodHandles.
150. Which is not a valid Java class file magic number?
- a) 0xCAFEBABE
- b) 0xFEEDFACE
- c) 0xBABECAFE
- d) 0xCAFED00D
Answer: C - Only 0xCAFEBABE is the valid magic number for Java class files.
151. What is the purpose of the 'VarHandle' class?
- a) To declare variables
- b) To provide atomic variable access
- c) To optimize variable storage
- d) To implement variable observers
Answer: B - Provides performant atomic operations on fields (Java 9+).
152. Which is not a valid Java class loader?
- a) Bootstrap
- b) Extension
- c) Application
- d) System
Answer: D - There's no System class loader (but there is Platform class loader in Java 9+).
153. What is the purpose of the 'StackWalker' class?
- a) To analyze stack traces
- b) To implement stack data structures
- c) To optimize method calls
- d) To monitor stack usage
Answer: A - Efficient stack trace analysis (Java 9+).
154. Which is not a valid Java bytecode instruction?
- a) aload
- b) istore
- c) fpush
- d) invokevirtual
Answer: C - There's no fpush instruction (but there is fconst_X for floats).
155. What is the purpose of the 'ConstantDynamic' (Java 11+)?
- a) To create dynamic constants
- b) To optimize final fields
- c) To implement constant pools
- d) To replace enum values
Answer: A - Allows bootstrap methods to create constants at runtime.
156. Which is not a valid Java module directive?
- a) opens
- b) exposes
- c) uses
- d) provides
Answer: B - There's no 'exposes' directive (but 'exports' exists).
157. What is the purpose of the 'Epsilon' garbage collector?
- a) To minimize GC pauses
- b) To handle memory leaks
- c) For performance testing
- d) To optimize small heaps
Answer: C - No-op GC for testing performance without GC interference.
158. Which is not a valid JVM option?
- a) -Xmx
- b) -Xss
- c) -Xcpu
- d) -Xlog
Answer: C - There's no -Xcpu option (but -XX:ActiveProcessorCount exists).
159. What is the purpose of the 'jpackage' tool (Java 16+)?
- a) To create native packages
- b) To analyze package dependencies
- c) To optimize JAR files
- d) To generate module graphs
Answer: A - Packages Java applications as native installers.
160. Which is not a valid Java flight recorder event type?
- a) jdk.CPULoad
- b) jdk.GCHeapSummary
- c) jdk.ThreadSleep
- d) jdk.FileWrite
Answer: D - There's no standard FileWrite event in JFR.