0
0
Goprogramming~5 mins

Basic data types in Go - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is an int in Go?
An int is a basic data type in Go used to store whole numbers without decimals, like 1, 42, or -7.
Click to reveal answer
beginner
What does the float64 type represent?
float64 is a data type for numbers with decimals, like 3.14 or -0.001. It uses 64 bits to store the value.
Click to reveal answer
beginner
What is the string type used for in Go?
string stores text, like words or sentences, for example "hello" or "Go programming".
Click to reveal answer
beginner
What is a bool type?
bool holds a value that is either true or false. It is used for yes/no or on/off decisions.
Click to reveal answer
beginner
How do you declare a variable of type int in Go?
You can declare an int variable like this: var age int = 30. This creates a variable named age that holds the number 30.
Click to reveal answer
Which Go data type would you use to store the number 42?
Astring
Bint
Cbool
Dfloat64
What value can a bool type hold?
Atrue or false
BText strings
CAny number
DDecimal numbers
Which type is best for storing the text "hello"?
Afloat64
Bint
Cbool
Dstring
What is the difference between int and float64?
Aint stores true/false, float64 stores numbers
Bint stores text, float64 stores numbers
Cint stores whole numbers, float64 stores decimal numbers
Dint stores decimal numbers, float64 stores whole numbers
How do you declare a variable named 'score' with value 100 as an int?
Avar score int = 100
Bscore := "100"
Cvar score string = 100
Dscore = 100.0
Explain the main basic data types in Go and give an example of each.
Think about numbers, text, and true/false values.
You got /5 concepts.
    How do you declare and assign a variable of type string in Go?
    Use 'var' and '=' to create the variable.
    You got /5 concepts.