These Go data types questions cover variables, constants, basic types, conversions and operators, which come up in every Go interview. We gathered them from public interview lists, forum threads and hiring guides. Then we grouped them, so you can revise one idea at a time.
This post is questions only, because answering in your own words is the real practice. Before you start, it helps to read Go variables, constants and data types and Go operators. Also, finish Part 1 on Go basics first if you have not done it yet.
How to Use These Go Data Types Questions
Answer each question out loud in two or three sentences. When you cannot answer, note the number and read the linked tutorial. Then try the scenario questions, since they show how you use types in real code.
The table below shows each section and its number of questions.
| Section | What it tests | Questions |
|---|---|---|
| Variables | var, short declaration and scope | 16 |
| Constants and iota | Typed and untyped constants | 14 |
| Basic types | Numbers, bool, byte, rune and string | 18 |
| Conversion and inference | Casting rules and default types | 14 |
| Zero values and scope | Defaults, shadowing and globals | 13 |
| Operators | Arithmetic, bitwise and comparison | 15 |
| Code reading | Predict the output of short programs | 4 |

Go Data Types Questions on Variables
Before you answer, study Go variables, constants and data types. Interviewers start these Go data types questions here, because every program uses variables.
- How do you declare a variable with var, and when do you give it a type?
- What is the short declaration operator, and also where can you use it?
- Why can you not use := outside a function body?
- How do you declare several variables in one line, such as name and age?
- What happens when you use := and one variable on the left already exists?
- Can you redeclare a variable in the same scope, unlike in an inner block?
- How is a package level variable different from a local variable?
- When would you prefer var over := inside a function?
- What does the blank identifier do, for example in
_, err := f()? - How do you swap two variables in one line without a temporary variable?
- Why does Go reject an unused local variable but allow an unused global?
- What is a variable block, and how does it make code easier to read?
- How do you check the type of a variable while you debug?
- Can a variable change its type after you declare it, as in Python?
- Scenario: when a reviewer asks you to replace many var lines with :=, which ones would you keep?
- Scenario: when a bug appears because err was declared twice with :=, how would you find it?
Go Data Types Questions on Constants and iota
Constants look simple, so interviewers use these Go data types questions to check details. Also, iota questions are a favourite in written tests.
- What is a constant in Go, and how is it different from a variable?
- Which types can a constant have?
- How is a typed constant different from an untyped constant, so which is more flexible?
- Why can an untyped constant hold a number bigger than int64?
- What is iota, and where does it start counting?
- How does iota reset when a new const block begins?
- In an iota sequence, how do you skip a value you do not need?
- How would you build file size units such as KB, MB and GB with iota?
- Can you take the address of a constant, and why or why not?
- Can a constant hold the result of a function call such as len?
- How do you create an enum style type with iota and a custom type?
- Why is it useful to add a String method to an iota based type?
- Scenario: when someone adds a new status in the middle of an iota list, what can break in saved data?
- Scenario: when a team stores order states as plain strings everywhere, how would constants help?
Go Data Types Questions on Basic Types
Before you answer, review the type table later in this post. These Go data types questions test the details that cause real bugs.
- Which basic types does Go have, and how would you group them?
- What is the size of int on a 64 bit machine, and why can it differ on others?
- When would you choose int32 or int64 instead of plain int?
- What is the difference between signed and unsigned integers?
- Explain what a byte is, and also which type it is an alias for.
- What is a rune, and which type is it an alias for?
- How do float32 and float64 differ in precision, and so which is the default?
- Why should you avoid float64 for money values?
- Does Go have a decimal type, and what do teams use instead?
- What are complex64 and complex128 used for?
- Can a bool be converted to an int in Go, as in C?
- Is a string mutable, and what does that mean in practice?
- What is uintptr, and why do most programs never need it?
- What happens when an integer overflows at run time?
- How do you find the largest value an int64 can hold, for example with the math package?
- What is the difference between a type alias and a type definition?
- Scenario: when a shop app shows 0.30000000000000004 as a price, what went wrong and how would you fix it?
- Scenario: when an ID from an external API is larger than int32, which type would you pick?
Type Conversion and Inference Questions
Go never converts types for you, so these Go data types questions are common. Before you answer, think about why Go made that choice.
- Why does Go not allow implicit conversion between int and float64?
- How do you convert an int to a float64 and back again?
- What happens to the decimal part when you convert a float to an int?
- How do you convert a string to an int, and what errors can happen?
- Why does
string(65)not give you “65”? - What is type inference, and how does Go use it with :=?
- Which default type does an untyped integer constant get?
- Which default type does an untyped float constant get?
- Can you add an int and an int64 directly, or do you need a conversion first?
- How do you convert between two named types with the same base type?
- What is the difference between a conversion and a type assertion?
- When would strconv be better than fmt.Sprintf for conversions?
- Scenario: when a form sends age as text, how would you convert and validate it safely?
- Scenario: when a large int64 is converted to int32 in a report, how would you prevent silent data loss?
Go Data Types Questions on Zero Values and Scope
Before you answer, recall that Go always gives a variable a starting value. These Go data types questions test how well you trust and use that rule.
- What is a zero value, and why does Go have it?
- Name the zero value of int, string, bool and a pointer.
- What is the zero value of a slice, a map and a channel?
- When a struct has several fields, what is its zero value?
- Why is the zero value of sync.Mutex ready to use?
- What is variable shadowing, and why is it risky?
- How can go vet or a linter help you find shadowed variables?
- What is block scope, for example inside an if statement?
- Why should you limit global variables, especially when tests run in parallel?
- What is the scope of a variable declared in a for loop header?
- How does the universe block hold names such as int and true?
- Scenario: when a function always returns nil error even though a call failed, how would you check for shadowing?
- Scenario: when zero values in a config look valid, how would you tell unset from zero?
Operators Questions
Before you answer, study Go operators with examples. These questions mix syntax with small traps.
- Which arithmetic operators does Go have, and what does % do with negative numbers?
- What is integer division, and why does 7 / 2 give 3?
- How do the logical operators && and || short circuit?
- Explain the bitwise operators &, |, ^ and &^ with one example each.
- How do the shift operators work, and what is 1 << 10?
- Why does Go have i++ as a statement but not as an expression?
- Is there a ternary operator, and what do you use instead?
- Which types can you compare with == and which ones you cannot?
- Can you compare two structs with ==, and when does it fail to compile?
- What does operator precedence mean, and when should you add brackets?
- How do compound operators such as += and <<= work?
- What is the difference between & as an operator on numbers and & before a variable?
- How would you check if a number is even using a bitwise operator?
- Scenario: when a discount calculation gives 0 instead of 0.5, which operator rule is the cause?
- Scenario: when you must store eight on and off flags in one value, how would you use bit operators?
Code Reading Questions
Read each program and predict the output before you run it, just as you would in a written round. Then explain your answer in plain words.
package main
import "fmt"
const (
A = iota * 10
B
_
D
)
func main() {
var small int8 = 127
small++
fmt.Println(A, B, D, small)
const c = 0.1 + 0.2
x, y := 0.1, 0.2
fmt.Println(c == 0.3, x+y == 0.3)
}
- What does the first Println show, and why does small change sign?
- Why do the two comparisons on the last line give different results?
Here is the second program. This time, focus on scope and division.
package main
import "fmt"
func main() {
x := 1
if x := 2; x > 1 {
fmt.Println("inside:", x)
}
fmt.Println("outside:", x)
var total float64 = 7 / 2
fmt.Println(total, 7/2.0)
}
- Which value of x prints inside and outside the if block?
- Why is total not 3.5, even though its type is float64?
Quick Revision Table for Go Types
Many answers in this post depend on sizes and zero values. So use the table below for a final check before your interview.
| Type | Typical size | Zero value |
|---|---|---|
| int, uint | 64 bits on a 64 bit machine | 0 |
| int8 to int64 | 8 to 64 bits | 0 |
| float64 | 64 bits | 0 |
| bool | 1 byte | false |
| byte (uint8) | 8 bits | 0 |
| rune (int32) | 32 bits | 0 |
| string | 16 byte header | “” (empty) |
| pointer, slice, map | Header or address | nil |
Also, remember the difference between var and the short form. The diagram below compares them side by side.

Official Resources
These official pages explain the rules behind these questions.
Quick Recap
- These Go data types questions cover variables, constants, basic types, conversion, zero values and operators.
- Go never converts types for you, so know the conversion rules well.
- Practise iota sequences, since written tests use them often.
- Watch for shadowing with :=, because it hides real bugs.
- Avoid float64 for money and know what teams use instead.
- Run the code reading programs to confirm your answers.
What’s Next?
By now, you have Go data types questions for every part of the types round. So next, we will cover if, switch and every kind of for loop.
Next up: Go control flow questions on if, switch and loops (Part 3)


