For each node having (root → left == NULL && root → right == NULL) i.e. LEAF NODE program returns 10.
So the value foobar computes is 10*(number of leaves of the binary tree)
Hence, D is the correct answer.
In a similar fashion, if you replace return(i+j) with return(i+j+$A$) it will compute $A$*(number of internal nodes of the binary tree)
where, $A$ is any constant