Golang Interview Questions

Want to become an expert in cracking Golang interview questions/Go interview questions?

Start with practicing the questions below. Whether a question involves multiple choice or live coding, we will give you hints as you go and tell you if your answers are correct or incorrect.

After that, take our timed public Golang Interview Questions Test.

To use our service for testing candidates, buy a pack of candidates.


1. Merge Names

Go Collections Public New

Implement the uniqueNames function. When passed two slices of names, it will return a slice containing the names that appear in either or both slices. The returned slice should have no duplicates.

For example, calling uniqueNames([]string{"Ava", "Emma", "Olivia"}, []string{"Olivia", "Sophia", "Emma"}) should return a slice containing Ava, Emma, Olivia, and Sophia in any order.

Easy 
10min
Go 1.13  
 


  •   Example case: Wrong answer
  •   Each slice has distinct names: Wrong answer
  •   Each slice has duplicate names: Wrong answer
  •   Slices have some names in common: Wrong answer


2. Quadratic Equation

Go Arithmetic Public New

Implement the function findRoots to find the roots of the quadratic equation: ax2 + bx + c = 0.

The roots of the quadratic equation can be found with the following formula: A quadratic equation.

For example, the roots of the equation 2x2 + 10x + 8 = 0 are -1 and -4.

Easy 
10min
Go 1.13  
 


  •   Example case: Wrong answer
  •   Equal roots: Wrong answer
  •   Distinct roots: Wrong answer


3. Numeric Input

Go Interfaces Public New

User interface contains NumericInput control, which accepts only digits.

Extend NumericInput structure so that:

  • It implements UserInput interface.
  • Add(rune) should add only decimal digits to the input. Other runes should be ignored.
  • GetValue() should return the current input.

For example, the following code should output "10":

var input UserInput = &NumericInput{}
input.Add('1')
input.Add('a')
input.Add('0')
fmt.Println(input.GetValue())
Easy 
15min
Go 1.13  
 


  •   Example case: Wrong answer
  •   GetValue() returns input: Wrong answer
  •   Add(rune) adds runes to the input: Wrong answer
  •   Add(rune) adds only decimal digits to the input: Wrong answer


If you feel ready, take one of our timed public Golang Interview Questions tests:
  • Go/Golang Online Test (Easy)
Not exactly what you are looking for? Go to our For Jobseekers section.