1Z0-829 · domain
Java I/O API and Securing Applications
Practise Oracle Certified Professional Java SE 17 Developer 1Z0-829 Java I/O API and Securing Applications practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.
Focused practice
Practice Java I/O API and Securing Applications questions
Scored sessions drawing only from this domain — pick a length below.
Start 20-question practice test →What this domain covers
What to know about Java I/O API and Securing Applications
Java I/O API and Securing Applications questions test whether you can apply the concept in context, not just recognise a definition.
How the topic appears in realistic exam-style scenarios.
Which detail in the question changes the correct answer.
How to eliminate plausible but wrong options.
How to connect the question back to the wider exam objective.
Watch out for
Common Java I/O API and Securing Applications exam traps
- ▸Answering from memory before reading the full scenario.
- ▸Missing a constraint such as cost, availability, security, scope or command context.
- ▸Choosing a broad answer when the question asks for the most specific fix.
- ▸Ignoring why the wrong options are tempting.
Question index
All Java I/O API and Securing Applications questions (80)
Click any question to see the full explanation, or start a practice session above.
A developer needs to write text to a file with UTF-8 encoding. Which class should be used?
Easy2Which TWO statements are true regarding reading files with the NIO.2 API?
Medium3A financial services company runs a Java 17 application on a server with 8 GB RAM. The application reads daily transaction files in CSV format (each file is about 500 MB). It processes each line, validates it against a SQL database, and writes results to an output file. Recently, after processing about 60% of a file, the application crashes with an OutOfMemoryError: Java heap space. The heap size is set to 2 GB. The code uses Files.readAllLines() to load the entire file into a List<String>, then iterates. The team is evaluating solutions to avoid memory issues. Which approach is the best course of action?
Hard4Which THREE statements are true about Java NIO.2 and its interaction with blocking I/O? (Choose three.)
Medium5An application must read a configuration file that is updated frequently by another process. The developer wants to avoid stale data and minimize I/O operations. Which approach is best?
Hard6Which TWO are true about the try-with-resources statement?
Easy7Which TWO practices improve the security of Java serialization?
Medium8A Java application running on a server reads configuration from a file 'config.properties' located in the same directory as the JAR. The application uses java.util.Properties.load(InputStream) to read the file. Recently, the file was modified by an unauthorized user, and the application started throwing runtime exceptions due to corrupted property values. The security team requires that the file be protected from unauthorized modifications while still being readable by the application. Which action should be taken to ensure the integrity of the configuration file?
Easy9Which THREE statements about the SecurityManager and security policies in Java 17 are true? (Choose three.)
Hard10Which is the best practice for securing a Java application that reads sensitive configuration files?
Easy11A developer needs to read a very large text file (over 1 GB) efficiently with minimal memory overhead. Which approach is most suitable?
Medium12Refer to the exhibit. What is the purpose of this code?
Easy13A class that stores sensitive user data implements Serializable. To minimize security exposure from deserialization attacks, which modification is the best practice?
Medium14Which class is best suited for reading integer tokens from a string containing space-separated integers?
Easy15Refer to the exhibit. A developer runs a keytool command and sees the output above. Which command produced this output?
Medium16Refer to the exhibit. What is the most likely cause of this exception?
Hard17A web server application writes access logs to a file. To ensure that log entries are written to disk immediately even if the JVM crashes, which approach is most appropriate?
Medium18Refer to the exhibit. Which algorithm was used to generate the certificate fingerprint shown?
Easy19A Java application writes sensitive user data to a file. To ensure that data is not left in the file system after the application crashes, which practice should be followed?
Easy20A web application allows users to specify filenames for uploaded documents. The application saves files to a directory using the provided name. Which secure programming practice should be applied to prevent path traversal attacks?
Easy21Which TWO statements about Java serialization are true?
Hard22Refer to the exhibit. A Java application is deployed in /opt/app/lib/ and attempts to perform the following operations: 1) Read the file /data/config/settings.xml 2) Write to the file /logs/app.log 3) Read the file /data/config/subdir/extra.conf Which statement is true?
Medium23A developer wants to traverse a directory tree to find all files that are symbolic links. Which NIO.2 method should be used to follow symbolic links during traversal?
Medium24A class implements Serializable. Which modification ensures that a specific field (password) is not included in the serialized stream?
Medium25Which THREE are valid ways to read the contents of a text file into a String in Java?
Hard26A serialized object has an explicitly declared serialVersionUID of 123L. After a code change, a new field is added to the class but the serialVersionUID is left unchanged. What happens when deserializing an old stream?
Hard27Which resource declaration order in try-with-resources is valid when both a FileInputStream and a BufferedInputStream wrapping it need to be closed automatically?
Easy28Which two statements are true about FileInputStream? (Select two.)
Hard29A developer is tasked with reading a large binary file (1 GB) from a network share using the least amount of memory possible. Which approach should be used?
Medium30A Java application uses FileChannel to copy a file to a remote network drive. The developer wants to ensure atomic file replacement on the destination. Which approach is correct?
Hard31Which of the following correctly uses try-with-resources to ensure a FileInputStream is closed after use?
Easy32Refer to the exhibit. A security policy file is configured as shown. The application in app.jar tries to read a file named "${user.home}/data/db.properties". What is the result?
Hard33A financial application deserializes objects received over the network using ObjectInputStream. To prevent deserialization attacks, which secure coding practice should be implemented?
Medium34In a JAAS login module, after the login() method returns true, which method must be called to commit the authentication and add principals to the Subject?
Hard35A financial trading application processes real-time stock data from multiple exchanges. The application reads large binary files (each up to 500 MB) containing trade records, processes them, and writes summary reports to a shared network drive. The development team observes that the application occasionally throws a java.io.IOException: 'The process cannot access the file because it is being used by another process' when writing reports. The application is multi-threaded, and each thread writes to a separate file in the same directory. The team also notices that the application slows down significantly when the network drive is under heavy load. The application runs on Windows servers with Java 17. The code uses FileOutputStream for writing and does not explicitly close streams in some paths. Which course of action should the team take to resolve the issues and improve performance?
Hard36Which TWO statements about java.io and java.nio.file packages are true?
Medium37What is the output?
Hard38Which two of the following are valid methods to create a new directory using the NIO.2 Files class? (Select two.)
Easy39Which class provides a convenient means to read text from a file line by line?
Easy40A 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?
Hard41A Java application running in a secure environment needs to read a file located outside the application's directory. Which approach correctly handles security?
Medium42A developer needs to create a temporary file that will be automatically deleted when the JVM terminates. Which approach correctly achieves this?
Easy43A developer is writing a utility to copy a large binary file (e.g., 500 MB) from one location to another while minimizing memory overhead and ensuring data integrity. Which approach is most appropriate?
Medium44Which interface should be implemented to create a custom filter for deserialization in Java?
Easy45Which three actions help secure a Java application that uses serialization? (Select three.)
Hard46A company uses serialization to transfer objects between microservices. To prevent deserialization attacks, they want to restrict which classes can be deserialized. Which approach should be used in Java 17?
Medium47A developer is building a file synchronization tool that runs on multiple threads. Multiple threads may read and write to the same file concurrently. The developer wants to ensure that a thread does not read a file while another thread is writing to it, and that concurrent reads are allowed. Which locking mechanism should be used?
Medium48You are developing a Java application that processes sensitive user data. The application runs on a server with strict security policies. You need to read configuration properties from a file located at /etc/app/config.properties. The application uses a SecurityManager. During testing, you get a security exception: java.security.AccessControlException: access denied (java.io.FilePermission /etc/app/config.properties read). You have already added a file permission grant in the policy file for the application codebase. However, the exception persists. What is the most likely cause?
Easy49A Java application needs to refer to a file using the path "data/input.txt". To ensure platform independence (correct file separator), which approach is recommended?
Hard50A Java application uses SecurityManager with a policy file. Which permission is required to allow the application to read all files in the /var/log directory, including subdirectories?
Medium51A web application allows users to upload profile pictures. The application saves the files to a directory using the original filename provided by the user. After a security review, the team discovered a critical path traversal vulnerability. Which remediation is most effective in preventing exploitation while maintaining usability?
Easy52Which TWO are secure coding practices for Java I/O that help prevent resource leaks and unauthorized access? (Choose two.)
Hard53A Java application reads configuration from a file using FileInputStream. The application must handle the case where the configuration file is missing by logging a warning and using default values. Which design approach best meets this requirement?
Medium54A developer is building a batch processing application that reads a large CSV file (approx. 5 GB) from a network file system, transforms each row, and writes the result to a database. The initial implementation uses Files.lines(path) to obtain a Stream<String>, processes each line with forEach, and then does not explicitly close the stream. After running for several minutes, the application slows down, and eventually throws an IOException: 'Too many open files'. The database writes are also failing intermittently. The developer needs to fix the application. The environment is Java 17 on Linux with default settings. Which course of action best resolves the issues?
Hard55Which TWO approaches are recommended to secure Java I/O operations? (Choose two.)
Easy56A method receives an InputStream and needs to compute its MD5 hash while reading the data. Which approach is most efficient?
Medium57An application deserializes objects from a network stream. To protect against deserialization attacks, which approach is most effective in Java 17?
Hard58Which THREE are benefits of using the NIO.2 API over the java.io API?
Medium59Refer to the exhibit. Assuming the application is running from /home/application/lib/myapp.jar, which of the following actions is allowed by the policy?
Medium60Which interface is designed for recursively walking a file tree?
Easy61Which TWO secure coding practices should be followed when developing a Java application that handles user input? (Choose two.)
Medium62A developer needs to read a large text file (several gigabytes) line by line as efficiently as possible, processing each line without loading the entire file into memory. Which approach should the developer use?
Easy63A developer wants to copy all files from one directory to another, preserving file attributes (e.g., last modified time, permissions). Which NIO.2 method is most appropriate?
Medium64A logging framework in Java has been writing logs to a file using a FileWriter with default buffer size. The logs are frequently lost when the application crashes because the buffer is not flushed. Which change ensures that log messages are written immediately without significantly impacting performance?
Medium65Order the steps to create an immutable class in Java.
Medium66Given a requirement to efficiently copy a large file (over 2 GB) from one path to another, which approach is most appropriate for Java NIO.2?
Hard67Match each concurrency utility to its purpose.
Medium68A company needs to read a large text file (over 2 GB) line by line in a Java application while minimizing memory footprint. Which approach is most efficient?
Medium69A class implements Serializable but the developer wants to completely prevent deserialization of its instances. Which approach accomplishes this?
Hard70An architect is designing a microservice that reads large CSV files (up to 500 MB) from a shared filesystem and processes each row. The processing is CPU-bound and must not block the main thread. The service is deployed in a container with limited memory (512 MB heap). Which approach is most suitable?
Hard71Which statement about java.io and java.nio.file packages is true?
Easy72A developer needs to copy a large directory tree from one location to another, preserving file attributes. Which method should be used?
Medium73Which THREE are recommended practices to prevent privilege escalation when using doPrivileged in a security-sensitive Java application?
Hard74Which TWO statements are true about securing a Java application?
Medium75Refer to the exhibit. Which of the following best describes the effective permissions granted to the application?
Medium76Refer to the exhibit. What is the most likely cause of this exception?
Hard77To generate a cryptographically secure random number for a key generation algorithm, which class should be used?
Medium78A developer is designing a service that processes multiple files concurrently. To avoid resource leaks, which practice is essential?
Hard79A developer needs to read all lines from a text file named "data.txt" that uses UTF-8 encoding. Which code correctly reads the file using the NIO.2 API?
Easy80Which class from the java.nio.file package is most appropriate for efficiently transferring data between two channels on the same machine?
MediumOther domains
All 1Z0-829 exam domains
Frequently asked questions
- What does the Java I/O API and Securing Applications domain cover on the 1Z0-829 exam?
- Java I/O API and Securing Applications questions test whether you can apply the concept in context, not just recognise a definition.
- How many questions are in this domain?
- This page lists all 80 Java I/O API and Securing Applications questions in the 1Z0-829 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
- What is the best way to practise this domain?
- Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
- Can I practise only Java I/O API and Securing Applications questions?
- Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.