1.

What will be the output for the following program segments?(Consider all the necessary header files are included)(a) int a=5,b; b=a++;cout«a++<<" ";cout«++b «endl«a+b;(b) int i,j,k, a[ ] ={5,10,15,20}; a[0] =10;for (i=0; i<=2; i++)a[i] = a[0] + i;for (i=3; i>=0;i--;cout« a[i]«" ";

Answer»

(a) 6 6

12

(b) Dryrun

a[10]=10+0=10

a[1]=10+1=11

a[2]=10+2=12

output:

20 12 11 10



Discussion

No Comment Found

Related InterviewSolutions