| 1 | What is the Java Collections Framework, and what are the core interfaces (List, Set, Map, Queue) at its foundation? Java › Collections Framework | Java | Collections Framework | Beginner |
| 2 | What is the difference between fail-fast and fail-safe iterators in the Collections Framework, and which collections use each? Java › Collections Framework | Java | Collections Framework | Intermediate |
| 3 | How does the Collections Framework's fail-fast modCount mechanism actually work internally, and why is it described as "best-effort" rather than a strict guarantee? Java › Collections Framework | Java | Collections Framework | Advanced |
| 4 | What are the immutable collection factory methods (List.of(), Set.of(), Map.of()) introduced in Java 9, and how do they differ from Collections.unmodifiableList()? Java › Collections Framework | Java | Collections Framework | Intermediate |
| 5 | What is the purpose of the Collections utility class's synchronization wrappers (Collections.synchronizedList(), etc.), and how do they differ from genuinely concurrent collections like ConcurrentHashMap? Java › Collections Framework | Java | Collections Framework | Intermediate |
| 6 | What is the difference between the Iterable and Iterator interfaces, and how does the enhanced for-each loop rely on them? Java › Collections Framework | Java | Collections Framework | Beginner |
| 7 | What are the key performance differences between ArrayList and LinkedList for common operations (random access, insertion/removal at various positions), and when would you choose one over the other? Java › Collections Framework | Java | Collections Framework | Intermediate |
| 8 | What is the contract between equals() and hashCode() that a custom class must satisfy to work correctly as a HashMap key or HashSet element? Java › Collections Framework | Java | Collections Framework | Intermediate |
| 9 | What is the purpose of the Deque interface, and how does it unify both stack (LIFO) and queue (FIFO) behavior in a single interface? Java › Collections Framework | Java | Collections Framework | Intermediate |
| 10 | How does PriorityQueue work internally (as a binary heap), and what ordering does it use by default versus with a custom Comparator? Java › Collections Framework | Java | Collections Framework | Intermediate |
| 11 | How does HashMap's internal implementation work (hashing, bucket array, treeification), and how did its collision-handling strategy change in Java 8? Java › Collections Framework | Java | Collections Framework | Advanced |
| 12 | How do you choose between HashMap, LinkedHashMap, and TreeMap based on their different ordering guarantees and performance characteristics? Java › Collections Framework | Java | Collections Framework | Advanced |
| 13 | How does TreeMap/TreeSet's red-black tree implementation guarantee O(log n) operations, and what role does the Comparable/Comparator interface play in maintaining sorted order? Java › Collections Framework | Java | Collections Framework | Advanced |
| 14 | How would you implement a custom Comparator with multiple sort criteria (e.g., sort by last name, then by first name as a tiebreaker) using the Comparator.comparing() and thenComparing() fluent API? Java › Collections Framework | Java | Collections Framework | Advanced |
| 15 | How would you choose the correct initial capacity for a HashMap to avoid unnecessary resizing overhead, given the relationship between capacity, load factor, and resize threshold? Java › Collections Framework | Java | Collections Framework | Advanced |
| 16 | How do you declare, initialize, and access elements of a one-dimensional array in Java? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Beginner |
| 17 | How do you retrieve all constants of an enum type, and how would you iterate over them? Java › Enums | Java | Enums | Beginner |
| 18 | What is the default behavior of equals() and hashCode() inherited from Object, and why is it usually necessary to override them for value-based classes? Java › equals(), hashCode() & toString() Contracts | Java | equals(), hashCode() & toString() Contracts | Beginner |
| 19 | What is the recommended way to combine multiple field values into a single hashCode() implementation, following the common formula used by IDE-generated code? Java › equals(), hashCode() & toString() Contracts | Java | equals(), hashCode() & toString() Contracts | Beginner |
| 20 | What does it mean for an object to be 'eligible for garbage collection' in terms of reachability from GC roots? Java › Garbage Collection | Java | Garbage Collection | Beginner |
| 21 | What problem do generics solve compared to using raw types (like a pre-Java-5 List without a type parameter), and how do they improve compile-time type safety? Java › Generics | Java | Generics | Beginner |
| 22 | What utility methods does java.util.Arrays provide for common array operations like sorting, searching, filling, and comparing? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Intermediate |
| 23 | How do you convert between an array and a List (ArrayList) in both directions, and what pitfalls exist with Arrays.asList()? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Intermediate |
| 24 | What is array covariance's relationship to generic arrays, and why can't you directly create a generic array like new T[10] or new List<String>[10]? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Intermediate |
| 25 | How would you flatten a 2D array into a 1D array, and conversely, reshape a 1D array into a 2D array? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Intermediate |
| 26 | How does the EnumSet and EnumMap provide more efficient alternatives to HashSet<Enum> and HashMap<Enum, V> specifically for enum keys? Java › Enums | Java | Enums | Intermediate |
| 27 | What are the five formal properties an equals() implementation must satisfy according to its documented contract (reflexive, symmetric, transitive, consistent, and null-handling)? Java › equals(), hashCode() & toString() Contracts | Java | equals(), hashCode() & toString() Contracts | Intermediate |
| 28 | How does Comparable's compareTo() method relate to equals(), and what does it mean for compareTo() to be 'consistent with equals'? Java › equals(), hashCode() & toString() Contracts | Java | equals(), hashCode() & toString() Contracts | Intermediate |
| 29 | What is the difference between a Consumer<T> and a BiConsumer<T,U>, and how would you use BiConsumer for operations needing two inputs but no return value, such as Map.forEach()? Java › Functional Interfaces & Method References | Java | Functional Interfaces & Method References | Intermediate |
| 30 | What is an unbounded wildcard (List<?>), and when is it more appropriate to use than a bounded generic method with a type parameter <T>? Java › Generics | Java | Generics | Intermediate |
| 31 | How would you implement a generic Stack<T> class from scratch, demonstrating how a self-contained generic data structure is typically structured? Java › Generics | Java | Generics | Intermediate |
| 32 | What is a raw type in Java, and why does the compiler still permit using them (with an unchecked warning) despite generics having been available since Java 5? Java › Generics | Java | Generics | Intermediate |
| 33 | What is the difference between the == operator and the .equals() method when comparing String objects, and why does String's string pool (interning) behavior sometimes make == appear to 'work' for strings? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Intermediate |
| 34 | What are generics in C#, and what specific problems do they solve compared to writing type-specific code? C# › Generics | C# | Generics | Intermediate |
| 35 | How would you implement a custom, resizable dynamic array (similar to ArrayList's internal mechanism) from scratch using a raw Java array, including the amortized doubling growth strategy? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Advanced |
| 36 | How would you implement a memory-efficient sparse matrix representation in Java when a large 2D array would mostly contain zero/default values, avoiding the memory waste of a full dense array? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Advanced |
| 37 | How would you implement a custom compareTo()-based ordering for an enum that differs from its natural declaration-order ordering, given Comparable's default implementation uses ordinal()? Java › Enums | Java | Enums | Advanced |
| 38 | Why must hashCode() be overridden whenever equals() is overridden, and what specific, hard-to-diagnose bugs occur in a HashMap when this contract is violated (equals() overridden but hashCode() left as default)? Java › equals(), hashCode() & toString() Contracts | Java | equals(), hashCode() & toString() Contracts | Advanced |
| 39 | How does Java Record's automatically-generated equals(), hashCode(), and toString() implementations work, and in what specific ways do they differ from a manually-written, field-by-field implementation? Java › equals(), hashCode() & toString() Contracts | Java | equals(), hashCode() & toString() Contracts | Advanced |
| 40 | How would you implement equals()/hashCode() correctly for a class containing a mutable field, and why does using such a class as a HashMap key or HashSet element create a serious risk? Java › equals(), hashCode() & toString() Contracts | Java | equals(), hashCode() & toString() Contracts | Advanced |
| 41 | How would you use BiFunction combined with Stream's reduce() to implement a custom aggregation, and how does this relate to the more general concept of a fold operation in functional programming? Java › Functional Interfaces & Method References | Java | Functional Interfaces & Method References | Advanced |
| 42 | How do bounded wildcards (? extends T and ? super T) work, and what does the PECS (Producer Extends, Consumer Super) mnemonic mean for choosing between them? Java › Generics | Java | Generics | Advanced |
| 43 | How would you implement a generic class with multiple type parameters and bounded type parameters (like <T extends Comparable<T>>), and what does this specific bound enable? Java › Generics | Java | Generics | Advanced |
| 44 | How do generics interact with arrays, and why does the JDK itself sometimes use an unsafe cast (like in ArrayList's internal implementation) to work around the inability to create generic arrays directly? Java › Generics | Java | Generics | Advanced |
| 45 | How does variance (covariance, contravariance, invariance) apply differently to Java arrays versus Java generics, and what practical safety trade-off does this design difference represent? Java › Generics | Java | Generics | Advanced |
| 46 | How would you implement the classic Iterator design pattern using a private non-static inner class, letting the inner Iterator implementation access the outer collection's private internal state directly? Java › Inner Classes & Anonymous Classes | Java | Inner Classes & Anonymous Classes | Advanced |