Java Backend Screening Test – Set 9

Kubernetes | Docker | Spring Boot | Observability | SQL | Programming

Duration: 20 Minutes

Experience: 5–10 Years

This assessment evaluates practical Kubernetes, Docker, Spring Boot production deployment, observability, configuration management, health checks, SQL, and Java 8 programming concepts commonly used in cloud-native backend applications.


Section A – Kubernetes & Docker MCQs (5 Questions)


Question 1 – Kubernetes Self-Healing

A Spring Boot application is deployed with 3 replicas in Kubernetes. One pod crashes because of an OutOfMemoryError.

What happens?

A. Kubernetes permanently removes the application.

B. Kubernetes automatically creates a replacement pod to maintain the desired replica count.

C. All remaining pods are restarted.

D. Traffic is routed only to the failed pod.


Question 2 – ConfigMap vs Secret

Which Kubernetes resource should be used to store a database password?

A. ConfigMap

B. Secret

C. Deployment

D. Service


Question 3 – Readiness Probe

What is the primary purpose of a Readiness Probe?

A. Restart the application if it crashes.

B. Determine whether a pod is ready to receive traffic.

C. Monitor CPU utilization.

D. Scale pods automatically.


Question 4 – Docker Layers

Which statement about Docker images is TRUE?

A. Every container shares the image’s read-only layers and has its own writable layer.

B. Every container creates a completely new image.

C. Docker images cannot contain multiple layers.

D. Docker containers cannot share image layers.


Question 5 – Spring Boot Actuator

Which endpoint is commonly used by Kubernetes for liveness and readiness checks?

A.

/api/status

B.

/actuator/health

C.

/metrics

D.

/status

Section B – SQL Challenge

Question 6

Tables

ORDERS

ORDER_IDCUSTOMER_IDSTATUS
1011SUCCESS
1021FAILED
1032SUCCESS
1042SUCCESS
1053FAILED

Query

SELECT STATUS,
       COUNT(*)
FROM ORDERS
GROUP BY STATUS;

What is the correct output?

A.

SUCCESS 3

FAILED 2

B.

SUCCESS 2

FAILED 3

C.

SUCCESS 5

D.

Compilation Error


Section C – Programming Questions


Question 7 – Top 3 Highest Numbers

Given

List<Integer> list =
Arrays.asList(4,8,2,10,7,9,10,8,6);

Using Java 8 Streams:

  • Remove duplicates.
  • Print the top 3 highest numbers.

Expected Output

10

9

8

Question 8 – Employee Salary Statistics

Given

class Employee{

    private String department;

    private int salary;

}

Using Java 8 Streams, calculate:

  • Minimum salary per department
  • Maximum salary per department
  • Average salary per department

Question 9 – First Repeating Word

Write a Java program to find the first repeating word in a sentence.

Example

Java Spring Boot Java Microservices Spring

Expected Output

Java

Bonus:

Provide both a traditional solution and a Java 8 Streams solution.


Answer Key & Detailed Explanations


Question 1

Correct Answer: B

Explanation

Kubernetes continuously compares the desired state with the actual state.

If the Deployment specifies:

Replicas = 3

and one pod crashes, Kubernetes automatically schedules a replacement pod to restore the replica count.

This is known as self-healing.

Interview Follow-up

  • Which Kubernetes controller manages replica count?
  • Difference between a Deployment and a ReplicaSet?

(Expected answer: Deployment manages ReplicaSets, and ReplicaSets maintain the desired number of Pods.)


Question 2

Correct Answer: B

Explanation

Sensitive information such as:

  • Database passwords
  • API keys
  • OAuth tokens
  • Certificates

should be stored in Secrets.

Configuration values that are not sensitive (URLs, feature flags, application settings) belong in ConfigMaps.


Question 3

Correct Answer: B

Explanation

A Readiness Probe determines whether the application is ready to serve requests.

If the readiness probe fails:

  • The pod continues running.
  • Kubernetes removes the pod from the Service endpoints.
  • No new traffic is routed to it until it becomes ready again.

Question 4

Correct Answer: A

Explanation

Docker images consist of multiple immutable layers.

Each running container adds its own writable layer on top of the shared read-only image layers.

This design reduces storage usage and speeds up container startup.


Question 5

Correct Answer: B

Explanation

Spring Boot Actuator exposes:

/actuator/health

Kubernetes commonly configures:

  • Liveness Probe
  • Readiness Probe

to call this endpoint.

Modern Spring Boot versions also support:

/actuator/health/liveness

/actuator/health/readiness

Question 6

Correct Answer: A

Explanation

Order counts:

StatusCount
SUCCESS3
FAILED2

Output

SUCCESS 3

FAILED 2

Question 7 – Sample Solution

list.stream()

.distinct()

.sorted(Comparator.reverseOrder())

.limit(3)

.forEach(System.out::println);

Concepts Tested

  • distinct()
  • sorted()
  • limit()
  • Streams

Complexity

Time: O(n log n)

Space: O(n)

Interview Follow-up

Can you solve this in O(n) without sorting?

(Expected answer: Yes, by maintaining the top three distinct values in a single pass.)


Question 8 – Sample Solution

Map<String, IntSummaryStatistics> stats =
employees.stream()

.collect(Collectors.groupingBy(
Employee::getDepartment,
Collectors.summarizingInt(Employee::getSalary)));

stats.forEach((dept, summary) -> {

    System.out.println(dept);

    System.out.println("Min : " + summary.getMin());

    System.out.println("Max : " + summary.getMax());

    System.out.println("Avg : " + summary.getAverage());

});

Concepts Tested

  • groupingBy()
  • summarizingInt()
  • IntSummaryStatistics

Complexity

Time: O(n)

Space: O(n)


Question 9 – Sample Solution

Traditional

Set<String> seen = new HashSet<>();

for(String word : sentence.split(" ")){

    if(!seen.add(word)){

        System.out.println(word);

        break;

    }

}

Java 8

Set<String> seen = new HashSet<>();

Arrays.stream(sentence.split(" "))

.filter(word -> !seen.add(word))

.findFirst()

.ifPresent(System.out::println);

Complexity

Time: O(n)

Space: O(n)


Evaluation Guide

ScoreRecommendation
9/9Excellent – Strong Cloud-Native Java Developer
7–8Good – Proceed to Technical Round
5–6Average – Requires Further Evaluation
Below 5Not Recommended

Interviewer’s Notes

This set focuses on production operations and deployment concepts that backend engineers encounter in Kubernetes-based environments.

A strong candidate should be able to explain:

  • How Kubernetes self-healing works using Deployments and ReplicaSets.
  • The difference between ConfigMaps and Secrets.
  • The purpose of Readiness and Liveness probes and when each is triggered.
  • Docker image layering and why containers start quickly.
  • How Spring Boot Actuator integrates with Kubernetes health checks.
  • How summarizingInt() simplifies aggregation logic.
  • The time and space complexity of each programming solution.

Candidates who additionally discuss rolling updates, blue-green deployments, canary releases, Horizontal Pod Autoscaler (HPA), graceful shutdown, resource requests and limits, and observability with Prometheus/Grafana typically demonstrate strong production experience with Kubernetes.

Leave a Reply

Your email address will not be published. Required fields are marked *