gRPC interview questions

25 questions from the gRPC course, each with the correct answer and an explanation. Try to answer before you open the answer.

gRPC Foundations

1. What does a gRPC client call?

  1. SQL stored procedures
  2. Arbitrary URLs with free-form JSON
  3. Generated stub methods defined in the .proto service
  4. Shell commands on the server
Show answer

Answer: Generated stub methods defined in the .proto service

Typed methods from the contract.

Lesson: What gRPC Is

2. Where does gRPC send the final status of a call?

  1. In HTTP/2 trailers (grpc-status)
  2. In the URL
  3. In the first request header only
  4. In a separate TCP connection
Show answer

Answer: In HTTP/2 trailers (grpc-status)

Status arrives after the response messages.

Lesson: HTTP/2 and Protocol Buffers

3. Which scenario suits gRPC best?

  1. Browser forms without any gateway
  2. A public API explored with curl by thousands of developers
  3. Serving static images via a CDN
  4. High-throughput calls between internal microservices
Show answer

Answer: High-throughput calls between internal microservices

Internal, typed, efficient.

Lesson: When to Use gRPC

Protocol Buffers

4. What identifies a field in the protobuf binary encoding?

  1. Its name
  2. Its field number
  3. Its position in the file only
  4. Its comment
Show answer

Answer: Its field number

Names are for generated code.

Lesson: Messages and Field Numbers

5. Why should an enum start with an UNSPECIFIED value of 0?

  1. Protobuf forbids other numbers
  2. Zero is the default for unset fields, so it should mean "not set" rather than a real state
  3. It makes messages smaller
  4. It sorts enums alphabetically
Show answer

Answer: Zero is the default for unset fields, so it should mean "not set" rather than a real state

Defaults should be safe.

Lesson: Enums, oneof, maps and Well-Known Types

6. Which protobuf change is safe?

  1. Changing a field from string to int64
  2. Changing an existing field's number
  3. Reusing a deleted field's number
  4. Adding a new field with a new number
Show answer

Answer: Adding a new field with a new number

Unknown fields are ignored by old code.

Lesson: Evolving Schemas Safely

Services and Code Generation

7. Which RPC kind sends one request and receives a stream of responses?

  1. Server streaming
  2. Unary
  3. Client streaming
  4. Bidirectional streaming
Show answer

Answer: Server streaming

stream on the response side.

Lesson: Defining Services and RPC Types

8. What does the --grpc_python_out option generate?

  1. A database schema
  2. Only message classes
  3. gRPC client stubs and server base classes
  4. HTML documentation
Show answer

Answer: gRPC client stubs and server base classes

Message classes come from --python_out.

Lesson: Generating Code

9. How does a Python gRPC server report "not found"?

  1. Raise HTTP 404
  2. Return None
  3. context.abort with StatusCode.NOT_FOUND
  4. Print an error and return an empty message
Show answer

Answer: context.abort with StatusCode.NOT_FOUND

Status codes, not HTTP codes.

Lesson: A Unary RPC End to End

Streaming RPCs

10. What slows a fast server when the client reads a stream slowly?

  1. HTTP/2 flow control
  2. TLS
  3. Protobuf compression
  4. DNS caching
Show answer

Answer: HTTP/2 flow control

Built-in back-pressure.

Lesson: Server Streaming

11. When does a client-streaming RPC typically return its response?

  1. Never
  2. Before the first message
  3. Once per client message
  4. After the server has read the client's stream
Show answer

Answer: After the server has read the client's stream

One response at the end.

Lesson: Client Streaming

12. What is true of bidirectional streaming?

  1. The server must wait for the client to finish
  2. Client and server streams are independent and can interleave in any order
  3. Only one message may be sent each way
  4. It requires two TCP connections
Show answer

Answer: Client and server streams are independent and can interleave in any order

Full-duplex over one call.

Lesson: Bidirectional Streaming

Deadlines, Errors and Retries

13. What status does a client get when its deadline expires?

  1. NOT_FOUND
  2. DEADLINE_EXCEEDED
  3. OK
  4. UNIMPLEMENTED
Show answer

Answer: DEADLINE_EXCEEDED

The server-side call is cancelled too.

Lesson: Deadlines and Cancellation

14. Which status code is generally safe to retry?

  1. NOT_FOUND
  2. INVALID_ARGUMENT
  3. PERMISSION_DENIED
  4. UNAVAILABLE
Show answer

Answer: UNAVAILABLE

Transient failures only.

Lesson: Status Codes and Rich Errors

15. Why is retrying PlaceOrder blindly dangerous?

  1. It is not idempotent and could create duplicate orders
  2. gRPC forbids retries
  3. Retries always time out
  4. It changes the proto file
Show answer

Answer: It is not idempotent and could create duplicate orders

Retry only idempotent or deduplicated operations.

Lesson: Retries and Idempotency

Metadata, Security and Interceptors

16. What suffix marks a binary metadata key?

  1. _b64
  2. -binary
  3. -bin
  4. -raw
Show answer

Answer: -bin

Binary values are base64-encoded on the wire.

Lesson: Metadata

17. What does mutual TLS add over regular TLS?

  1. Automatic retries
  2. Faster serialisation
  3. The client also proves its identity with a certificate
  4. Compression of messages
Show answer

Answer: The client also proves its identity with a certificate

Both sides authenticate.

Lesson: TLS, mTLS and Token Authentication

18. What are gRPC interceptors comparable to?

  1. Middleware that runs around each RPC
  2. Protobuf messages
  3. Database triggers only
  4. Load balancers
Show answer

Answer: Middleware that runs around each RPC

Cross-cutting logic.

Lesson: Interceptors

Load Balancing, Browsers and Tooling

19. Why can a TCP load balancer distribute gRPC traffic unevenly?

  1. TLS prevents balancing
  2. gRPC does not use TCP
  3. Protobuf messages are too small
  4. Many calls share one long-lived HTTP/2 connection to a single backend
Show answer

Answer: Many calls share one long-lived HTTP/2 connection to a single backend

Balance per request at L7 or client-side.

Lesson: Load Balancing gRPC

20. Why can browsers not call native gRPC directly?

  1. Browsers do not support HTTPS
  2. Browser APIs do not give enough control over HTTP/2 framing and trailers
  3. Protobuf is illegal in browsers
  4. gRPC requires UDP
Show answer

Answer: Browser APIs do not give enough control over HTTP/2 framing and trailers

Use gRPC-Web, Connect or a gateway.

Lesson: Browsers, gRPC-Web, Connect and Gateways

21. What does gRPC server reflection enable?

  1. Automatic retries
  2. Tools can discover services and message types at runtime
  3. TLS certificate rotation
  4. Database migrations
Show answer

Answer: Tools can discover services and message types at runtime

Useful for grpcurl and GUIs.

Lesson: Health Checks, Reflection and Tools

gRPC in Production

22. Which dimension should gRPC metrics be broken down by?

  1. Random IDs per request
  2. Message field values
  3. User passwords
  4. Service method and status code
Show answer

Answer: Service method and status code

Bounded, meaningful labels.

Lesson: Observability

23. What does a FieldMask in an update request specify?

  1. Which fields of the resource should be changed
  2. The encryption key
  3. The page size
  4. The server address
Show answer

Answer: Which fields of the resource should be changed

Partial updates without ambiguity.

Lesson: API Design Conventions

24. Why run the server in-process for tests?

  1. It removes the need for proto files
  2. It makes protobuf optional
  3. It exercises real stubs, serialisation and interceptors without external networking
  4. It disables deadlines
Show answer

Answer: It exercises real stubs, serialisation and interceptors without external networking

Realistic yet fast.

Lesson: Testing gRPC Services

25. Which item belongs on a gRPC checklist?

  1. Retry PlaceOrder on every error
  2. Reuse deleted field numbers
  3. Every client call sets a deadline
  4. Use insecure channels in production
Show answer

Answer: Every client call sets a deadline

Bounded, safe calls.

Lesson: A gRPC Service Checklist

← Back to the course