OA. free
Free
Capgemini Quantitative Aptitude Quantitative Aptitude Medium

Consider following given code and predict its output.

Capgemini aptitude question with a worked answer. Free to practise - no sign-up.

Consider following given code and predict its output.  
main()  
{  
int num[ ] = {1,4,8,12,16};  
int *a,*b;  
int i;  
a=num;  
b=num+2;  
i=*a+1;  
printf("%d,%d,%d\n",i,*a,*b);  
}

Choose one option.
Show answer & explanation
Answer: A. A) 2,1,8

The correct option is A: '2,1,8'.