Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions