Question: QUESTION 9 What will be the output of following code snippet? int a[3] = {1, 2, 3}; int *p = a; int **r = &p;

QUESTION 9

  1. What will be the output of following code snippet?

    int a[3] = {1, 2, 3};

    int *p = a;

    int **r = &p;

    printf("%p %p", *r, a);

    A.

    Different memory addresses printed

    B.

    1 2

    C.

    Same memory address printed twice

    D.

    1 1

2 points

QUESTION 10

  1. What will be the output of following code snippet?

    int arr[4] = {1, 2, 3, 4};

    int *p;

    p = arr + 3;

    *p = 5;

    printf("%d ", arr[3]);

    A.

    5

    B.

    4

    C.

    3

    D.

    Compile-time Error

2 points

QUESTION 11

  1. Which of the following statements is correct about the following code snippet?

    int i = 5;

    int *j = &i;

    A.

    j and i are pointers to an int.

    B.

    i is a pointer to an int and stores the address of j.

    C.

    j is a pointer to an int and stores the address of i.

    D.

    j is a pointer to a pointer to an int and stores address of i.

2 points

QUESTION 12

  1. What will be the output of following program?

    #include

    void change(int*, int);

    int main()

    {

    int i, arr[] = {2, 4, 6, 8, 10};

    change(arr, 5);

    for(i=0; i<=4; i++)

    printf("%d, ", arr[i]);

    return 0;

    }

    void change(int *b, int n)

    {

    int i;

    for(i=0; i

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

    }

    A.

    7, 9, 11, 13, 15,

    B.

    2, 4, 6. 8. 10,

    C.

    5, 5, 5, 5, 5,

    D.

    2, 15, 6, 8, 10,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!