Consider the following code, in which $a$ is an array indexed from $0.$
function foo (A, n) {
x=0;
for i=0 to n-1 {
x=A[i]^x;
}
return (x);
}
Here, $a^{\wedge} b$ represents the bitwise Exclusive $\text{OR}$ function over variables $a$ and $b$.
Given integers $a$ and $b,$ we write them in binary, padded by zeros to the left to make them of equal length. We then apply Exclusive $\text{OR}$ to these binary representations bitwise. The operation $a^{\wedge}b$ denotes the integer value obtained by performing bitwise Exclusive $\text{OR}$ on the binary values of $a$ and $b.$ For example, $3^{\wedge} 4 = 011^{\wedge} 100 = 111=7$, and $9^{\wedge} 5 =1001^{\wedge} 0101=1100=12$. The truth table for the Exclusive $\text{OR}$ function is provided below.
$$\begin{array}{|c|c|c|} \hline a & b & a ^{\wedge} \text {b} \\ \hline 0 & 0 & 0 \\ 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \\ \hline \end{array}$$
If $a=[2, 3, 7, 2, 3]$, what will $\textsf{foo (A}, 5)$ return?
- $0$
- $2$
- $3$
- $7$