exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 23 discussion

Actual exam question from Oracle's 1z0-808
Question #: 23
Topic #: 1
[All 1z0-808 Questions]

Given the code fragment:

What is the result?

  • A. 100
  • B. 101
  • C. 102
  • D. 103
  • E. Compilation fails
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
RoxyFoxy
Highly Voted 2 years, 3 months ago
Selected Answer: A
d = (a<b)? ((a<c)?a :((b<c)?b : c)) : x a = 100, b = 102, c = 102, d = 100
upvoted 8 times
...
vic88
Most Recent 1 week, 6 days ago
Selected Answer: A
x=103, a=100, b=102, c = 102
upvoted 1 times
...
Skytrix
1 year, 2 months ago
The d part can be brocken down as follows int d = (a<b)? (a<c)?a: (b<c)?b:c: x;
upvoted 1 times
Skytrix
1 year, 2 months ago
Therefore the answer is A
upvoted 1 times
...
...
arjunrawatirissoftware
1 year, 2 months ago
Answer - A
upvoted 1 times
...
sushmitvawal
1 year, 3 months ago
Answer is A. Here is the source code to test: public static void main(String[] args) { int x = 100; int a = x++; //x++ makes x=101 but returns old value so a =100 int b = ++x;// ++x makes x=102 and returns new value so b=102 int c = x++;//x++ makes x=103 but returns old value so c =102 int d = (a < b) ? (a < c) ? a:(b < c) ? b : c : x; //a<b=true-->(a<c)=true-->d=a System.out.println(d); }
upvoted 3 times
...
duydn
1 year, 3 months ago
Selected Answer: A
A is the correct one. x = 103, a = 100, b = 102, c = 102, d = 100
upvoted 1 times
...
Kolodets
1 year, 7 months ago
a=x++ returns value before increasing => a=100
upvoted 1 times
...
Vicky_65
1 year, 8 months ago
Selected Answer: A
A is the correct
upvoted 1 times
...
Ankit1010
1 year, 10 months ago
A is the correct answer
upvoted 1 times
...
haisaco
1 year, 11 months ago
Selected Answer: A
x=100 a=101 b=100 (a<b) false: return x; = 100
upvoted 1 times
...
carloswork
2 years, 1 month ago
Selected Answer: A
Answer is A. Here is the source code to test: public static void main(String[] args) { int x = 100; int a = x++; int b = ++x; int c = x++; int d = (a < b) ? (a < c) ? a:(b < c) ? b : c : x; System.out.println(d); }
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago