...

/

Exercise: Deduce the Outputs

Exercise: Deduce the Outputs

In this lesson your concepts will be evaluated through a quiz.

We'll cover the following...

Choose one possible correct answer.

1.

If the following program is written in file main.go, and is executed via the command line as go run main.go Evan Michael Laura what will the output be?

package main
import (
	"fmt"
	"os"
	"strings"
)

func main() {
	who := "World"
	
	if len(os.Args) > 1 { // os.Args[0] == hello_who
		who = strings.Join(os.Args[1:], " ")
	}
	fmt.Println("Hello", who, "!")
}
A.

Hello Evan Michael Laura !

B.

Hello World !

C.

Hello Evan Michael Laura World !


1 / 2

We hope that you performed ...