exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 68 discussion

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

Given:

What is the result?

  • A. Area is 6.0
  • B. Area is 3.0
  • C. Compilation fails at line n1
  • D. Compilation fails at line n2.
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
Sreeni_A
5 months, 2 weeks ago
Correct Answer is 6.0
upvoted 2 times
...
Rdharma
7 months, 1 week ago
area is not declared and initialized. So this will cause to a compilation error.
upvoted 1 times
namaoo
4 months, 2 weeks ago
its static variable can be accessed anywhere and default double value is0.0
upvoted 1 times
...
...
Rdharma
7 months, 1 week ago
area is not initialized.
upvoted 1 times
...
CreazyyyyGirl
10 months, 3 weeks ago
Correct answer is A which is 6.0
upvoted 2 times
...
Rajeevkuamr
1 year ago
D. Compilation fails at line n2. The local variables p,b,h may not have been initialized
upvoted 2 times
Kolodets
9 months, 1 week ago
not a problem. The rule is initialize locals before using. We use our locals only if they get initialized (area formula is inside the if-statement). If the If-block not runs, area takes its default value 0.0
upvoted 3 times
...
Kolodets
9 months, 1 week ago
so answer is A
upvoted 2 times
...
...
carloswork
1 year, 3 months ago
Selected Answer: A
Tested. Answer is A.
upvoted 2 times
...
UAK94
1 year, 3 months ago
Answer is A. public class Triangle { static double area; int b=2, h=3; public static void main(String[] args) { double p,b,h; if (area==0) { b=3; h=4; p=0.5; area=p*b*h; } System.out.println(area); } }
upvoted 3 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