Country or region and language

    Choose your country or region and your language.

    Suggested for you

      All countries and regions

        Choose your character

        It shows in the top bar and on your profile. Change it any time.

        Interviews in Go programming

        Work in the tool while you explain your decisions.

        Choose a role and level. Each interview has a new task, follow-up questions and a report that checks your work and your explanation.

        Speak or type. Sign in to save your results across devices.

        Timed assessment

        • 12 practical questions
        • 90 minutes
        • Mid level

        Questions are drawn from a bank of 36. Your report includes a skill breakdown and lessons to practice next.

        Practice interviews

        Junior tasks cover the fundamentals. Mid and senior tasks add debugging, changing requirements and review decisions.

        12 interviews

        • Backend engineer
        • Junior
        • 22 min

        Independent parcel slices

        Return a new slice with delta added to every value. The caller must keep its original values. Keep duplicates and order. Empty input returns an empty result.

        Start interview
        Skills and rubricIndependent parcel slices
        • A slice header refers to backing storage. Appending the elements into a fresh empty slice separates this result from the caller before any write.
        • An empty input has length zero. For [3,0,3] and delta 4, the result is [7,4,7] while the original remains [3,0,3].
        • Trace a concrete input and compare its expected result with the actual result.
        • Software engineer
        • Junior
        • 22 min

        A recorded zero is present

        Return the map value and whether the key is present. A recorded zero is present. A missing key and a nil map return zero and false. Do not change the map.

        Start interview
        Skills and rubricA recorded zero is present
        • A map lookup returns a zero value for both missing keys and stored zero values. The separate ok result preserves presence without inventing a sentinel.
        • A stored dock:0 returns (0,true). Reading dock from a nil map returns (0,false). Reading is safe; assigning into a nil map panics.
        • Trace a concrete input and compare its expected result with the actual result.
        • Platform engineer
        • Junior
        • 22 min

        Reservation state survives a call

        Accept each positive reservation only when it fits remaining capacity. Rejected requests leave state unchanged. Use Ledger.Add to retain accepted seats and return used capacity. Capacity is nonnegative.

        Start interview
        Skills and rubricReservation state survives a call
        • The pointer receiver updates the same ledger used by the reservation loop. Guarding the complete request before Add keeps used capacity between zero and capacity.
        • At capacity 8, requests [3,6,2,0] use 5 seats. A party that fills the last seat is valid; zero and negative requests are rejected.
        • Trace a concrete input and compare its expected result with the actual result.
        • Backend engineer
        • Junior
        • 22 min

        A typed nil inside an interface

        Report whether the Worker can run. A nil interface is not ready. A typed nil *Runner stored in Worker is also not ready. Call Ready only after ruling out a nil interface.

        Start interview
        Skills and rubricA typed nil inside an interface
        • An interface is nil only when both its dynamic type and value are absent. The nil-safe Ready method handles a Worker containing a typed nil *Runner.
        • Both var w Worker and var r *Runner passed as Worker are not ready. An allocated Runner is ready.
        • Trace a concrete input and compare its expected result with the actual result.
        • Software engineer
        • Mid
        • 30 min

        Preserve the validation cause

        Return nil for a positive count. For zero or a negative count, wrap ErrCount with manifest context so errors.Is still recognizes the original cause.

        Start interview
        Skills and rubricPreserve the validation cause
        • Wrapping with %w preserves the error chain while adding context. errors.Is walks that chain, so callers can inspect the cause without comparing an entire message.
        • Zero and negative counts preserve ErrCount. A positive count returns a nil error, without constructing an empty-message error.
        • Explain the cost and the assumption behind it: O(1) work here; errors.Is inspects the error chain.
        • Platform engineer
        • Mid
        • 30 min

        Generic first maximum

        Return the largest value and true for a nonempty slice of int, int64 or a named type with either underlying type. Empty input returns the type zero and false. All-negative inputs must work.

        Start interview
        Skills and rubricGeneric first maximum
        • The ~ constraints admit named integer types with the required underlying representation. Starting from the first element makes the candidate an actual member even when all values are negative.
        • For [-8,-3,-6], the function returns (-3,true). An empty []int64 returns (0,false). A named Qty type retains its own return type.
        • Explain the cost and the assumption behind it: O(n) time and O(1) extra state.
        • Backend engineer
        • Mid
        • 30 min

        Drain the channel to closure

        Drain a nonnil receive-only channel until it closes, preserving every value in receive order. Zero is data. Return an empty slice for an already-closed empty channel. The caller closes the channel.

        Start interview
        Skills and rubricDrain the channel to closure
        • A channel range stops after closure and after buffered values are received. It preserves zero values because termination comes from channel state rather than value content.
        • A closed channel containing [0,7,-2] yields all three values. An empty closed channel ends immediately. A nil channel would block, so it is excluded.
        • Explain the cost and the assumption behind it: O(n) receives and O(n) returned elements.
        • Software engineer
        • Mid
        • 30 min

        Cancellation wins before work

        Before copying any values, check whether the context is already canceled. If canceled, return nil and its error. Otherwise return an independent copy and nil. This task checks entry cancellation, not a race-free guarantee against future cancellation.

        Start interview
        Skills and rubricCancellation wins before work
        • ctx.Err exposes cancellation that has already happened. Checking it at entry prevents the copy in that case. It does not freeze context state or make later operations atomic.
        • An already-canceled context returns nil and context.Canceled. A live context returns a copy, and changing that result leaves the input untouched.
        • Explain the cost and the assumption behind it: O(n) copying when live; O(1) work when already canceled.
        • Platform engineer
        • Senior
        • 38 min

        One protected counter

        Start workers goroutines. Each increments one shared counter each times. Protect every increment with one shared mutex and wait for all goroutines before returning. Inputs are nonnegative. Browser results alone do not prove race freedom.

        Start interview
        Skills and rubricOne protected counter
        • All goroutines share one mutex guarding the counter, and WaitGroup.Wait finishes after their Done calls. Waiting alone would not make unsynchronized increments safe.
        • I would protect the shared map as well as the counter, and update related state under one lock when the report requires them to agree. A separate lock per goroutine protects nothing shared. I would also run native race-detector tests because this browser schedule cannot prove all interleavings.
        • Defend the input and deployment limits before claiming these costs: O(workers × each) updates and O(workers) goroutines.
        • Backend engineer
        • Senior
        • 38 min

        Cleanup before the result returns

        Return an ordered resource trace with the label prefix: open, work, then failed or ok, and finally close. Register cleanup with defer so both return paths close exactly once. Keep the colon even for an empty label.

        Start interview
        Skills and rubricCleanup before the result returns
        • The deferred closure runs after the return statement but before the caller receives the named result. It appends cleanup to that result for both normal and failed work.
        • I would register cleanup after successful acquisition because a resource that never opened may not be safe to close. With multiple acquisitions, each success needs its own deferred cleanup before the next acquisition. I would test a later acquisition failure and verify earlier resources still close.
        • Defend the input and deployment limits before claiming these costs: O(1) trace events and state in this contract.
        • Software engineer
        • Senior
        • 38 min

        A handler with a method boundary

        Implement an HTTP handler. GET returns status 200, Content-Type text/plain and body parcel-ready. Every other method returns 405 with an empty body. Test the handler in memory; do not open a network listener.

        Start interview
        Skills and rubricA handler with a method boundary
        • The method guard returns before writing the normal body. httptest.ResponseRecorder captures status, headers and bytes without a real socket, so tests check the handler contract directly.
        • A direct handler call only tests request-to-response behavior. Redirect following is client behavior, so I would use a separate native integration test with a configured HTTP client and test server. I would retain these fast handler tests while giving network behavior its own environment.
        • Defend the input and deployment limits before claiming these costs: O(1) work for the fixed response.
        • Platform engineer
        • Senior
        • 38 min

        Missing JSON differs from zero

        Decode one JSON object with a required nonnegative integer units field. Zero is valid. Reject a missing field, null, unknown fields, malformed JSON and trailing JSON values.

        Start interview
        Skills and rubricMissing JSON differs from zero
        • A pointer field distinguishes absent or null units from a recorded zero. DisallowUnknownFields rejects unexpected keys. A second Decode must return io.EOF so another JSON value cannot be silently ignored.
        • I would bound the body size before decoding because validation after reading cannot recover memory already consumed. An HTTP boundary can use MaxBytesReader and report its size error. I would test a valid body at the limit and an oversized body separately from malformed JSON.
        • Defend the input and deployment limits before claiming these costs: O(n) input bytes scanned and decoder storage bounded by the input.

        Interview Hub access

        The Interview Hub is included in All Access. Choose a plan or sign in to your account to continue.

        View plansSign in or join

        Your Work Gym account

        Save your progress and pick up on another device. Your browser's progress comes with you.

        or

        You can keep practicing without an account.

        Change your plan

        Checking the price

        Help and feedback

        Ask a question, tell us what is not working, or share an idea. We reply by email.

        What is it about?

        We use it only to reply to you.