Class 6 Exam  >  Class 6 Tests  >  Test: Pointers and Addresses - Class 6 MCQ

Test: Pointers and Addresses - Class 6 MCQ


Test Description

15 Questions MCQ Test - Test: Pointers and Addresses

Test: Pointers and Addresses for Class 6 2024 is part of Class 6 preparation. The Test: Pointers and Addresses questions and answers have been prepared according to the Class 6 exam syllabus.The Test: Pointers and Addresses MCQs are made for Class 6 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Pointers and Addresses below.
Solutions of Test: Pointers and Addresses questions in English are available as part of our course for Class 6 & Test: Pointers and Addresses solutions in Hindi for Class 6 course. Download more important topics, notes, lectures and mock test series for Class 6 Exam by signing up for free. Attempt Test: Pointers and Addresses | 15 questions in 15 minutes | Mock test for Class 6 preparation | Free important questions MCQ to study for Class 6 Exam | Download free PDF with solutions
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;
    }

1 Crore+ students have signed up on EduRev. Have you? Download the App
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 for Test: Pointers and Addresses - 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);
    }

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

Top Courses for Class 6

Download as PDF

Top Courses for Class 6