HomeCode HereJava final quiz Java final quiz Admin 1 min read Updated November 16, 2026 Ten mixed questions covering the whole Java track, from compilation to the capstone. Java Java final quiz 10 questions, instant feedback Question 1 of 10 What does the JVM provide that makes Java portable? A A compiler per platform B Bytecode executed by a platform-specific runtime C Source-level translation D A shared library javac produces bytecode; each platform's JVM executes it, so the same class file runs everywhere a JVM exists. Question 2 of 10 What is the value of 10 % 3? A 3 B 1 C 0 D 3.33 The remainder operator returns what is left after division: 10 = 3 * 3 + 1. Question 3 of 10 Which loop guarantees the body runs at least once? A for B while C do-while D enhanced for do-while checks its condition after the body, so the first pass always happens. Question 4 of 10 What is the difference between == and equals for objects? A They are the same B == compares references, equals compares content when overridden C equals compares references D == only works on numbers == asks whether two variables point at the same object. equals is a method that classes override to compare state. Question 5 of 10 Which statement about interfaces is correct? A A class can implement several B An interface can have instance fields C An interface cannot have methods D A class can extend several A class implements any number of interfaces but extends only one class. Question 6 of 10 What happens when an array index is out of bounds? A It returns null B ArrayIndexOutOfBoundsException C It grows the array D It wraps around Java checks bounds at runtime and throws, rather than reading adjacent memory. Question 7 of 10 Why override hashCode with equals? A For performance only B Hash-based collections rely on equal objects having equal hash codes C The compiler requires it D To sort objects HashMap looks up by hash first. Equal objects with different hashes can be stored twice and never found. Question 8 of 10 What does a JUnit @Test method need? A A main method B To be public, non-static and return void in JUnit 4 C A return value D To extend TestCase always JUnit 4 requires public void methods. JUnit 5 relaxes the visibility to package-private. Question 9 of 10 What is a stream in Java? A A file handle B A pipeline of operations over a data source C A thread D A collection Streams describe a sequence of operations such as filter and map, evaluated when a terminal operation runs. Question 10 of 10 Which is the better reason to use Maven or Gradle? A It compiles Java B It manages dependencies and a repeatable build C It replaces the JVM D It writes code javac compiles. A build tool resolves libraries, runs tests and produces a reproducible artefact. Check my answers Try again Your answers stay in this browser. Nothing is sent to a server. More quizzes Java getting started quiz Coming soon Java control flow quiz 9 questions Java methods and objects quiz 9 questions All quizzes