Consider the following C++ statements :
int x;
int& y = x;
The statements
y = 25;
x = 2*x + 30;
update the value of x and y as :
निम्नलिखित C++ कथनों पर विचार करें :
int x;
int& y = x;
कथन
y = 25;
x = 2*x + 30;
x और y के मान को अपडेट करता है :
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. y = 80, x = 80
Explanation
y is a reference (alias) of x. y = 25 makes x = 25; then x = 2 × 25 + 30 = 80, and y shows the same 80.
y, x का रेफरेंस (उपनाम) है। y = 25 से x = 25; फिर x = 2 × 25 + 30 = 80, और y भी 80।
More Programming Concepts & Python questions
- Which symbol should be used to pass the object by reference in C++ ?
- What is meant by multiple inheritance ?
- A generic function can be created using the following :
- Inheritance allows the following in C++ program :
- Which of the following is the scope resolution operator in C++ language ?
- In C++, << operator used for shifting bits can also be used for :