Grade 7 Exam  >  Grade 7 Test  >  C Programming for Beginners  >  Test: Pointers and Addresses - Grade 7 MCQ

Pointers and Addresses - Free MCQ Practice Test with solutions, Grade 7


MCQ Practice Test & Solutions: Test: Pointers and Addresses (15 Questions)

You can prepare effectively for Grade 7 C Programming for Beginners with this dedicated MCQ Practice Test (available with solutions) on the important topic of "Test: Pointers and Addresses". These 15 questions have been designed by the experts with the latest curriculum of Grade 7 2026, to help you master the concept.

Test Highlights:

  • - Format: Multiple Choice Questions (MCQ)
  • - Duration: 15 minutes
  • - Number of Questions: 15

Sign up on EduRev for free to attempt this test and track your preparation progress.

Test: Pointers and Addresses - Question 1

What will be the output of the following C code?

    #include <stdio.h>
    int main()
    {
        int i = 10;
        void *p = &i;
        printf("%d\n", (int)*p);
        return 0;
    }

Test: Pointers and Addresses - Question 2

What will be the output of the following C code?

    #include <stdio.h>
    int *f();
    int main()
    {
        int *p = f();
        printf("%d\n", *p);
    }
    int *f()
    {
        int *j = (int*)malloc(sizeof(int));
        *j = 10;
        return j;
    }

Test: Pointers and Addresses - Question 3

Comment on the following pointer declaration.

int *ptr, p;

Test: Pointers and Addresses - Question 4

Comment on the following C statement.

const int *ptr;

Test: Pointers and Addresses - Question 5

What will be the output of the following C code?

    #include <stdio.h>
    int main()
    {
        char *p = NULL;
        char *q = 0;
        if (p)
            printf(" p ");
        else
            printf("nullp");
        if (q)
            printf("q\n");
        else
            printf(" nullq\n");
    }

Test: Pointers and Addresses - Question 6

What will be the output of the following C code?

    #include <stdio.h>
    int main()
    {
        int i = 10;
        void *p = &i;
        printf("%f\n", *(float*)p);
        return 0;
    }

Test: Pointers and Addresses - Question 7

What will be the output of the following C code?

    #include <stdio.h>
    int *f();
    int main()
    {
        int *p = f();
        printf("%d\n", *p);
    }
    int *f()
    {
        int j = 10;
        return &j;
    }

Detailed Solution: Question 7

We are returning address of a local variable which should not be done. In this specific instance, we are able to see the value of 10, which may not be the case if we call other functions before calling printf() in main().

Test: Pointers and Addresses - Question 8

What will be the output of the following C code?

    #include <stdio.h>
    int main()
    {
        int *ptr, a = 10;
        ptr = &a;
        *ptr += 1;
        printf("%d,%d/n", *ptr, a);
    }

Test: Pointers and Addresses - Question 9

Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0;)?

Test: Pointers and Addresses - Question 10

What will be the output of the following C code?

    #include <stdio.h>
    int x = 0;
    void main()
    {
        int *const ptr = &x;
        printf("%p\n", ptr);
        ptr++;
        printf("%p\n ", ptr);
    }

Test: Pointers and Addresses - Question 11

What will be the output of the following C code?

    #include <stdio.h>
    void main()
    {
        int x = 0;
        int *ptr = &5;
        printf("%p\n", ptr);
    }

Test: Pointers and Addresses - Question 12

Which is an indirection operator among the following?

Test: Pointers and Addresses - Question 13

What will be the output of the following C code?

    #include <stdio.h>
    int x = 0;
    void main()
    {
        int *ptr = &x;
        printf("%p\n", ptr);
        x++;
        printf("%p\n ", ptr);
    }

Test: Pointers and Addresses - Question 14

What will be the output of the following C code?

    #include <stdio.h>
    void main()
    {
        int x = 0;
        int *ptr = &x;
        printf("%p\n", ptr);
        ptr++;
        printf("%p\n ", ptr);
    }

Test: Pointers and Addresses - Question 15

What will be the output of the following C code?

    #include <stdio.h>
    void main()
    {
        int x = 0;
        int *ptr = &x;
        printf("%d\n", *ptr);
    }

10 videos|14 docs|15 tests
Information about Test: Pointers and Addresses Page
In this test you can find the Exam questions for Test: Pointers and Addresses solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Pointers and Addresses, EduRev gives you an ample number of Online tests for practice
10 videos|14 docs|15 tests
Download as PDF