exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 193 discussion

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

Given:
class Student {
String course, name, city;
public Student (String name, String course, String city) {
this.course = course; this.name = name; this.city = city;
}
public String toString() {
return course + ":" + name + ":" + city;
}
public String getCourse() {return course;}
public String getName() {return name;}
public String getCity() {return city;}
and the code fragment:
List<Student> stds = Arrays.asList(
new Student ("Jessy", "Java ME", "Chicago"),
new Student ("Helen", "Java EE", "Houston"),
new Student ("Mark", "Java ME", "Chicago"));
stds.stream()
.collect(Collectors.groupingBy(Student::getCourse))
.forEach(src, res) -> System.out.println(res));
What is the result?

  • A. A compilation error occurs.
  • B. Java EE Java ME
  • C. [Java EE: Helen:Houston] [Java ME: Jessy:Chicago, Java ME: Mark:Chicago]
  • D. [Java ME: Jessy:Chicago, Java ME: Mark:Chicago] [Java EE: Helen:Houston]
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
fffff
Highly Voted 3 years, 5 months ago
C: [Java EE:Helen:Houston][Java ME:Jessy:Chicago, Java ME:Mark:Chicago] tested
upvoted 7 times
...
steefaand
Most Recent 5 months, 4 weeks ago
Selected Answer: C
C is correct assuming typos.
upvoted 1 times
...
iSnover
5 months, 4 weeks ago
Selected Answer: C
The answer is C, this time it has all the methods correctly.
upvoted 1 times
...
jduarte
3 years, 6 months ago
Answer A. incompile forEach(src, res) -> System.out.println(res));
upvoted 3 times
jduarte
3 years, 3 months ago
but answer is C if correct.
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