Skip to content
KALANBLON
Show contents

Chapter 3 of 6 · 10 min

Quiz: organising and processing data

Interfaces, inheritance, collections and streams: let's check that you can organise and process data in Java. You need 70% correct answers.

Quiz

6 questions · pass mark: 70%

  1. 1.When should you choose an interface rather than an abstract class?

    One answer

  2. 2.How many classes can a Java class extend with extends?

    One answer

  3. 3.What does this code print?

    One answer

    List<String> r = List.of("lima", "oslo", "accra", "rome").stream()
        .filter(c -> c.length() == 4)
        .map(String::toUpperCase)
        .sorted()
        .toList();
    IO.println(r);
  4. 4.Complete to count the students in each class.

    Complete the code

    Map<String, Long> n = students.stream()
        .collect(Collectors.____(Student::group, Collectors.counting()));
  5. 5.Which statements about streams are true? (several answers)

    Several answers possible

  6. 6.How do you remove marks below 10 from an ArrayList without an error?

    One answer

Your progress is saved on this device. Create a free account to keep your progress on all your devices.