GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Sending on a closed channel will cause ______.

Sending on a closed channel will cause ______.

Read Details

What is the output of the following Go code block?   letter…

What is the output of the following Go code block?   letters := [5]string{“Aa”, “Bb”, “Cc”, “Dd”, “Ee”}   s1 := letters[1:3]   fmt.Println(s1)

Read Details

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?

Read Details

Which  is an interpreted string literal equivalent to the fo…

Which  is an interpreted string literal equivalent to the following raw string literal?: `Learn more about “Go” at https://go.dev`

Read Details

Determine the output of each fmt.Println() statement in the…

Determine the output of each fmt.Println() statement in the following Go code block by selecting the correct answer at the end of the fmt.Println() statement.     s := []int{11, 12, 13, 14, 15, 16}   s = s[:0]   fmt.Println(“len=”, len(s), “cap=”, cap(s)) //output: [output2]    s = s[:5]   fmt.Println(“len=”, len(s), “cap=”, cap(s)) //output: [output3]    s = s[3:]   fmt.Println(“len=”, len(s), “cap=”, cap(s)) //output: [output4]

Read Details

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:

Read Details

Consider the following Go code block: var names = []string{“…

Consider the following Go code block: var names = []string{“Alex”, “Bob”, “Chris”}for _, s := range names{ fmt.Printf(“%s,”, s) /* note: no space after the comma in the format string */} Write the output of the code block above exactly as it appears on screen: [output]

Read Details

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?

Read Details

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.

Read Details

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 := [maptype]{“Alex”: 93.2, “Bob”: 64.1, “Chris”: 70.5}   for [namegrade] := [range] 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%

Read Details

Posts pagination

Newer posts 1 … 32,867 32,868 32,869 32,870 32,871 … 92,022 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top