Class 7 Exam  >  Class 7 Tests  >  Test: C++ Pointers - Class 7 MCQ

Test: C++ Pointers - Class 7 MCQ


Test Description

10 Questions MCQ Test - Test: C++ Pointers

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

The operator used for dereferencing or indirection is ____

Detailed Solution for Test: C++ Pointers - Question 1

* is used as dereferencing operator, used to read value stored at the pointed address.

Test: C++ Pointers - Question 2

Which one of the following is not a possible state for a pointer.

Detailed Solution for Test: C++ Pointers - Question 2

A pointer can be in only 3 states a, b and c.

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: C++ Pointers - Question 3

What will happen in the following C++ code snippet?

   int a = 100, b = 200;
   int *p = &a, *q = &b;
   p = q;

Detailed Solution for Test: C++ Pointers - Question 3

Assigning to reference changes the object to which the reference is bound.

Test: C++ Pointers - Question 4

The correct statement for a function that takes pointer to a float, a pointer to a pointer to a char and returns a pointer to a pointer to a integer is ____________

Detailed Solution for Test: C++ Pointers - Question 4

Function that takes pointer to a float, a pointer to a pointer to a char and returns a pointer to a pointer to a integer is int **fun(float*, char**).

Test: C++ Pointers - Question 5

What will be the output of the following C++ code?

    #include <iostream>
    using namespace std;
    int main()
    {
        char *ptr;
        char Str[] = "abcdefg";
        ptr = Str;
        ptr += 5;
        cout << ptr;
        return 0;
    }

Detailed Solution for Test: C++ Pointers - Question 5

Pointer ptr points to string ‘fg’. So it prints fg.
Output:
$ g++ point.cpp
$ a.out
fg

Test: C++ Pointers - Question 6

What does the following statement mean?

int (*fp)(char*)

Detailed Solution for Test: C++ Pointers - Question 6

The (*fn) represents a pointer to a function and char* as arguments and returning int from the function. So according to that, the above syntax represents a pointer to a function taking a char* as an argument and returning int.

Test: C++ Pointers - Question 7

Choose the right option.

string* x, y;

Detailed Solution for Test: C++ Pointers - Question 7

* is to be grouped with the variables, not the data types.

Test: C++ Pointers - Question 8

Which of the following is illegal?

Detailed Solution for Test: C++ Pointers - Question 8

dp is initialized int value of i.

Test: C++ Pointers - Question 9

What will be the output of the following C++ code?

    #include <iostream>
    using namespace std;
    int main()
    {
        int a = 5, b = 10, c = 15;
        int *arr[ ] = {&a, &b, &c};
        cout << arr[1];
        return 0;
    }

Detailed Solution for Test: C++ Pointers - Question 9

Array element cannot be address of auto variable. It can be address of static or extern variables.

Test: C++ Pointers - Question 10

What will be the output of the following C++ code?

    #include <iostream>
    using namespace std;
    int main()
    {
        char arr[20];
        int i;
        for(i = 0; i < 10; i++)
            *(arr + i) = 65 + i;
        *(arr + i) = '\0';
        cout << arr;
        return(0);
    }

Detailed Solution for Test: C++ Pointers - Question 10

Each time we are assigning 65 + i. In first iteration i = 0 and 65 is assigned. So it will print from A to J.
$ g++ point1.cpp
$ a.out
ABCDEFGHIJ

Information about Test: C++ Pointers Page
In this test you can find the Exam questions for Test: C++ Pointers solved & explained in the simplest way possible. Besides giving Questions and answers for Test: C++ Pointers, EduRev gives you an ample number of Online tests for practice

Top Courses for Class 7

Download as PDF

Top Courses for Class 7