Q7Numerical5 Marks13 Apr 2025
What will the value of S be at the end of the execution of the following pseudocode?
```
L = [5, 3, 2, -1]
S = calculateSum(L)
Procedure calculateSum(X)
if(length(X) == 0){
return(0)
}
if(length(X) == 1){
return(first(X))
}
return(first(X) * last(X) + calculateSum(rest(init(X))))
End calculateSum
```
Press Enter to check.