Page 1 of 1
About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Fri Sep 08, 2017 9:07 am
by dheeraj426
What will the following code print?
Code: Select all
int x = 1; int y = 2;
int z = x + +;
int a = --y;
int b = z--;
b + = + + z;
int answ = x > a? y > b? y:b:x > z? x:z;
System.out.println( answ);
Re: About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Fri Sep 08, 2017 10:29 am
by admin
What happened when you tried it out?
Also, please put code within
.
Re: About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Tue Jan 09, 2018 12:51 pm
by Sergey
Code: Select all
int answ = (x>a) ? (y>b ? y:b) : (x>z?x:z);
I did not resolve this question at the paper. As for me, it is extremely hard question.
Re: About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Thu Dec 13, 2018 9:17 pm
by OCAJO1
What would you say is good exam taking strategy for time consuming questions like this, figure them out, or leave them for the end?
Re: About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Thu Dec 13, 2018 10:16 pm
by admin
If you are a beginner, then it does take some time to figure it out, so, better to leave it for the end.
Re: About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Thu Jan 16, 2020 11:02 pm
by Nathan777
I got pretty much this exact question with just different variable names on the exam today. Luckily, I just had it right before when I was taking this test at Panera Bread down the road from the testing center.
Re: About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Sun Jan 23, 2022 8:45 am
by brintal
Is there any good strategy to quickly group the elements of nested ternary operators?
E.g. making
Code: Select all
x > a ? (y>b ? y : b) : (x>z ? x : z)
out of
EDIT: figured it out myself. This is a very good explanation:
http://twistedoakstudios.com/blog/Post5 ... -operators
Re: About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Sun Jan 23, 2022 10:55 pm
by admin
Good link. thanks for sharing.
Re: About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Fri Jan 13, 2023 5:44 pm
by SCOTTBART1
Obtuse and deliberately muddy questions, don't see the point, nobody codes like that.
Re: About Question enthuware.ocajp.i.v8.2.1455 :
Posted: Sat Jan 14, 2023 4:04 am
by admin
It true that nobody codes like that but the exam does test your ability to parse through such code.