Go quiz questions

Go interview questions

  • 1.

    Which of the following is true about exporting methods in Go?

    1. In Go language, a name is exported if it starts with capital letter.

    2. Exported means that a function or variable/constant is accessible to importer of the respective package.

    3. Both of the above.

    4. None of the above.

    Answer
  • 2.

    Does Go support generic programming?

    1. yes

    2. no

    Answer
  • 3.

    The term rvalue refers to a data value that is stored at some address in memory.

    1. true

    2. false

    Answer
  • 4.

    The first line of the program package defines the package name in which a Go program should lie.

    1. true

    2. false

    Answer
  • 5.

    Go programming implementations use a traditional compile and link model to generate executable binaries.

    1. true

    2. false

    Answer
  • 6.

    Which of the following is correct about type casting in Go?

    1. Type casting is a way to convert a variable from one data type to another data type.

    2. if you want to store a long value into a simple integer then you can type cast long to int.

    3. Both of the above.

    4. None of the above.

    Answer
  • 7.

    Which of the following is correct about ranges in Go?

    1. The range keyword is used in for loop to iterate over items of an array, slice, channel or map.

    2. With array and slices, it returns the index of the item as integer.

    3. With maps, it returns the key of the next key-value pair.

    4. All of the above.

    Answer
  • 8.

    Which of the following is the default value of a local variable in Go?

    1. Undefined

    2. 0 or nil

    3. Not fixed

    4. None of the above.

    Answer
  • 9.

    Which of the following is true about break statement in Go?

    1. If you are using nested loops (i.e., one loop inside another loop), the break statement will stop the execution of the innermost loop and start executing the next line of code after the block.

    2. If you are using nested loops (i.e., one loop inside another loop), the break statement will stop the execution of the outermost loop and start executing the next line of code after the block.

    3. Both of the above.

    4. None of the above.

    Answer
  • 10.

    Which of the following is true about switch statement in Go?

    1. In expression switch, a case contains expressions which is compared against the value of the switch expression.

    2. In type switch, a case contain type which is compared against the type of a specially annotated switch expression.

    3. Both of the above.

    4. None of the above.

    Answer
  • 11.

    Can you declared multiple types of variables in single declaration in Go?

    1. true

    2. false

    Answer
  • 12.

    Which of the following is true about static type declaration of a variable in Go?

    1. Static type variable declaration provides assurance to the compiler that there is one variable existing with the given type and name.

    2. A variable declaration has its meaning at the time of compilation only, compiler needs actual variable declaration at the time of linking of the program.

    3. Both of the above.

    4. None of the above.

    Answer
  • 13.

    Expressions that refer to a memory location is called "rvalue" expression.

    1. true

    2. false

    Answer
  • 14.

    Go supports generic programming.

    1. true

    2. false

    Answer
  • 15.

    Go supports type inheritance.

    1. true

    2. false

    Answer
  • 16.

    Which of the following is correct about type casting in Go?

    1. Type casting is a way to convert a variable from one data type to another data type.

    2. if you want to store a long value into a simple integer then you can type cast long to int.

    3. Both of the above.

    4. None of the above.

    Answer
  • 17.

    Which of the following function returns the total number of elements present in a slice?

    1. size()

    2. len()

    3. cap()

    4. None of the above.

    Answer
  • 18.

    Which of the following is true about local variables in Go?

    1. Variables that are declared inside a function or block are called local variables.

    2. They can be used only by statements that are inside that function or block of code.

    3. Local variables are not known to functions outside their own.

    4. All of the above.

    Answer
  • 19.

    Which of the following is true about continue statement in Go?

    1. continue forces the next iteration of the loop to take place, skipping any code in between.

    2. It is used in for loop statement.

    3. Both of the above.

    4. None of the above.

    Answer
  • 20.

    Which of the following is true about expression switch statement in Go?

    1. The expression used in a switch statement must have an integral or boolean expression, or be of a class type in which the class has a single conversion function to an integral or boolean value.

    2. If expression is not passed than default value is true.

    3. The constant-expression for a case must be the same data type as the variable in the switch, and it must be a constant or a literal.

    4. All of the above.

    Answer

© 2017 QuizBucket.org