1. 

What will be the output of the program ?

#include<stdio.h>

int main()
{
    int i, a[] = {2, 4, 6, 8, 10};
    change(a, 5);
    for(i=0; i<=4; i++)
        printf("%d, ", a[i]);
    return 0;
}
void change(int *b, int n)
{
    int i;
    for(i=0; i<n; i++)
        *(b+1) = *(b+i)+5;
}


A. 7, 9, 11, 13, 15
B. 2, 15, 6, 8, 10
C. 2 4 6 8 10
D. 3, 1, -1, -3, -5

Answer: Option B

Explanation:

For (i=0; i

* (b+1) = * (b+i) +5;

N=5;

So * (b+1) is the second element. Thus in first iteration value of 2nd element i.e. 4 will become.

For i=0; 2+5=7.

i=1;then (b+1)=4+5=9.
i=2;then (b+2)=6+5=11.
i=3;then (b+3)=8+5=13.
i=4;then (b+4)=10+5=15.

So only change 2 second element hence output : 2 15 6 8 10.