exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 104 discussion

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

Given:

What is the result?

  • A. 10 20 30 40
  • B. 0 0 30 40
  • C. Compilation fails.
  • D. An exception is thrown at runtime.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
mvpVN
Highly Voted 5 years, 9 months ago
Correct answer is B
upvoted 13 times
...
MPignaProTech
Most Recent 1 month, 2 weeks ago
Selected Answer: B
B is the correct answer
upvoted 1 times
...
fvelazqueznava
1 year, 2 months ago
Selected Answer: B
B is correct because the new() means that the reference will point to a other object in the heap
upvoted 2 times
...
akbiyik
2 years ago
Selected Answer: B
Each class variable, instance variable, or array component is initialized with a default value when it is created. For example; int[] intArray = new int[10]; This allocates the memory for an array of size 10. This size is immutable. Java populates our array with default values depending on the element type - 0 for integers, false for booleans, null for objects, etc. Let's see more of how we can instantiate an array with values we want. The slow way to initialize your array with non-default values is to assign values one by one:
upvoted 1 times
...
carloswork
2 years, 1 month ago
Selected Answer: B
Answer is B. To test: public static void main(String[] args) { int numbers[]; numbers = new int[2]; numbers [0] = 10; numbers [1] = 20; numbers = new int [4]; numbers [2] = 30; numbers [3] = 40; for (int x : numbers) { System.out.println(" " + x); } }
upvoted 1 times
...
iSnover
2 years, 2 months ago
Selected Answer: B
The correct one is B, because a new reference is given to the numbers list, which overwrites the old one and 30 is added to position 2 and 40 to position 3 of the list, as it was reset, position 0 and 1 had no numbers, so they won the value of 0 because when an int has no reference to a number, 0 is given for the pattern, so when printing the list it outputs "0 0 30 40"
upvoted 3 times
...
nesreenmhd123
4 years, 4 months ago
B is correct.
upvoted 1 times
...
pg13
4 years, 5 months ago
Correct answer is B
upvoted 1 times
...
SamAru
4 years, 5 months ago
Yes the answer is Option B
upvoted 1 times
...
v323rs
4 years, 11 months ago
The correct answer is "B" 0 0 30 40
upvoted 1 times
...
muksa
4 years, 12 months ago
Correct is B
upvoted 1 times
...
rasifer
5 years, 5 months ago
Answer is B, tested.
upvoted 3 times
...
pawankalyan
5 years, 6 months ago
Correct answer is B
upvoted 4 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