GATE CS 2021, set 1 · Question 58 · Programming and Data Structures · Numerical answer (NAT) · 2 marks · no negative marks
Consider the following ANSI C function:
int SimpleFunction(int Y[], int n, int x) { int total = Y[0], loopIndex; for (loopIndex = 1; loopIndex <= n - 1; loopIndex++) total = x * total + Y[loopIndex]; return total; }
Let Z be an array of 10 elements with Z[i]=1, for all i such that 0 ≤ i ≤ 9. The value returned by SimpleFunction(Z, 10, 2) is ______.
Answer
Answer 1023
Answer from the official GATE CS 2021 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes