Programming - Arrays - Discussion

You Are Here :: Home > C++ Language > Arrays - Discussion

 



Q.

What is stored in alpha after the following code executes?
int alpha[5];
int j;
for(j = 0; j < 5; j++)
{
alpha[j] = j + 5;
if(j % 2 == 1)
alpha[j - 1] = alpha[j] + 2;
}                         


A. alpha = {5, 6, 7, 8, 9} B. alpha = {5, 6, 10, 8, 9}
C. alpha = {8, 6, 7, 8, 9} D. alpha = {8, 6, 10, 8, 9}

Answer: Option A
Explaination:

 


No Explanation




Discussion

Your Comments Goes here...
NameDiscussion