Exercise: Deduce the Outputs
Explore practical exercise on deducing outputs based on Go error-handling concepts to reinforce stability techniques before advancing to concurrency and parallelism.
We'll cover the following...
We'll cover the following...
Choose one possible correct answer.
1.
What is the outcome of a program calling the recursive function f with value 5?
func f(n int) {
defer func() { fmt.Println(n) }()
if n == 0 {
panic(0)
}
f(n-1)
}
A.
0
1
2
3
4
5
B.
5
4
3
2
1
0
C.
Throws a panic
D.
Both A and C
1 / 3
We hope that you performed ...