learngo/07-printf/questions/questions.md

91 lines
1.5 KiB
Markdown
Raw Normal View History

2018-10-13 23:30:21 +03:00
## Which code is correct?
* `fmt.Printf("Hi %s")`
* `fmt.Printf("Hi %s", "how", "are you")`
* `fmt.Printf("Hi %s", "hello")` *CORRECT*
* `fmt.Printf("Hi %s", true)`
## Which code is correct?
* `fmt.Printf("Hi %s %s", "there")`
* `fmt.Printf("Hi %s %s", "5", true)`
* `fmt.Printf("Hi %s %s", "there", ".")` *CORRECT*
* `fmt.Printf("Hi %s %s", "true", false)`
## Which verb is used for an int value?
* %f
* %d *CORRECT*
* %s
* %t
## Which verb is used for a float value?
* %f *CORRECT*
* %d
* %s
* %t
## Which verb is used for a string value?
* %f
* %d
* %s *CORRECT*
* %t
## Which verb is used for a bool value?
* %f
* %d
* %s
* %t *CORRECT*
## Which verb you can use for any type of value?
* %f
* %d
* %v *CORRECT*
* %t
2020-05-20 23:02:31 +07:00
## What does `"\n"` print?
2018-10-13 23:30:21 +03:00
* \n
* Prints a newline *CORRECT*
* Prints an empty string
2020-05-20 23:02:31 +07:00
## What does `"\\n"` print?
2018-10-13 23:30:21 +03:00
* \n *CORRECT*
* Prints a newline
* Prints an empty string
## What does "c:\\secret\\directory" print?
* "c:\\secret\\directory"
* c:\\secret\\directory
* c:\secret\directory *CORRECT*
2020-05-20 23:04:43 +07:00
## What does `"\"heisenberg\""` print?
2018-10-13 23:30:21 +03:00
* ERROR
* heisenberg
* "heisenberg" *CORRECT*
* 'heisenberg'
## What does `fmt.Printf("%T", 3.14)` print?
* ERROR
* int
* float64 *CORRECT*
* string
* bool
## What does `fmt.Printf("%T", true)` print?
* ERROR
* int
* float64
* string
* bool *CORRECT*
## What does `fmt.Printf("%T", 42)` print?
* ERROR
* int *CORRECT*
* float64
* string
* bool
## What does `fmt.Printf("%T", "hi")` print?
* ERROR
* int
* float64
* string *CORRECT*
2020-05-20 23:04:43 +07:00
* bool