Given the following Go code fragment: type Point struct { X, Y float64}type Integer inttype Test interface{ test()}func (p Point) test() {return }func (n Integer) test() {return }var myTest Test Which of the following Go statements is legal, assuming they are in the same package as the given code fragment?
Blog
What looping construct(s) does Go have?
What looping construct(s) does Go have?
Assuming a package named pkg has a function named print, whi…
Assuming a package named pkg has a function named print, which starts with a lower case letter. Then when you import the pkg package in your program, you can call the function pkg.print.
Assume that variable s has been declared as a slice of integ…
Assume that variable s has been declared as a slice of integers. Which of the following is a Go statement that adds two integers 10 and 20 to the slice s?
Consider the following code fragment in Go that attempts to…
Consider the following code fragment in Go that attempts to define a function: func example(x int) (y int){ y = x+1 return } Which of the following is true about the given code?
Given the following Go code block: func test(n int, s string…
Given the following Go code block: func test(n int, s string) int { return n*len(s)} What is the type of the variable t on the left-hand of the following statement? t := test
Consider the following main function in a Go program which c…
Consider the following main function in a Go program which crashes (panic) eventually: func main(){ fmt.Println(“Start”) defer fmt.Println(“Deferred call”) panic(“Crashed”)} The deferred call in the main function will still be executed when this program is run.
The following Go code block will cause a panic: func main(){…
The following Go code block will cause a panic: func main(){ var f func(string) int fmt.Println(f(“test”))}
Given the following declaration: var s string = “GoLang” Mat…
Given the following declaration: var s string = “GoLang” Match each fmt.Println() statement with its output. Recall that the ASCII code of character ‘G’ is 71, and the ASCII code of character ‘o’ is 111.
Given the following batch jobs Calculate the mean turnaroun…
Given the following batch jobs Calculate the mean turnaround time (MTT) using the Shortest Job First non-preemptive scheduling algorithm. Answer with a number. For example “3.45” or “3”. Priority 0 is the lowest priority.