ArchitectMind
  1. Home
  2. Free Core Java interview question pack

Free Core Java interview question pack

100 new interview questions from Book 1, Core Java & Modern Java, with every answer explained. Free when you subscribe.

The pack is a sample of the ArchitectMind question bank: questions written for practice, separate from the questions in the tutorials. You choose one answer out of four, then check yourself against a full explanation.

  • 100new questions across all five volumes of Book 1
  • 5levels, from Basic to Solution Architect
  • 7question types: Concept, Internals, Code, Tricky, Scenario, Design and Trade-off
  • 30code questions. Every program was compiled and run to check its answer
  • 86pages (PDF): questions first, then the answer key, with a note on every option
Get the free pack

Enter your email below and confirm it. The download link arrives as soon as you confirm. You will also get new tutorials once a week, and you can unsubscribe at any time.

Cover of the ArchitectMind Core Java interview question packA question page with a code question and four optionsAn answer page with explanations for every option

Try one now

L3 · Senior EngineerInternalsVolume III · Topic 4.2 Intermediate Operations

What does this program print?

import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        StringBuilder log = new StringBuilder();
        String r = Stream.of("ab", "c", "de", "f")
            .filter(s -> {
                log.append("F" + s);
                return s.length() == 1;
            })
            .map(s -> {
                log.append("M" + s);
                return s.toUpperCase();
            })
            .findFirst()
            .orElse("-");
        System.out.println(log + " " + r);
    }
}
  1. AFabFcMc C
  2. BFabFcFdeFfMcMf C
  3. CFabFcFdeFfMc C
  4. DFabMabFcMc C
Show the answer

Answer A. It prints FabFcMc C. Stateless operations are fused, so each element travels through filter and map before the next element is pulled. ab fails the filter, c passes and is mapped, and findFirst then short-circuits, so de and f are never examined. This vertical, element-at-a-time execution is why putting cheap filters early and using short-circuiting terminals pays off. A stateful operation such as sorted would change this, because it must see every element first.

Who it is for

  • Java developers preparing for interviews who want to test themselves, not reread notes.
  • Senior engineers moving towards Technical or Solution Architect roles: about a third of the questions are scenario, design and trade-off questions.
  • Interviewers looking for fresh questions with clear reasoning behind each answer.

What comes next

The full Book 1 question bank will run as timed mock interviews on this site, with a score report by level and type. Subscribers hear about it first.

Free question pack

Get 100 free Core Java interview questions

Subscribe for the Book 1 question pack (PDF, every answer explained) and new tutorials once a week. No spam, unsubscribe anytime. What is in the pack?

Almost done! Check your inbox and click the confirmation link. Your download link arrives as soon as you confirm.