Home / CSE MCQs / GO ::

CSE MCQs :: GO

  1. Which of the following is true about static type declaration of a variable in Go?
  2. A.
    Static type variable declaration provides assurance to the compiler that there is one variable existing with the given type and name
    B.
    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
    C.
    Both of the above
    D.
    None of the above

  3. List out the built in support in GO?
  4. A.
    Container: container/list , container/heap
    B.
    Web Server: net/http
    C.
    Cryptography: Crypto/md5 , crypto/sha1
    D.
    All of these

  5. Explain how arrays in GO works differently then C?
  6. A.
    Arrays are values, assigning one array to another copies all the elements
    B.
    If you pass an array to a function, it will receive a copy of the array, not a pointer to it
    C.
    The size of an array is part of its type. The types [10] int and [20] int are distinct
    D.
    All of these

  7. An lvalue may appear as either the left-hand or right-hand side of an assignment.
  8. A.
    False
    B.
    True
    C.
    All of these
    D.
    None

  9. Which one of the following is correct?
  10. A.
    const Pi = 3.14
    B.
    const Pi = math.Pi
    C.
    Both A and B are correct
    D.
    None of the above

  11. Explain workspace in GO?
  12. A.
    src contains GO source files organized into packages
    B.
    pkg contains package objects and
    C.
    bin contains executable commands
    D.
    All of these

  13. What are the advantages of GO?
  14. A.
    GO compiles very quickly
    B.
    Go supports concurrency at the language level
    C.
    Functions are firstclass objects in GO
    D.
    All of these

  15. What are the benefits of using Go Programming?
  16. A.
    Support for environment adopting patterns similar to dynamic languages.
    B.
    Compilation time is fast
    C.
    InBuilt concurrency support: light-weight processes (via goroutines), channels, select statement
    D.
    All of the above

  17. What is the output of the following code snippet?
    package main
    import "fmt"
    func main() {
     x := 1
     y := &x

     fmt.Println(*y)

     *y = 2
     fmt.Println(x)

    }
  18. A.
    1
    B.
    28
    C.
    15
    D.
    27