Skip to content
Interview Bank
MiddleTechnicalGolang3 views

СБЕР interview

Questions22

  1. What is printed by each code snippet? ```go func main() { nums := []int{1, 2, 3} addNum(nums[0:2:2]) fmt.Println(nums) //? addNums(nums[0:2:2]) fmt.Println(nums) //? } func addNum(nums []int) { nums = append(nums, 4) } func addNums(nums []int) { nums = append(nums, 5, 6) } ``` ```go package main import "fmt" func main() { ch := make(chan int) go func() { for i := 0; i < 5; i++ { ch <- i } }() for n := range ch { fmt.Println(n) } } ``` How many seconds does this code take to run? ```go func main() { timeStart := time.Now() _ = <-worker(), <-worker() println(int(time.Since(timeStart).Seconds())) } func worker() chan int { ch := make(chan int) go func() { time.Sleep(3 * time.Second) ch <- 1 }() return ch } ```

    Screenshot
  2. What does this Go program print? ```go type X struct { V int } func (x X) S() { fmt.Println(x.V) } func main() { x := X{123} defer x.S() x.V = 456 } ```

    Screenshot
  3. What is printed when this Go program runs? ```go import "fmt" type X struct { V int } func (x X) S() { fmt.Println(x.V) } func main() { x := X{123} defer func() { x.S() }() x.V = 456 } ```

    Screenshot

19 more questions from this interview

A subscription opens every question, and Copilot suggests answers live during your СБЕР interview.

Sign in to unlock

Summarized questions based on candidates' accounts. These materials do not represent the official position of the companies and do not disclose internal processes. If you believe a publication violates your rights — contact us.