Java Backend Interview Q&A← All stacks

gRPC — Interview Q&A Matrix

Parent stack: Messaging & Integration Technology: gRPC Levels: Senior Questions: 1

Each entry contains a Question, the Expected Depth, an Ideal Answer, and Red Flags.

Senior

Q1 — Choosing between REST and gRPC

Question: When would you choose gRPC instead of REST for service-to-service communication, and what operational concerns must you handle?

Expected Depth:

Ideal Answer:

proto
syntax = "proto3";

package pricing.v1;

service PricingService {
  rpc GetQuote(GetQuoteRequest) returns (QuoteReply);
  rpc StreamTicks(StreamTicksRequest) returns (stream Tick);
}

message GetQuoteRequest {
  string product_id = 1;
  optional string customer_id = 2;
}

message QuoteReply {
  string product_id = 1;
  int64 amount_minor = 2;
  string currency = 3;
}

message StreamTicksRequest {
  repeated string product_ids = 1;
}

message Tick {
  string product_id = 1;
  int64 amount_minor = 2;
  int64 observed_at_epoch_ms = 3;
}
java
QuoteReply reply = pricingStub
        .withDeadlineAfter(300, TimeUnit.MILLISECONDS)
        .getQuote(request);
java
if (request.getProductId().isBlank()) {
    responseObserver.onError(Status.INVALID_ARGUMENT
            .withDescription("product_id is required")
            .asRuntimeException());
    return;
}
proto
message QuoteReply {
  reserved 4;
  reserved "legacy_discount";

  string product_id = 1;
  int64 amount_minor = 2;
  string currency = 3;
  optional string discount_code = 5;
}

Red Flags:


Scoring Rubric

Level Pass bar
JuniorExplains the basic gRPC model and common call types.
SeniorChooses gRPC for clear reasons and handles failures, security, and compatibility correctly.
ArchitectDefines contract, migration, reliability, and operational standards across services.