exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 74 discussion

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

Given the code fragment:

What is the result?

  • A. 1:2:3:4:5:
  • B. 1:2:3:
  • C. Compilation fails.
  • D. An ArrayOutOfBoundsException 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
MPignaProTech
2 months, 2 weeks ago
Selected Answer: B
Correct answer is B, code for testing
upvoted 1 times
...
reenarani04325
4 months, 1 week ago
Answer is c because there is space between nums 2= nums 1 that is not same as nums2
upvoted 1 times
...
yanoolthecool
1 year, 1 month ago
Selected Answer: B
An online complier gave me B.
upvoted 1 times
...
Terry8420
1 year, 4 months ago
Answer is B , because array is a object
upvoted 1 times
...
ManuTov
1 year, 4 months ago
Assignment statement `nums2 = nums1`, where there's a space and both arrays will now point to the same memory location.
upvoted 4 times
...
Sreeni_A
1 year, 4 months ago
Answer : B and tested locally
upvoted 1 times
...
pbbvr
1 year, 5 months ago
or C if there is a typo error
upvoted 1 times
...
pbbvr
1 year, 5 months ago
Answer: B
upvoted 1 times
...
dsms
1 year, 5 months ago
Selected Answer: C
Answer C public static void main(String[] args) { int nums1[] = {1, 2 ,3}; int nums2[] = {1, 2, 3 ,4 ,5}; nums 2 = nums 1; // not defined. The variable has a space between nums and 2 for (int i : nums2) { System.out.print(i + ":"); } }
upvoted 3 times
yanoolthecool
1 year, 1 month ago
There's space between the numbers 1 and 2 and the nums
upvoted 1 times
...
...
Kolodets
1 year, 8 months ago
Selected Answer: C
Compilation fails: no variables "num 1" and "num 2" defined
upvoted 3 times
jackymak
1 year, 6 months ago
That maybe correct.
upvoted 1 times
...
...
GaelBernard
1 year, 8 months ago
Selected Answer: B
Tested code provided by rachuk Even though both arrays have different sizes, there's no problem in reassigning their variables. Variables are still nothing else than references to objects.
upvoted 4 times
...
Vicky_65
1 year, 9 months ago
Selected Answer: B
correct one is B
upvoted 1 times
...
CreazyyyyGirl
1 year, 10 months ago
Selected Answer: B
B is correct
upvoted 1 times
...
rachuk
1 year, 11 months ago
Correct answer is B, code for testing: public static void main(String[] args) { int nums1[] = {1, 2 ,3}; int nums2[] = {1, 2, 3 ,4 ,5}; nums2 = nums1; for (int i : nums2) { System.out.print(i + " : "); } }
upvoted 3 times
...
Annie432
1 year, 11 months ago
Selected Answer: A
Ran this program I was surprised with the result but A is correct
upvoted 1 times
...
akbiyik
2 years, 1 month ago
Compilation fails. It should be nums2 instead of nums 2.
upvoted 3 times
...
iSnover
2 years, 3 months ago
B is corrent, in line 3 "nums2" becomes a reference of "nums1".
upvoted 2 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