Question.3
A developer writes a recursive constexpr function:
constexpr
constexpr int fibonacci(int n) { return (n <= 1) ? n : fibonacci(n-1) + fibonacci(n-2); } constexpr int val = fibonacci(50);
What happens?
Select Answer
Computes fibonacci(50) at compile time -- result stored in Flash
fibonacci(50)
Compilation error or timeout -- the compiler hits its constexpr evaluation step limit due to exponential recursion depth
Computes at runtime because 50 is too large
50
Returns 0 -- recursion limit causes default value
0