Oracle
1Z0-809 · Question #180
1Z0-809 Question #180: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #180. The question stem and answer options stay visible for context.
Question
Given the code fragment:
public static void main(String[] args) {
double discount = 0;
int qty = Integer.parseInt(args[0]);
//line n1
}
And given the requirements:
- If the value of the qty variable is greater than or equal to 90, discount = 0.5
- If the value of the qty variable is between 80 and 90, discount = 0.2 Which two code fragments can be independently placed at line n1 to meet the requirements? A) discount = (qty >= 90) ? 0.5 : 0; B) discount = (qty >= 90) ? 0.5 : (qty >= 80) ? 0.2 : 0; C) if (qty >= 90) { discount = 0.5; } else if (qty >= 80 && qty < 90) { discount = 0.2; } D) discount = (qty >= 90) ? 0.2 : (qty >= 80) ? 0.5 : 0; E) if (qty >= 90) { discount = 0.5; } else if (qty >= 80) { discount = 0.2; } else { discount = 0; }
Options
- AOption A
- BOption B
- COption C
- DOption D
- EOption E
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.