Courseiva
Java I/O API and Securing ApplicationshardMultiple ChoiceObjective-mapped

1Z0-829 Java I/O API and Securing Applications Practice Question

A large-scale data processing platform uses Java to read and write files across multiple nodes. Recently, operations have slowed down significantly. The system uses FileInputStream and FileOutputStream wrapped in BufferedInputStream and BufferedOutputStream with default buffer sizes (8 KB). The operations team suspects that the default buffer size is causing excessive system calls. The files are typically 100 MB to 1 GB in size. Which change would most improve I/O performance while minimizing memory overhead?

⚠ Common exam trap

Watch out — candidates often assume memory-mapped files or direct buffers are always faster, overlooking that the primary bottleneck in this scenario is excessive system calls due to small buffer size, and that a simple buffer size increase is the most direct and memory-efficient fix.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Increase the buffer size to 64 KB.

Increasing the buffer size to 64 KB reduces the number of system calls (read/write) by allowing more data to be transferred per call. With default 8 KB buffers and 100 MB–1 GB files, the overhead of frequent kernel transitions is significant. A 64 KB buffer strikes a good balance between performance gain and memory overhead, as it is large enough to reduce syscalls substantially without consuming excessive heap space.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Increase the buffer size to 64 KB.

    Why this is correct

    A larger buffer reduces system calls, improving throughput without significant memory increase.

  • Switch to using FileChannel with direct ByteBuffers for all file operations.

    Why it's wrong here

    Direct ByteBuffers can improve performance, but require explicit management and may not be as straightforward as increasing buffer size.

  • Use memory-mapped files (MappedByteBuffer) for the entire file.

    Why it's wrong here

    Memory-mapping large files can cause memory pressure and is not ideal for stream-based processing.

  • Replace FileInputStream with FileReader and FileOutputStream with FileWriter.

    Why it's wrong here

    Character streams are unsuitable for binary data; no performance gain.

About these practice questions

This 1Z0-829 question is part of Courseiva's 513-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.