adplus-dvertising

Welcome to the Pointers,Arrays and Structures in C++ MCQs Page

Dive deep into the fascinating world of Pointers,Arrays and Structures in C++ with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Pointers,Arrays and Structures in C++, a crucial aspect of Object Oriented Programming Using C++. In this section, you will encounter a diverse range of MCQs that cover various aspects of Pointers,Arrays and Structures in C++, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Object Oriented Programming Using C++.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Pointers,Arrays and Structures in C++. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Object Oriented Programming Using C++.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Pointers,Arrays and Structures in C++. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Pointers,Arrays and Structures in C++ MCQs | Page 6 of 17

Q51.
What is the output of this program?
    #include <iostream>
    using namespace std;
    int main()
    {
        int *p;
        void *vp;
        if (vp == p);
            cout << "equal";
        return 0;
    }
Discuss
Answer: (a).equal
Q52.
What is the output of this program?
    #include <iostream>
    using namespace std;
    int main()
    {
        int i;
        char c;
        void *data;
        i = 2;
        c = 'd';
        data = &i;
        cout << "the data points to the integer value" << data;
        data = &c;
        cout << "the data now points to the character" << data;
        return 0;
    }
Discuss
Answer: (b).two memory addresses
Q53.
What is the output of this program?
    #include <iostream>
    using namespace std;
    int main()
    {
        int n = 5;
        void *p = &n;
        int *pi = static_cast<int*>(p);
        cout << *pi << endl;
        return 0;
    }
Discuss
Answer: (a).5
Q54.
What is the output of this program?
    #include <iostream>
    using namespace std;
    int main()
    {
        int a = 5, c;
        void *p = &a;
        double b = 3.14;
        p = &b;
        c = a + b;
        cout << c << '\n' << p;
        return 0;
    }
Discuss
Answer: (a).8, memory address
Discuss
Answer: (a).pointer arithemetic
Q56.
The data elements in structure are also known as what?
Discuss
Answer: (b).members
Q57.
What will be used when terminating a structure?

a.

:

b.

}

c.

;

d.

;;

Discuss
Answer: (c).;
Discuss
Answer: (a).it will not allocate any memory
Q59.
The declaration of structure is also called as?
Discuss
Answer: (c).structure specifier
Q60.
What is the output of this program?
    #include <iostream>
    #include <string.h>
    using namespace std;
    int main()
    {
        struct student 
        {
            int num;
            char name[25];
        };
        student stu;
        stu.num = 123;
        strcpy(stu.name, "John");
        cout << stu.num << endl;
        cout << stu.name << endl;
        return 0;
    }
Discuss
Answer: (a).123john
Page 6 of 17

Suggested Topics

Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!