All mock tests are FREE till 31 December — register to save your progress
Unit 3 · Programming Concepts & Python HTET 2021 PGT Computer Science

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