Back to Learngo

Questions

translation/chinese/07-打印/问题/questions.md

latest1.5 KB
Original Source

哪个代码是正确的?

  • fmt.Printf("Hi %s")
  • fmt.Printf("Hi %s", "how", "are you")
  • fmt.Printf("Hi %s", "hello") 正确
  • fmt.Printf("Hi %s", true)

哪个代码是正确的?

  • fmt.Printf("Hi %s %s", "there")
  • fmt.Printf("Hi %s %s", "5", true)
  • fmt.Printf("Hi %s %s", "there", ".") 正确
  • fmt.Printf("Hi %s %s", "true", false)

哪个动词用于 int 值?

  • %f
  • %d 正确
  • %s
  • %t

哪个动词用于 float 值?

  • %f 正确
  • %d
  • %s
  • %t

哪个动词用于 string 值?

  • %f
  • %d
  • %s 正确
  • %t

哪个动词用于 bool 值?

  • %f
  • %d
  • %s
  • %t 正确

你可以用哪个动词来形容任何类型的值?

  • %f
  • %d
  • %v 正确
  • %t

哪个是 "\n" 正确打印?

  • \n
  • Prints a newline 正确
  • Prints an empty string

哪个是 "\\n" 正确打印?

  • \n 正确
  • Prints a newline
  • Prints an empty string

哪个是 "c:\secret\directory" 正确打印?

  • "c:\secret\directory"
  • c:\secret\directory
  • c:\secret\directory 正确

哪个是 "\"heisenberg\"" 正确打印?

  • ERROR
  • heisenberg
  • "heisenberg" 正确
  • 'heisenberg'

哪个是 fmt.Printf("%T", 3.14) 正确输出?

  • ERROR
  • int
  • float64 正确
  • string
  • bool

哪个是 fmt.Printf("%T", true) 正确输出?

  • ERROR
  • int
  • float64
  • string
  • bool 正确

哪个是 fmt.Printf("%T", 42) 正确输出?

  • ERROR
  • int 正确
  • float64
  • string
  • bool

哪个是 fmt.Printf("%T", "hi") 正确输出?

  • ERROR
  • int
  • float64
  • string 正确
  • bool