Take this quiz
- The smallest standalone element of a program that expresses some action to be carried out.
- statement
- expression
- A combination of one or more explicit values, constants, variables, operators, and functions that the programming language interprets and computes to produce another value.
- statement
- expression
- Which are "parentheses" or "parens?"
- ()
- {}
- []
- Which are "curly braces" or "curlies" or "braces?"
- ()
- {}
- []
- Which are "brackets?"
- ()
- {}
- []
- The "scope" of a variable is where you can access the variable, eg, write to it or read the value from it. *
- true
- false
- In Go, an
int
is a primitive data TYPE
- true
- false
- In Go, a
string
is a primitive data TYPE
- true
- false
- A "composite" data TYPE allows you to compose together values of other data TYPES
- true
- false
- When a variable is declared in Go using the
var
keyword, and no VALUE is ASSIGNED to that variable, then the compiler assigns a default value to the variable. This is known as the "zero value"
- true
- false
- Keywords are words that a reserved for use by the Go programming language; they have to be used in a certain way for a certain purpose.
- true
- false
- Keywords are sometimes called "reserved words."
- true
- false
- You can’t use a keyword for anything other than its purpose.
- true
- false
- In
2 + 2
the+
is the OPERATOR
- true
- false
- In
2 + 2
the2
s are OPERANDS
- true
- false
-
For finding documentation, what is the difference between documentation found at golang.org and godoc.org?
-
package
is a keyword
- true
- false
var
is a keyword
- true
- false
- The entry point for all programs is in
func main()
which needs to be inside package main
- true
- false
- The "short declaration operator" can be used anywhere in a program, including at both the package level and at the block level.
- true
- false
- What are the three words used to describe good package names in the "effective go" document?
- descriptive
- short
- concise
- evocative
-
What is the name of the website where you can write (most) Go code online and have it run online?
-
A great place to ask questions is the "golang bridge forum" at https://forum.golangbridge.org/
- true
- false
- When you see something like
fmt.Println()
this is calling thePrintln()
function from thefmt
package.
- true
- false
- An "identifier" is the name assigned to a variable or a function or a constant.
- true
- false
- To call a func, variable, or constant from a package, use the "package-dot-identifier" syntax. For example, like this,
fmt.Println()
- true
- false
-
What is "idiomatic Go code"?
-
Which character allows you to "throw away returns" or "send returns into the void"? Said another way, which character allows you to tell the compiler that you are not going to use a value returned by a function?
- #
- @
- _
- This is a trick question
- In Go, you cannot have a variable which you do not use.
- true
- false
- When you see that a func has a parameter of this type
...interface{}
this is called a "variadic parameter" and it means that the func can take as many values of that type as you want to pass in.
- true
- false
- Every value in Go is also of type "empty inerface" which is expressed like this:
interface{}
- true
- false
- A statement is an instruction that commands the computer to perform a specified action. Usually statements take up a line in a program.
- true
- false
- An expression is a combination of one or more explicit values, constants, variables, operators, and functions that the programming language interprets and computes to produce another value. For example, 2+3 is an expression which evaluates to 5.
- true
- false
- If I wanted to print to a string and then assign that value to a variable, I could use the
func Sprintf()
from thefmt
package.
- true
- false
- In Go, you can create your own TYPE
- true
- false
- We don't say "casting" in Go, we say "conversion"
- true
- false
- There is a language which we use to talk about the language.
- true
- false
- When you create our own TYPE in Go, that TYPE will have an "underlying TYPE".
- true
- false