Home MCQs CSS Computer Science Question #1126
Back to Questions
CSS Computer Science QUESTION #1126
Question 1
What is the output of the following code? int a=40; int* ptr=&a; int& ref = *ptr; ref = 60; cout << a;
  • 40
  • 60✔️
  • Error
  • None of these
Correct Answer Explanation
The reference ref is bound to variable a through the pointer. Changing ref to 60 directly updates the memory value of a. Thus, cout << a prints 60.