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 + 1;
if(j > 2)
alpha[j - 1] = alpha[j] + 2;
}                         


A. alpha = {1, 5, 6, 7, 5} B. alpha = {1, 2, 3, 4, 5}
C. alpha = {4, 5, 6, 7, 9} D. None of these

Answer: Option B
Explaination:

 


No Explanation




Discussion

Your Comments Goes here...
NameDiscussion