Skip to content

09 - Quiz

  • Your name:

  • Your VT email:


What happens if a variable is declared but not explicitly initialized in Go?

  • A. The program does not compile
  • B. The variable is nil
  • C. The variable receives a zero value depending on its type
  • D. The value is undefined and can be something arbitrary

Why is := commonly used inside functions?

  • A. It declares and initializes a variable with inferred type
  • B. It is used to create constants
  • C. It automatically initializes variables to nil
  • D. It is required for all assignments

Which for loop correctly repeats code while sum < 100 in Go?

  • A. for (sum < 100) {}
  • B. while sum < 100 {}
  • C. for sum < 100 {} (note: it is idomatic Go to not put paranthesis)
  • D. repeat sum < 100 {}

What does the expression &x represent?

  • A. The value stored in x
  • B. A copy of x
  • C. The memory address of x
  • D. A reference to a constant