exam questions

Exam 1z0-811 All Questions

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

Exam 1z0-811 topic 1 question 70 discussion

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

Given the code fragment:

What is the result?

  • A. A compilation error occurs at line n1.
  • B. Jack
  • C. The program prints either Jack or Queen.
  • D. Queen
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
7e8a902
3 weeks ago
Selected Answer: B
both random objects with the same seed value generates same next() value
upvoted 1 times
...
mac_mac2023
1 year, 2 months ago
Selected Answer: B
B is correct
upvoted 1 times
...
CuriosityYen
1 year, 6 months ago
Selected Answer: B
Two instances of the Random class, r1 and r2, are created with the same seed value of 10. The nextInt() method is called on both r1 and r2 to generate random integer values. The if condition compares the results of r1.nextInt() and r2.nextInt(). Since both instances of Random are initialized with the same seed, they will generate the same sequence of random numbers. Therefore, the condition will evaluate to true, and the statement System.out.print("Jack"); will be executed. As a result, "Jack" will be printed to the console.
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