Find Output Q.7

0. The following program segment
int a = 10 ;
int const &b = a ;
a = l1 ;
cout << a <<  b ;

  • Option : C
  • Explanation : The very idea of declaring b as a constant integer is to protect it from changes. However, since it is aliased to a variable whose attribute is not const, the value of b can be indirectly changed by changing the value of a. This is a bad programming practice.
Cancel reply

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


Cancel reply

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