Pointers Solved MCQs Questions Answers

20
Score: 0
Attempted: 0/20
1. What is the output of the following code?
int a = 10;
int *p = &a;
cout << *p;




2. Which of the following is the correct syntax to declare a pointer to an integer?



3. What will happen if you try to dereference a null pointer?



4. What is the output of this code?
int a = 5, b = 10;
int *p = &a;
*p = b;
cout << a;




5. What does the & operator do in pointer context?



6. Which of the following will correctly access the value pointed to by pointer p?
int *p;




7. What will the following code print?
int x = 20;
int *p = &x;
*p = *p + 5;
cout << x;




8. Which of the following statements is correct about pointers?



9. What is the output of this code?
int a = 3, b = 4;
int *p = &a, *q = &b;
*p = *p + *q;
cout << a << " " << b;




10. What happens if you increment a pointer?



11. What is wrong with this code?
int *p;
*p = 5;




12. How can you declare a pointer to a pointer?



13. What is the output of this code?
int arr[] = {1,2,3};
int *p = arr;
cout << *(p+1);




14. Which statement is correct?



15. What is the output?
int a = 10;
int *p = &a;
cout << p;




16. What will this code output?
int x = 5;
int *p = &x;
int **q = &p;
**q = 15;
cout << x;




17. Which is the correct way to allocate memory dynamically for an integer?



18. What is wrong in this code?
int *p = NULL;
cout << *p;




19. Output of this code?
int a = 3;
int *p = &a;
int *q = p;
*q = 7;
cout << a;




20. Which statement is true about pointers and arrays?



 

Data Structures MCQs

Basic Concepts

  1. Introduction to Data Structures
  2. Complexity Analysis MCQs

Linear Data Structures MCQs

  1. Arrays MCQs
  2. Linked Lists MCQs
  3. Stacks MCQs
  4. Queues MCQs

Non-Linear Data Structures MCQs

  1. Trees MCQs
  2. Heaps MCQs
  3. Graphs MCQs

Hashing MCQs MCQs

  1. Hash Tables

Sorting and Searching Algorithms MCQs 

  1. Sorting Algorithms MCQs
  2. Searching Algorithms MCQs

Miscellaneous

  1. Memory Management in data structures MCQs
  2. String Manipulation Algorithms MCQs
  1. Data Structures MCQs 1
  2. Data Structures MCQs 2
  3. Data Structures MCQs 3
  4. Data Structures MCQs 4
  5. Data Structures MCQs 5
  6. Stacks Solved MCQs
  7. Queues MCQs
  8. pointer mcqs
  9. Array MCQs

 

Programming C Plus Plus MCQs Homepage

Low-level and high-level languages MCQs

Procedural and non Procedural languages MCQs

C++ STANDARD LIBRARY MCQs

 Array  MCQs 

Arrays MCQs 2

Pointers Solved MCQs

Inline Function MCQs – C++

Top 50 Programming  C++ MCQs 

MCQs of introduction to programming

Past Papers 2022 C++ MCQs

Past Papers 2021 C++ MCQs

Past Papers 2020 C++ MCQs

Past Papers 2019 C++ MCQs

Highly Recommended C++  Important MCQs with Explanation

OOP

OOP intro & examples MCQs

Classes and Inheritance MCQs

Friend Function MCQs

Virtual Function MCQs

Polymorphism MCQs

Polymorphism MCQs 2

shamil memory table

Computer Science Repeated MCQs Book Download

Leave a Reply

Contents Copyrights Reserved By T4Tutorials