Computer-Networks
November 15, 2023Question 11269 – Data-Type
November 15, 2023Data-Type
| Question 2 |
Consider the following set of statements?
Float x, y :
x=7;y=10:
x*=y*=y*28.5 : After the execution of the above set of statements, the value of x will be
| 70 | |
| 2695 | |
| 2995 | |
| None of these |
Question 2 Explanation:
Arithmetic operator has the higher precedence so y*28.5 will be calculated first which will give 10*28.5=285.
So now the statement will become x*=y*=285;
The assignment operator has right to left associativity. So now,
x*=(y=y*285)
x*=(y=10*285)
x*=(y=2850)
x=x*2850
x=7*2850
x=19950
So now the statement will become x*=y*=285;
The assignment operator has right to left associativity. So now,
x*=(y=y*285)
x*=(y=10*285)
x*=(y=2850)
x=x*2850
x=7*2850
x=19950
Correct Answer: D
Question 2 Explanation:
Arithmetic operator has the higher precedence so y*28.5 will be calculated first which will give 10*28.5=285.
So now the statement will become x*=y*=285;
The assignment operator has right to left associativity. So now,
x*=(y=y*285)
x*=(y=10*285)
x*=(y=2850)
x=x*2850
x=7*2850
x=19950
So now the statement will become x*=y*=285;
The assignment operator has right to left associativity. So now,
x*=(y=y*285)
x*=(y=10*285)
x*=(y=2850)
x=x*2850
x=7*2850
x=19950
