Go(Engineering > Computer Science And Engineering ) Questions and Answers

Question 1. 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
Explanation:-
Answer: Option C. -> Both of the above





Question 2. Explain how arrays in GO works differently then C?
  1.    Arrays are values, assigning one array to another copies all the elements
  2.    If you pass an array to a function, it will receive a copy of the array, not a pointer to it
  3.    The size of an array is part of its type. The types [10] int and [20] int are distinct
  4.    All of these
Explanation:-
Answer: Option D. -> All of these





Question 3. List out the built in support in GO?
  1.    Container: container/list , container/heap
  2.    Web Server: net/http
  3.    Cryptography: Crypto/md5 , crypto/sha1
  4.    All of these
Explanation:-
Answer: Option D. -> All of these





Question 4. Which one of the following is correct?
  1.    const Pi = 3.14
  2.    const Pi = math.Pi
  3.    Both A and B are correct
  4.    None of the above
Explanation:-
Answer: Option C. -> Both A and B are correct





Question 5. An lvalue may appear as either the left-hand or right-hand side of an assignment.
  1.    False
  2.    True
  3.    All of these
  4.    None
Explanation:-
Answer: Option B. -> True





Question 6. What are the advantages of GO?
  1.    GO compiles very quickly
  2.    Go supports concurrency at the language level
  3.    Functions are firstclass objects in GO
  4.    All of these
Explanation:-
Answer: Option D. -> All of these





Question 7. Explain workspace in GO?
  1.    src contains GO source files organized into packages
  2.    pkg contains package objects and
  3.    bin contains executable commands
  4.    All of these
Explanation:-
Answer: Option D. -> All of these





Question 8. What are the benefits of using Go Programming?
  1.    Support for environment adopting patterns similar to dynamic languages.
  2.    Compilation time is fast
  3.    InBuilt concurrency support: light-weight processes (via goroutines), channels, select statement
  4.    All of the above
Explanation:-
Answer: Option D. -> All of the above





Question 9. Which of the following is initial value (zero value) for interfaces, slice, pointers, maps, channels and functions?
  1.    0
  2.    ""
  3.    Nil
  4.    False
Explanation:-
Answer: Option C. -> Nil





Question 10. What is the output of the following code snippet?package mainimport "fmt"func main() { x := 1 y := &x fmt.Println(*y) *y = 2 fmt.Println(x)}
  1.    1
  2.    28
  3.    15
  4.    27
Explanation:-
Answer: Option B. -> 28