Practice 1Z0-829 Java I/O API and Securing Applications questions with full explanations on every answer.
Start practicing
Java I/O API and Securing Applications — choose a session length
Free · No account required
Click any question to see the full explanation and answer options, or start a focused practice session above.
A 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?
2A 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?
3An 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?
4A developer needs to write text to a file with UTF-8 encoding. Which class should be used?
5A Java application running in a secure environment needs to read a file located outside the application's directory. Which approach correctly handles security?
6A developer is designing a service that processes multiple files concurrently. To avoid resource leaks, which practice is essential?
7Which statement about java.io and java.nio.file packages is true?
8A developer needs to copy a large directory tree from one location to another, preserving file attributes. Which method should be used?
9Which TWO statements are true about securing a Java application?
10Which THREE are valid ways to read the contents of a text file into a String in Java?
11Which TWO are true about the try-with-resources statement?
12Which THREE are benefits of using the NIO.2 API over the java.io API?
13A 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?
14A 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?
15Which TWO statements about Java serialization are true?
16You 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?
17Which TWO statements about java.io and java.nio.file packages are true?
18What is the output?
19A 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?
20Order the steps to create an immutable class in Java.
21Match each concurrency utility to its purpose.
22A 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?
23A 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?
24Given 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?
25Which resource declaration order in try-with-resources is valid when both a FileInputStream and a BufferedInputStream wrapping it need to be closed automatically?
26A 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?
27A developer needs to create a temporary file that will be automatically deleted when the JVM terminates. Which approach correctly achieves this?
28A method receives an InputStream and needs to compute its MD5 hash while reading the data. Which approach is most efficient?
29A 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?
30A 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?
31Which two of the following are valid methods to create a new directory using the NIO.2 Files class? (Select two.)
32Which two statements are true about FileInputStream? (Select two.)
33Which three actions help secure a Java application that uses serialization? (Select three.)
34Refer to the exhibit. Assuming the application is running from /home/application/lib/myapp.jar, which of the following actions is allowed by the policy?
35Refer to the exhibit. What is the most likely cause of this exception?
36Refer to the exhibit. What is the purpose of this code?
37A developer needs to read a very large text file (over 1 GB) efficiently with minimal memory overhead. Which approach is most suitable?
38A class implements Serializable but the developer wants to completely prevent deserialization of its instances. Which approach accomplishes this?
39Which class is best suited for reading integer tokens from a string containing space-separated integers?
40A 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?
41A 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?
42A 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?
43Which interface is designed for recursively walking a file tree?
44To generate a cryptographically secure random number for a key generation algorithm, which class should be used?
45In 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?
46Which TWO statements are true regarding reading files with the NIO.2 API?
47Which THREE are recommended practices to prevent privilege escalation when using doPrivileged in a security-sensitive Java application?
48Which TWO practices improve the security of Java serialization?
49Refer to the exhibit. Which algorithm was used to generate the certificate fingerprint shown?
50Refer to the exhibit. Which of the following best describes the effective permissions granted to the application?
51Refer to the exhibit. What is the most likely cause of this exception?
52A 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?
53An application deserializes objects from a network stream. To protect against deserialization attacks, which approach is most effective in Java 17?
54Which of the following correctly uses try-with-resources to ensure a FileInputStream is closed after use?
55Which TWO approaches are valid for writing text data to a file in Java? (Choose two.)
56Which THREE statements about the SecurityManager and security policies in Java 17 are true? (Choose three.)
57Which is the best practice for securing a Java application that reads sensitive configuration files?
58Refer to the exhibit. A developer runs a keytool command and sees the output above. Which command produced this output?
59Refer 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?
60A 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?
61Which class from the java.nio.file package is most appropriate for efficiently transferring data between two channels on the same machine?
62Which class provides a convenient means to read text from a file line by line?
63A class implements Serializable. Which modification ensures that a specific field (password) is not included in the serialized stream?
64Which TWO secure coding practices should be followed when developing a Java application that handles user input? (Choose two.)
65A 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?
66Which interface should be implemented to create a custom filter for deserialization in Java?
67A 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?
68A financial application deserializes objects received over the network using ObjectInputStream. To prevent deserialization attacks, which secure coding practice should be implemented?
69A 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?
70Which TWO approaches are recommended to secure Java I/O operations? (Choose two.)
71Which THREE statements are true about Java NIO.2 and its interaction with blocking I/O? (Choose three.)
72A 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?
73A 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?
74A 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?
75A 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?
76An 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?
77A 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?
78A class that stores sensitive user data implements Serializable. To minimize security exposure from deserialization attacks, which modification is the best practice?
79Which TWO are secure coding practices for Java I/O that help prevent resource leaks and unauthorized access? (Choose two.)
80Refer 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?
81A 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?
The Java I/O API and Securing Applications domain covers the key concepts tested in this area of the 1Z0-829 exam blueprint published by Oracle. Courseiva provides free domain-focused practice, mock exams, missed-question review, and readiness tracking across all 1Z0-829 domains — no account required.
The Courseiva 1Z0-829 question bank contains 81 questions in the Java I/O API and Securing Applications domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Java I/O API and Securing Applications domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included