+ 1

Q. Consider The Following Statements: int x=22,y=15; Z=(x>y)?(x+y): (x-y);

What will be the value of Z after executing these statement ? 1)22 2)37 3)7 4)Error .cannot be executed.

19th Aug 2017, 3:35 PM
ⓢⓐⓝⓓⓔⓔⓟ
ⓢⓐⓝⓓⓔⓔⓟ - avatar
3 Answers
0
if you have previously declared the variable Z then answer will be 37 else it would be compilation error.
19th Aug 2017, 4:18 PM
Rishabh Agrawal
Rishabh Agrawal - avatar
0
It's 4. c++ is case sensitive. so z and Z are two different variables. Z=37
20th Aug 2017, 7:13 AM
supriya s
0
What is the value of x after these statements execute? int[ ] a = {4, 7, 2}; int x = a[0]+a[2];
3rd Jul 2020, 11:05 AM
Amrita kaur badhan
Amrita kaur badhan - avatar