When you have a value of an interface type,
All of the following is a difference between Go’s switch sta…
All of the following is a difference between Go’s switch statement and the switch statement in C/C++ and Java EXCEPT:
Given the following function signature and function definiti…
Given the following function signature and function definition: func calculate(x int) int func test() { ch := make(chan int) go func() { ch
Assume that variable s has been declared as a string variabl…
Assume that variable s has been declared as a string variable and initialized to a non-empty string literal. Which of the following statement will cause a syntax error? a := s //statement As = ‘B’ //statement B
Which is a valid function in Go that returns the results of…
Which is a valid function in Go that returns the results of swapping two integers?
What is the output of the following Go code block? letter…
What is the output of the following Go code block? letters := string{“Aa”, “Bb”, “Cc”, “Dd”, “Ee”} s1 := letters fmt.Println(s1)
Complete the following Go code block so that it declares gra…
Complete the following Go code block so that it declares grades as a map that maps student names to their grades and print out all student names and their grades (DON’T type unnecessary spaces in your answers): grades := {“Alex”: 93.2, “Bob”: 64.1, “Chris”: 70.5} for := grades { fmt.Printf(“%s has a grade of %0.1f%%\n”, name, grade) } Expected output: Alex has a grade of 93.2% Bob has a grade of 64.1% Chris has a grade of 70.5%
Which of the following statement declares two string variabl…
Which of the following statement declares two string variables named x and y and initializes them to string literals “Hello” and “World” respectively?
Which of the following is an exported name in Go?
Which of the following is an exported name in Go?
Which code block in Go is equivalent to the following C/C++…
Which code block in Go is equivalent to the following C/C++ or Java code block?: int n = 1, factorial =1;while (n < 10){ factorial *= n; n++;}n = 0; Assume every code block is placed in the main function without any other statement.