Pointers to pointers — C++ MCQs

20
Score: 0
Attempted: 0/20
1. What is a pointer to pointer?



2. How do you declare a pointer to pointer for an int?



3. If int a = 5; int *p = &a; int **q = &p;, what does **q give?



4. Which of the following is correct to assign pointer to pointer?



5. What is output of the code?
int a = 10;
int *p = &a;
int **q = &p;
cout << *p << " " << **q;




6. Pointer to pointer is useful for



7. How do you declare a pointer to pointer to pointer (triple pointer)?



8. Which of the following is INCORRECT?



9. If int a=7; int *p=&a; int **q=&p; which of the following changes the value of a?



10. What does q store in int **q = &p;?



11. How do you pass a pointer to a function so that it can modify the original pointer?



12. Which of the following is TRUE?



13. Output of the code?
int a=3;
int *p=&a;
int **q=&p;
cout << p << " " << *q;




14. What type should a function parameter have to modify a pointer?



15. How to access the value of variable a using pointer to pointer?



16. Which of the following declarations is valid?



17. If int a=1, *p=&a, **q=&p; what does *q store?



18. Which of the following increments pointer to pointer?



19. Can a pointer to pointer point to NULL?



20. Which statement is correct about pointer to pointer?



Contents Copyrights Reserved By T4Tutorials