NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content

Quiz: Golang

Golang questions from real interviews as a quiz, with an explanation for every option.

33 questionsAll topicsGolang

Try it: 5 questions

Loading…

Sample questions

  1. Which steps are part of the basic setup for running a REST API in Kubernetes? Select all that apply.

    • Create only a ClusterIP Service to expose the API to users on the internet.
    • Build the application image and publish it to a registry the cluster can access.
    • Define a Deployment to run the pods and a Service to route traffic to them.
    • Run the app on localhost and rely on Kubernetes to forward external traffic to it automatically.
    • Configure the app to listen on the container’s network interface and add health probes when needed.
    Full answer
  2. Which description of HTTPS and how an HTTPS connection is established is most accurate?

    • HTTPS differs from HTTP only in certificate validation: after validation, data is sent unencrypted, just as with ordinary HTTP.
    • HTTPS is HTTP encrypted with the server certificate; the client uses the certificate’s public key to encrypt every request and response.
    • HTTPS is HTTP over TLS: the client validates the server certificate, the parties agree on session keys, and HTTP data is then sent with encryption and integrity protection.
    • HTTPS is HTTP with an extra checksum; TLS is established after the first HTTP request has been sent.
    Full answer
  3. Which options directly describe ways to implement an API or handle requests in Go, rather than ways to divide an application into components? Select all that apply.

    • The standard library’s net/http package
    • A framework or router such as Gin or Echo
    • HTML and CSS
    • Microservice architecture
    • gRPC
    Full answer
  4. What is the message sequence in a TCP three-way handshake?

    • The client sends SYN, the server replies with SYN-ACK, and the client completes the exchange with FIN.
    • The client sends SYN-ACK, the server replies with SYN, and the client completes the exchange with ACK.
    • The client sends SYN, the server replies with ACK, and the client completes the exchange with SYN-ACK.
    • The client sends SYN, the server replies with SYN-ACK, and the client completes the exchange with ACK.
    Full answer
  5. Which approach helps a microservice safely handle the same message being delivered more than once?

    • Disable message delivery acknowledgements
    • Always process each message in a separate goroutine
    • Assume the broker guarantees that every message is delivered exactly once
    • Make the handler idempotent and, when needed, check the message ID
    Full answer
  6. In the “client → Load Balancer → API Gateway → services” setup, what is the Load Balancer’s primary role before the API Gateway?

    • Check a user’s permissions for each API method
    • Combine responses from several microservices into one
    • Select a microservice based on the API request path and parameters
    • Distribute incoming traffic across API Gateway instances
    Full answer
  7. Which statement correctly distinguishes stackless tasks from ordinary Go goroutines?

    • Stackless tasks get a fixed-size stack, while a Go goroutine’s stack always grows to the size of an OS thread’s stack.
    • Stackless tasks have no separate call stack and usually store state explicitly; Go goroutines have a runtime-managed, dynamically growing stack.
    • Stackless tasks are switched only by Go’s scheduler, while ordinary goroutines are switched only manually.
    • All Go goroutines are stackless, and a separate stack is created only when a call blocks.
    Full answer
  8. Which statement most accurately describes modifying data in Go without pointers?

    • You can change array and slice elements, struct fields, and map entries; string characters cannot be changed.
    • Without pointers, you can change only primitive values, not collection elements.
    • Slices and maps can be read without pointers, but changing their elements requires a pointer.
    • Strings can be changed character by character, while arrays and structs require pointers.
    Full answer
  9. A data migration takes several minutes while the source continues to change. Which approaches help avoid losing changes and reduce the migration’s impact on the application? Select all that apply.

    • Use a replica and switch only after checking its lag and data consistency.
    • Keep one transaction open until the entire operation finishes so the data cannot change.
    • Copy data in small, idempotent batches, save progress, and throttle the workload.
    • Assume any replica always contains all the latest changes from the source.
    • Copy a consistent snapshot, record the change-log position, and then apply changes from the log.
    Full answer
  10. When is a gRPC stream usually a better fit than a unary call?

    • When the server should return only a final result after processing the request.
    • When each request should be independent and end with one response.
    • When the client needs one small response to a single request.
    • When multiple messages need to be exchanged and may arrive over time.
    Full answer