CoreHRx Jobs

Apply in one click, save jobs and take free mock tests.

Register free Log in
Hiring? Post jobs with CoreHRx
My account
user

View & update profile

Java and Spring Boot mock test: free online practice

30 random questions, 30 minutes, at the level you choose: core java, collections, concurrency, spring boot and jpa. After you submit you get your score, your strong and weak topics, and the right answer with an explanation for every question.

Want to revise first? Read the Java and Spring Boot interview questions and answers.

Choose your experience

Free with a CoreHRx Jobs account: you will be asked to sign in or create one first.

What does the Java and Spring Boot mock test cover?

The test draws on 300 Java and Spring Boot questions in 12 topics, across three levels. Each attempt picks 30 of them at random for the level you choose.

  • Collections25 Qs
  • Concurrency25 Qs
  • Core Java25 Qs
  • JPA25 Qs
  • JVM25 Qs
  • Microservices25 Qs
  • OOP25 Qs
  • REST APIs25 Qs
  • Security25 Qs
  • Spring Boot25 Qs
  • Spring Core25 Qs
  • Streams25 Qs

Sample Java and Spring Boot mock test questions

One question from each level, the way they appear in the test. Try it, then open the answer.

  1. FresherCore Java

    What does this code print?

    String a = "hi";
    String b = "h" + "i";
    String c = new String("hi");
    System.out.println((a == b) + " " + (a == c) + " " + a.equals(c));
    • true true true
    • true false true
    • false false true
    • false false false
    Show the answer

    Answer: true false true. "h" + "i" is a compile-time constant, so it is interned and shares the literal "hi" from the string pool. new String("hi") always creates a separate heap object, so == is false while equals() compares the characters and returns true.

  2. Intermediate (1-5 years)OOP

    What does show(5) print?

    static void show(long x)    { System.out.println("long"); }
    static void show(Integer x) { System.out.println("Integer"); }
    static void show(Object x)  { System.out.println("Object"); }
    • Object
    • Compilation error: the call is ambiguous
    • long
    • Integer
    Show the answer

    Answer: long. Overload resolution first tries methods that need no boxing. Widening the int 5 to long is allowed in that phase, so show(long) wins before boxing to Integer or Object is even considered. This ordering can surprise you when APIs overload on both primitive and wrapper types.

  3. Experienced (5+ years)Collections

    A unit test asserts that map.toString() equals "{a=1, b=2}" for a HashMap, and it starts failing after a JDK upgrade. What is the right fix?

    • Sort the string output alphabetically before comparing it in the test
    • Compare maps with equals(), or use a LinkedHashMap if the order is part of the contract
    • Pin the old JDK version for the test module so that the hash order stays the same
    • Add a sleep before the assertion so that the map can finish reordering
    Show the answer

    Answer: Compare maps with equals(), or use a LinkedHashMap if the order is part of the contract. HashMap promises no iteration order, and it can change with capacity, hash function or JDK version. Tests that depend on it are flaky by design. Assert on content with map equality, or switch to LinkedHashMap or TreeMap where order is truly required by the feature.

Take the full Java and Spring Boot mock test: 30 questions, 30 minutes.

How is the Java and Spring Boot mock test scored?

A question counts as right only when you pick exactly the right option, or all the right options where it says so; a question left blank counts as wrong. Your score is the share of the 30 questions you got right. The result also scores every topic, so you know what to revise before the interview.

  • 75% or more in a topica strength
  • 50% to 74%worth a revision
  • Under 50%a topic to work on

Java and Spring Boot mock test: questions people ask

Is the Java and Spring Boot mock test free?

Yes. The Java and Spring Boot mock test is free. You need a free CoreHRx Jobs account to start it, so your score and the topics to work on are saved.

How many questions are in the Java and Spring Boot mock test?

Each test has 30 multiple-choice questions to answer in 30 minutes, picked at random from 300 Java and Spring Boot questions across three levels, so every attempt is different.

Which Java and Spring Boot topics does the test cover?

The questions cover Collections, Concurrency, Core Java, JPA, JVM, Microservices, OOP, REST APIs, Security, Spring Boot, Spring Core, Streams. Your result shows how you did in each topic.

Which level should I choose?

Fresher if you are a student or have less than a year of experience, Intermediate for 1 to 5 years at work, and Experienced for 5 years or more.

Can employers see my Java and Spring Boot score?

Only your best Java and Spring Boot score, and only when it is 60% or more. It shows on the job applications you send on CoreHRx. Lower scores stay private.

Can I take the Java and Spring Boot mock test again?

Yes, up to 10 tests a day. Each attempt picks questions you have not seen recently first.

All mock tests