Skills101
← All practice quizzes

Quiz: File Handling in Java

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Read and write files the modern way with Path and Files, process big files line by line with BufferedReader and Files.lines, append safely, list folders, and understand byte streams versus character streams.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    Which classes should you use to copy a JPG image file?

  2. Question 2

    What does this print?

    import java.nio.file.*;
    public class Main {
        public static void main(String[] args) throws Exception {
            Path p = Path.of("a.txt");
            Files.writeString(p, "one\n");
            Files.writeString(p, "two\n");
            System.out.println(Files.readAllLines(p));
        }
    }
    
  3. Question 3

    What does BufferedReader.readLine() return at the end of the file?

  4. Question 4

    Why is readAllLines a bad choice for a 5 GB log file?

  5. Question 5

    What is the main benefit of a buffered reader or writer?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →