Core & Advanced Java Programming (Java 21 LTS) Online Mock Test (Free 50-MCQ Topic Practice)
Select any course and syllabus topic below to launch a timed topic MCQ engineering exam (up to 2 free attempts per topic daily) with instant code-level explanations.
Timed code-output & architecture MCQs with instant scorecard. Want spoken viva practice too?
Select Any IT Course (21 Courses • 100% Topics Covered)
Core & Advanced Java Programming (Java 21 LTS) — Topic-Wise Mock Tests
Expand any module below to start a live timed MCQ exam across 116 Mock Test sets (max 2 free attempts per topic per day).
All Modules & Topics in Core & Advanced Java Programming (Java 21 LTS)
Introduction to Java
History, features, platform independence, enterprise applications, and the modern Java 21 LTS ecosystem
Java Architecture (JDK, JRE and JVM)
JDK, JRE, JVM components, Write Once Run Anywhere (WORA), bytecode verifier, and runtime execution flow
Java Installation and Environment Setup
JDK 21 LTS installation, JAVA_HOME configuration, OS PATH setup, IntelliJ IDEA & Maven workspace verification
First Java Program
Class declaration, public static void main(String[] args) signature, System.out printing, CLI arguments, compi...
Java Compilation and Bytecode Execution
Source code (.java), javac compiler checks, bytecode (.class), class loader verification, interpreter and JIT...
Variables in Java
Local variables, instance fields, static class variables, variable scope, lifetime, and definite assignment ru...
Data Types in Java
8 primitive types (byte, short, int, long, float, double, char, boolean), memory sizes, ranges, literals, and...
Type Conversion and Casting
Implicit widening conversion, explicit narrowing cast, numeric promotion in expressions, truncation, and overf...
Operators in Java
Arithmetic, relational, short-circuit logical, assignment, unary increment/decrement, bitwise, shift, and tern...
User Input (Scanner and BufferedReader)
java.util.Scanner token parsing, newline buffer pitfalls, InputStreamReader + BufferedReader fast line reading...
Comments and Javadoc Documentation
Single-line (//), multi-line (/* */), Javadoc (/** */) tags (@param, @return, @throws), and avoiding noisy red...
Java Coding Conventions and Clean Code Basics
PascalCase classes, camelCase methods/variables, UPPER_SNAKE_CASE constants, package naming, indentation, and...
Week 1 Git Setup and Daily Commit Discipline
Initializing local Git repo, configuring user.name/user.email, .gitignore for Java/Maven/IntelliJ, staging, co...
Conditional Statements
if, if-else, nested if, else-if ladder, guard clauses, and boolean expression simplification
Switch Statements and Switch Expressions
Traditional switch-case fallthrough vs modern Java 14–21 arrow switch expressions (`->`), `yield`, and exhaust...
Loops (for, while, do-while)
Deterministic `for` loops, condition-driven `while` loops, menu-driven `do-while` loops, and infinite-loop pre...
Loop Control (break, continue and Nested Loops)
Early exit with `break`, skipping iterations with `continue`, labeled breaks, and nested loop complexity aware...
Patterns (Star, Number and Character Patterns)
Row-column coordinate mapping, pyramid/diamond star patterns, Floyd’s number triangle, and character matrices
Arrays Introduction, Declaration and Initialization
Contiguous heap allocation, zero/default initialization, `.length` property, static vs dynamic array literals,...
Array Operations (Traversal, Insertion, Deletion and Searching)
Forward/backward traversal, shifting elements for insertion and deletion, linear search, and in-place reversal
One-Dimensional Arrays Manipulation
Finding second-largest element, counting frequencies, finding duplicates, removing duplicates from sorted arra...
Multidimensional Arrays
2D rectangular arrays, jagged arrays (arrays of arrays), row-major memory layout, and nested traversal
Matrix Operations (Addition, Subtraction, Transpose and Multiplication)
Dimension compatibility validation, matrix addition/subtraction, in-place/out-of-place transpose, and `O(m*n*p...
Enhanced For Loop (For-Each)
Read-only iteration syntax, readability advantages, when index-based `for` is required instead, and nested for...
Array Utilities (java.util.Arrays)
Arrays.sort, Arrays.binarySearch, Arrays.copyOf, Arrays.copyOfRange, Arrays.fill, Arrays.equals, Arrays.deepTo...
Class and Object
Class blueprint definition, heap object instantiation with `new`, stack object references, null references, an...
Methods in Java
Method signatures, parameter passing (pass-by-value of primitives and object references), return types, vararg...
Constructors and Constructor Overloading
Default compiler constructor, parameterized constructors, constructor overloading, and invariant validation du...
this Keyword
Disambiguating shadowed fields, constructor chaining via `this(...)`, and passing/returning current instance i...
static Keyword
Static fields, static utility methods, static initialization blocks, class-level memory in Metaspace/Heap, and...
Encapsulation
Private state, controlled getters/setters, invariant enforcement, defensive copying, and telling objects what...
Inheritance
IS-A relationship, `extends`, single, multilevel, and hierarchical inheritance, protected visibility, and why...
super Keyword
Invoking parent constructors via `super(...)`, calling overridden parent methods via `super.method()`, and con...
Method Overloading (Compile-Time Polymorphism)
Same method name with distinct parameter lists (arity, types, order), type promotion rules, and ambiguity erro...
Method Overriding (Runtime Polymorphism)
@Override annotation, covariant return types, access-level & checked-exception rules, and dynamic dispatch on...
Polymorphism (Static vs Dynamic Binding)
Early binding (private, static, final methods and fields) vs late virtual method invocation, upcasting, and sa...
Abstraction and Abstract Classes
Abstract classes, abstract vs concrete template methods, protected constructors, and partial implementation sh...
Interfaces and Multiple Interface Implementation
Pure capability contracts, `implements`, multiple interface inheritance, loose coupling, and programming to in...
Modern Interface Features (Default, Static and Private Methods)
Java 8+ `default` methods for backward-compatible evolution, `static` factory methods on interfaces, `private`...
final Keyword (Variables, Methods and Classes)
Blank final fields, immutable value objects, preventing method overriding (`final` methods), and non-extensibl...
Object Class (toString, equals, hashCode and getClass)
java.lang.Object root methods, readable `toString()`, reflexive/symmetric/transitive `equals()`, `Objects.hash...
String Immutability and String Pool
String literal interning in Heap String Pool vs `new String()`, immutability benefits (security, caching, thre...
String Comparison (==, equals, equalsIgnoreCase, compareTo)
Reference identity (`==`) vs content equality (`equals`), null-safe constant-first comparisons, `equalsIgnoreC...
String Methods
length, isBlank, strip, charAt, substring, indexOf, contains, replace, split, String.join, formatted
StringBuilder
Mutable character buffer, capacity growth (`old * 2 + 2`), append, insert, delete, reverse, and single-threade...
StringBuffer
Synchronized thread-safe mutable strings, comparison with StringBuilder and String, and legacy API interoperab...
Wrapper Classes
Byte, Short, Integer, Long, Float, Double, Character, Boolean, parsing methods (`parseInt`, `valueOf`), and In...
Autoboxing and Unboxing
Automatic compiler conversion between primitives and wrappers, hidden `NullPointerException` on unboxing, and...
Exception Handling Hierarchy
Throwable -> Error (OutOfMemoryError, StackOverflowError) vs Exception (Checked vs RuntimeException), call-sta...
try-catch Blocks
Specific-to-general catch ordering, multi-catch (`catch (IOException | NumberFormatException e)`), preserving...
finally Block and Resource Cleanup
Guaranteed execution of `finally`, `try-with-resources` (`AutoCloseable`), suppressed exceptions, and why `ret...
throw and throws
Explicitly throwing exceptions with `throw`, declaring checked propagation via `throws`, and exception chainin...
Custom Exceptions
Designing domain-specific exceptions (`StudentNotFoundException`, `DuplicateRollNumberException`), error codes...
Checked Exceptions
Compile-time enforced recovery (`IOException`, `SQLException`, `ParseException`), handle-or-declare rule, and...
Unchecked Exceptions
RuntimeException subclasses (`NullPointerException`, `IllegalArgumentException`, `IllegalStateException`, `Ind...
Java Assertions
`assert condition : message;` syntax, enabling assertions via `-ea` JVM flag, and why assertions never replace...
Packages in Java
Reverse-domain naming (`com.mockattempt.student.*`), directory mapping, `import` vs wildcard imports, and laye...
Access Modifiers (public, protected, default, private)
Class-level vs member-level visibility matrix across same class, same package, subclass in another package, an...
Enums in Java
Type-safe constants, enum constructors, fields, methods, `values()`, `valueOf()`, and exhaustive switch expres...
Collections Introduction and Architecture
Iterable -> Collection hierarchy (List, Set, Queue/Deque) and separate Map hierarchy, utility methods in java....
List Interface
Ordered indexed sequence contract, positional access, duplicate allowance, `List.of`, `subList` view semantics
ArrayList
Dynamic `Object[]` backing array, default capacity (10), 1.5x growth resizing, `O(1)` random access, `O(n)` mi...
LinkedList
Doubly-linked `Node<E>` (`prev`, `item`, `next`) structure, `O(1)` head/tail operations, `O(n)` indexed traver...
Vector
Legacy synchronized dynamic array, 2x capacity growth, method-level lock overhead, and modern alternatives (`A...
Stack
LIFO (Last-In-First-Out) push, pop, peek operations, why `java.util.Stack` extends `Vector`, and why `Deque`/`...
Queue Interface
FIFO (First-In-First-Out) processing contract: `offer` vs `add`, `poll` vs `remove`, `peek` vs `element`
PriorityQueue
Binary heap internal array, natural min-heap ordering vs custom `Comparator` max-heap, `O(log n)` offer/poll,...
Deque and ArrayDeque
Double-ended queue (`offerFirst`, `offerLast`, `pollFirst`, `pollLast`), circular resizable array internals, n...
Set Interface
Mathematical uniqueness contract, `Set.of` immutable sets, set union (`addAll`), intersection (`retainAll`), a...
HashSet
Backed internally by `HashMap<E, Object>` (`PRESENT` dummy value), `O(1)` average add/contains/remove, unorder...
LinkedHashSet
Hash table + doubly-linked list across entries, preserving predictable insertion order with `O(1)` lookup perf...
TreeSet
Backed by `TreeMap` (Red-Black self-balancing BST), `O(log n)` operations, `NavigableSet` range queries (`head...
Map Interface
Key-value associations, `put`, `getOrDefault`, `putIfAbsent`, `computeIfAbsent`, `merge`, `keySet`, `values`,...
HashMap Internals
Node<K,V>[] table, hash spreading `(h = key.hashCode()) ^ (h >>> 16)`, index `(n - 1) & hash`, collisions, tre...
LinkedHashMap
Insertion-order vs access-order (`accessOrder = true`) doubly-linked entries and overriding `removeEldestEntry...
TreeMap
Red-Black tree sorted keys, `O(log n)` get/put, `NavigableMap` (`firstEntry`, `lastEntry`, `floorEntry`, `subM...
Hashtable
Legacy synchronized dictionary, no null keys or null values, coarse object-wide locking vs `ConcurrentHashMap`
Iterator and Fail-Fast Behaviour
`hasNext()`, `next()`, safe `iterator.remove()`, `modCount` tracking, and avoiding `ConcurrentModificationExce...
ListIterator
Bidirectional traversal (`hasPrevious`, `previous`), index inspection (`nextIndex`), in-place `set(e)` replace...
Comparable (Natural Ordering)
`Comparable<T>` interface, `compareTo(T other)` contract (sign symmetry, transitivity), and `Integer.compare`...
Comparator (Custom Multi-Field Sorting)
`Comparator.comparing`, `comparingDouble`, `reversed()`, `thenComparing`, `nullsLast`, and decoupling sort pol...
equals and hashCode Contract in Collections
Why equal objects MUST produce identical hash codes, hash collision handling via `equals`, immutable key field...
Generics (Classes, Interfaces and Methods)
Compile-time type safety, type parameters (`<T, R>`), generic `ApiResponse<T>` wrappers, type erasure at runti...
Bounded Generics
Upper bounds (`<T extends Number & Comparable<T>>`), restricting type parameters to domain capabilities
Wildcards (?, extends and super — PECS)
Unbounded `?`, covariance `? extends T` (Producer Extends), contravariance `? super T` (Consumer Super), and i...
Lambda Expressions
`@FunctionalInterface`, concise `(params) -> expression` syntax, target typing, and effectively final variable...
Core Functional Interfaces (Predicate, Function, Consumer, Supplier)
`java.util.function` contracts: `test(T)`, `apply(T)`, `accept(T)`, `get()`, and composition (`and`, `or`, `ne...
Bi-Arity Functional Interfaces (BiPredicate, BiFunction, BiConsumer)
Two-argument functional contracts (`BiPredicate`, `BiFunction`, `BiConsumer`, `BinaryOperator`) and `Map.forEa...
Method References
Static (`Integer::parseInt`), bound instance (`logger::info`), unbound instance (`String::toLowerCase`), and c...
Stream API Architecture and Creation
`collection.stream()`, `Stream.of`, `Arrays.stream`, `IntStream.rangeClosed`, lazy evaluation, non-mutating so...
Stream Intermediate Operations
`filter`, `map`, `mapToDouble`, `flatMap`, `sorted`, `distinct`, `limit`, `skip`, and `peek`
Stream Terminal Operations
`toList()`, `collect`, `reduce`, `count`, `min`, `max`, `findFirst`, `anyMatch`, `allMatch`, `noneMatch`, `for...
Collectors (groupingBy, partitioningBy, joining, mapping)
`Collectors.toMap` (with merge function!), `groupingBy` + downstream `counting`/`averagingDouble`/`mapping`, `...
Optional for Null-Safe Return Contracts
`Optional.of`, `Optional.ofNullable`, `Optional.empty`, `map`, `flatMap`, `filter`, `orElse`, `orElseGet`, `or...
Date and Time API (java.time)
Immutable `LocalDate`, `LocalTime`, `LocalDateTime`, `Instant`, `ZonedDateTime`, `Duration`, `Period`, and `Da...
Interface Default and Static Enhancements
Evolving functional and domain interfaces with `default` combinators and `static` factories without breaking l...
Modern Java 17/21 Features (Records, Sealed Classes, Text Blocks, Pattern Matching)
Immutable `record` DTOs & compact constructors, `sealed` class hierarchies (`permits`), multi-line SQL/JSON te...
File I/O and NIO.2 (Path, Files and Streams)
`java.nio.file.Path`, `Files.readString`, `Files.writeString`, `Files.lines` (try-with-resources!), buffered r...
JVM Architecture Overview
ClassLoader subsystem, Runtime Data Areas, Execution Engine (Interpreter + JIT + GC), Native Method Interface...
Class Loading Subsystem
Bootstrap, Platform, and Application ClassLoaders, Parents-Delegation model, Loading -> Linking (Verify, Prepa...
JVM Memory Management (Heap, Stack and Metaspace)
Young Gen (Eden, Survivor S0/S1), Old Gen, per-thread JVM Stacks & frames, Native Metaspace, StackOverflowErro...
Garbage Collection Fundamentals
Reachability analysis from GC Roots, Mark-Sweep-Compact, Minor vs Major/Mixed GC, Stop-The-World pauses, G1GC...
JIT Compiler (Just-In-Time Compilation)
HotSpot profiling, C1 (client/fast compile) & C2 (tiered server optimization), method inlining, escape analysi...
Thread Fundamentals (Process vs Thread)
OS Process isolation vs lightweight shared-heap threads, context switching, concurrency vs parallelism, Java 2...
Thread Creation (Thread Class and Runnable Interface)
Implementing `Runnable` (preferred composition) vs extending `Thread`, passing lambdas to `new Thread(...)`, a...
Thread Lifecycle States
`Thread.State` enum: `NEW`, `RUNNABLE`, `BLOCKED`, `WAITING`, `TIMED_WAITING`, and `TERMINATED` state transiti...
Thread Methods (start, run, sleep, join, interrupt)
Coordinating completion with `join()`, cooperative cancellation via `interrupt()` & `isInterrupted()`, and res...
Synchronization (synchronized Methods and Blocks)
Intrinsic monitor locks, mutual exclusion + happens-before memory visibility, narrow `synchronized (lock)` blo...
Race Conditions and Shared Mutable State
Check-then-act (`if (!contains) put`) and read-modify-write (`count++`) hazards, stateless service design in S...
Deadlocks (Causes and Prevention)
Coffman conditions, circular lock acquisition (`Thread 1: A->B` vs `Thread 2: B->A`), consistent global lock o...
volatile Keyword and Memory Visibility
CPU cache coherence, Java Memory Model happens-before guarantee, when `volatile` suffices (single-writer boole...
Atomic Classes (AtomicInteger, AtomicLong, LongAdder)
Lock-free Compare-And-Swap (CAS) hardware instructions, `incrementAndGet`, `compareAndSet`, `AtomicReference`,...
ExecutorService and Thread Pools
Fixed, cached, scheduled, and custom `ThreadPoolExecutor` (corePoolSize, maxPoolSize, bounded workQueue, rejec...
Callable and Future
`Callable<V>` returning typed results & throwing checked exceptions, `Future.get(timeout, unit)`, `invokeAll`,...
CompletableFuture (Asynchronous Programming)
`supplyAsync`, `thenApply`, `thenCompose`, `thenCombine`, `allOf`, `orTimeout`, and `exceptionally` non-blocki...
Concurrent Collections (ConcurrentHashMap and BlockingQueue)
Fine-grained bucket/CAS concurrency in `ConcurrentHashMap`, atomic `computeIfAbsent`, and bounded `ArrayBlocki...
Want Unlimited JAVA Mock Exams + Weekend Live Mentorship With Working IT Pros?
Train live on weekends with active Working IT Professionals • All-Inclusive Fee: $21 USD All-Incl. (Includes 30-Day 100% Upgrade Credit)
Frequently Asked Questions — Topic-Wise Mock Tests
Are Core & Advanced Java Topic Mock Tests free on MockAttempt Tech Academy?
Yes! Visitors can attempt up to 2 free timed 50-MCQ Core & Advanced Java Programming (Java 21 LTS) Mock Tests per topic daily across 116 topics with instant answers. Enrolled live-batch students (₹1,999 All-Inclusive) unlock unlimited daily attempts.
Can I also practice Spoken AI Interviews for Core & Advanced Java?
Yes — every Core & Advanced Java Programming (Java 21 LTS) topic also includes up to 2 free daily Spoken MockAttempt AI Technical Interviews (https://mockattempt.com/ai-interviews/course/core-java-training) with 4-axis voice evaluation.