C++ Pointer to Void MCQ (MULTIPLE CHOICE QUESTIONS)

We have already covered C++ Comments and Indentation questions in the last set of MCQs. There, we have discussed some good questions. This set of MCQ(multiple choice questions focuses) on the C++ Pointer to Void questions.

You should practice these interview questions to improve C++ programming skills needed for various interviews (like company interview, campus interview, walk-in interview), entrance exams, placements and other competitive exams. All the questions in this particular section are based on only “C++ Pointer to Void MCQ“.

Instructions to be followed:-

  1. Read all the questions carefully.
  2. Out of the 4 given options for each questions, only ONE option will be correct.
  3. Choose the appropriate option.
  4. After attempting all the questions, click on “Finish” button to check the score.
  5. Share your result on social media handles available.

If you are not satisfied with your result or wants to attempt the Quiz again, don’t worry, you can try it again at the end (by refreshing the page). You can use Previous and Next button to switch to a different set of questions.

C++ Pointer to Void MCQ
C++ POINTER TO VOID MCQ

C++ MCQ | POINTER TO VOID

NOTE: You can check your answer immediately by selecting an option.

Now, start attempting the quiz.

C++ Pointer to Void MCQ Questions

#1. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main()
{
   int *p;
   void *vp;
   if (vp == p);
     cout << "equal";
   return 0;
}

#2. What we can’t do on a void pointer?

#3. A void pointer cannot point to which of these?

#4. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int func(void *Ptr);
int main()
{
    char *Str = "abcdefghij";
    func(Str);
    return 0;
}
int func(void *Ptr)
{
    cout << Ptr;
    return 0;
}

#5. What will be the output of the following C++ code?

#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;
}

#6. When does the void pointer can be dereferenced?

#7. The void pointer can point to which type of objects?

#8. What will be the output of the following C++ code?

#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;
}

#9. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main()
{
    int n = 5;
    void *p = &n;
    int *pi = static_cast(p);
    cout << *pi << endl;
    return 0;
}

#10. The pointer can point to any variable that is not declared with which of these?

Finish

Results

<< Prev- C++ MCQs : Comments and Indentation

>> Next- C++ MCQ : Functions


Wants to learn more about C++ Programming? If yes, then don’t forget to explore all the topics of C++ programming. Here, is the complete set of Multiple Choice Questions and Answers. You should learn all the questions available there. These questions are very helpful for the preparation of placements, Competitive Exams and University level exams.

Learn about 404 ERROR page – EVERYTHING YOU NEED TO KNOW ABOUT 404 ERROR PAGE FOR SEO

For frontend projects, check and implements these beginner’s friendly projects :- TOP 7 PROJECTS FOR BEGINNERS TO PRACTICE HTML & CSS SKILLS

Learn about UML: WHAT IS UML?

ROLE OF UML IN OOAD(OBJECT-ORIENTED ANALYSIS AND DESIGN)

Do practice of HTML questions :- Multiple choice questions on HTML

Do practice of C programming :- Multiple choice questions on C programming

Want backlinks to your website? If yes, then follow this article and get to know in very easy way. How You Can Create High Quality Backlinks In 2021?

The above question set contains all the correct answers. But in any case, you find any typographical, grammatical or any other error in our site then kindly inform us. Don’t forget to provide the appropriate URL along with error description. So that we can easily correct it.

Thanks in advance.

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.

Leave a Comment

Your email address will not be published. Required fields are marked *