Skip to content
KALANBLON
Show contents

Chapter 6 of 6 · 10 min

Quiz: files and project

Files, checked exceptions and the report-card project: let's check that your program reads data without losing a single error. You need 70% correct answers.

Quiz

6 questions · pass mark: 70%

  1. 1.Why doesn't this code compile?

    One answer

    void main() {
        IO.println(Files.readString(Path.of("notes.txt")));
    }
  2. 2.To count the lines of a 10 GB log, what should you use?

    One answer

  3. 3.Complete so the file is always closed.

    Complete the code

    ____ (Stream<String> lines = Files.lines(path)) {
        IO.println(lines.count());
    }
  4. 4.In the report-card project, where is it checked that a mark is between 0 and 20?

    One answer

  5. 5.Which practices are good when reading a data file? (several answers)

    Several answers possible

  6. 6.Why avoid == to compare two values read from a Map<String, Double>?

    One answer

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