Quiz: Deduce the Outputs
In this lesson your concepts will be evaluated through a quiz.
Choose one correct answer
1
What’s wrong with the following code?
package main
import "container/list"
func (p *list.List) Iter() {
// ...
}
func main() {
lst := new(list.List)
for _ = range lst.Iter() {
}
}
A)
lst
is not a pointer type object
B)
Cannot define new methods on non-local type list.List
C)
lst.Iter
undefined (type *list.List
has no field or method Iter
)
D)
Both B and C
E)
All of the above
Question 1 of 60 attempted
Get hands-on with 1400+ tech skills courses.