Courseiva
Knowledge + Practice
CertificationsVendorsCareer RoadmapsLabs & ToolsStudy GuidesGlossaryPractice Questions
C
Courseiva

Free IT certification practice questions with explained answers for CCNA, CompTIA, AWS, Azure, Google Cloud, and more.

Certification Practice Questions

CCNA practice questionsSecurity+ SY0-701 practice questionsAWS SAA-C03 practice questionsAZ-104 practice questionsAZ-900 practice questionsCLF-C02 practice questionsA+ Core 1 practice questionsGoogle Cloud ACE practice questionsCySA+ CS0-003 practice questionsNetwork+ N10-009 practice questions
View all certifications →

Product

CertificationsCertification PathsExam TopicsPractice TestsExam Dumps vs Practice TestsStudy HubComparisons

Company

AboutContactEditorial PolicyQuestion Writing PolicyTrust Center

Legal

Privacy PolicyTerms of Service

Courseiva is a free IT certification practice platform offering original exam-style practice questions, detailed explanations, topic-based practice, mock exams, readiness tracking, and study analytics for Cisco, CompTIA, Microsoft, AWS, and other technology certifications.

© 2026 Courseiva. Courseiva is operated by JTNetSolutions Ltd. All rights reserved.

Courseiva is an independent certification practice platform and is not affiliated with, endorsed by, or sponsored by Cisco, Microsoft, AWS, CompTIA, Google, ISC2, ISACA, or any other certification vendor. Vendor names and certification marks are used only to identify the exams learners are preparing for.

← Java I/O API and Securing Applications practice sets

1Z0-829 Java I/O API and Securing Applications • Complete Question Bank

1Z0-829 Java I/O API and Securing Applications — All Questions With Answers

Complete 1Z0-829 Java I/O API and Securing Applications question bank — all 0 questions with answers and detailed explanations.

80
Questions
Free
No signup
Certifications/1Z0-829/Practice Test/Java I/O API and Securing Applications/All Questions
Question 1mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

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?

Question 2easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 3hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

An 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?

Question 4easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

A developer needs to write text to a file with UTF-8 encoding. Which class should be used?

Question 5mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A Java application running in a secure environment needs to read a file located outside the application's directory. Which approach correctly handles security?

Question 6hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

A developer is designing a service that processes multiple files concurrently. To avoid resource leaks, which practice is essential?

Question 7easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Which statement about java.io and java.nio.file packages is true?

Question 8mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A developer needs to copy a large directory tree from one location to another, preserving file attributes. Which method should be used?

Question 9mediummulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO statements are true about securing a Java application?

Question 10hardmulti select
Read the full Java I/O API and Securing Applications explanation →

Which THREE are valid ways to read the contents of a text file into a String in Java?

Question 11easymulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO are true about the try-with-resources statement?

Question 12mediummulti select
Read the full Java I/O API and Securing Applications explanation →

Which THREE are benefits of using the NIO.2 API over the java.io API?

Question 13hardmultiple choice
Read the full NAT/PAT explanation →

A 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?

Question 14mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 15hardmulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO statements about Java serialization are true?

Question 16easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

You 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?

Question 17mediummulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO statements about java.io and java.nio.file packages are true?

Question 18easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 19mediumdrag order
Read the full Java I/O API and Securing Applications explanation →

Order the steps to create an immutable class in Java.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5
Question 20mediummatching
Read the full Java I/O API and Securing Applications explanation →

Match each concurrency utility to its purpose.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Allows one or more threads to wait until a count reaches zero

Allows a set of threads to wait for each other to reach a common barrier point

Controls access to a resource via a permit system

Allows two threads to exchange objects at a synchronization point

A reusable barrier that supports dynamic number of parties

Question 21easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 22mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 23hardmultiple choice
Read the full NAT/PAT explanation →

Given 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?

Question 24easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Which resource declaration order in try-with-resources is valid when both a FileInputStream and a BufferedInputStream wrapping it need to be closed automatically?

Question 25mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 26easymultiple choice
Read the full NAT/PAT explanation →

A developer needs to create a temporary file that will be automatically deleted when the JVM terminates. Which approach correctly achieves this?

Question 27mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A method receives an InputStream and needs to compute its MD5 hash while reading the data. Which approach is most efficient?

Question 28mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 29hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 30easymulti select
Read the full Java I/O API and Securing Applications explanation →

Which two of the following are valid methods to create a new directory using the NIO.2 Files class? (Select two.)

Question 31hardmulti select
Read the full Java I/O API and Securing Applications explanation →

Which two statements are true about FileInputStream? (Select two.)

Question 32hardmulti select
Read the full Java I/O API and Securing Applications explanation →

Which three actions help secure a Java application that uses serialization? (Select three.)

Question 33mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

Refer to the exhibit. Assuming the application is running from /home/application/lib/myapp.jar, which of the following actions is allowed by the policy?

Exhibit

grant codeBase "file:/home/application/-" {
    permission java.io.FilePermission "/etc/config/-", "read";
    permission java.io.FilePermission "/var/log/-", "read,write";
    permission java.lang.RuntimePermission "queuePrintJob";
};
Question 34hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

Refer to the exhibit. What is the most likely cause of this exception?

Exhibit

Exception in thread "main" java.io.InvalidClassException: com.example.User; local class incompatible: stream classdesc serialVersionUID = 5564992945715864724, local class serialVersionUID = -4978412458979645732
Question 35easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Refer to the exhibit. What is the purpose of this code?

Exhibit

Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(iv));
try (CipherOutputStream cos = new CipherOutputStream(new FileOutputStream("data.enc"), cipher)) {
    Files.copy(Path.of("data.txt"), cos);
}
Question 36mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A developer needs to read a very large text file (over 1 GB) efficiently with minimal memory overhead. Which approach is most suitable?

Question 37hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

A class implements Serializable but the developer wants to completely prevent deserialization of its instances. Which approach accomplishes this?

Question 38easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Which class is best suited for reading integer tokens from a string containing space-separated integers?

Question 39mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 40hardmultiple choice
Read the full NAT/PAT explanation →

A 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?

Question 41mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 42easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Which interface is designed for recursively walking a file tree?

Question 43mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

To generate a cryptographically secure random number for a key generation algorithm, which class should be used?

Question 44hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

In 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?

Question 45mediummulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO statements are true regarding reading files with the NIO.2 API?

Question 46hardmulti select
Read the full Java I/O API and Securing Applications explanation →

Which THREE are recommended practices to prevent privilege escalation when using doPrivileged in a security-sensitive Java application?

Question 47mediummulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO practices improve the security of Java serialization?

Question 48easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Refer to the exhibit. Which algorithm was used to generate the certificate fingerprint shown?

Exhibit

CLI output of 'keytool -list -keystore mykeystore.jks -storepass changeit':

alias: myserver
Certificate fingerprint (MD5): 0F:AA:3B:87:1C:3F:BE:21:4D:2E:5F:6A:7B:8C:9D:0E
Question 49mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

Refer to the exhibit. Which of the following best describes the effective permissions granted to the application?

Exhibit

Policy file snippet:
grant codeBase "file:/home/user/app/-" {
    permission java.io.FilePermission "/data/-", "read,write";
    permission java.net.SocketPermission "*", "connect";
};
Question 50hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

Refer to the exhibit. What is the most likely cause of this exception?

Exhibit

Error log:
java.io.StreamCorruptedException: invalid stream header: 73657200
Question 51mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 52hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

An application deserializes objects from a network stream. To protect against deserialization attacks, which approach is most effective in Java 17?

Question 53easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Which of the following correctly uses try-with-resources to ensure a FileInputStream is closed after use?

Question 54mediummulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO approaches are valid for writing text data to a file in Java? (Choose two.)

Question 55hardmulti select
Read the full Java I/O API and Securing Applications explanation →

Which THREE statements about the SecurityManager and security policies in Java 17 are true? (Choose three.)

Question 56easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Which is the best practice for securing a Java application that reads sensitive configuration files?

Question 57mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

Refer to the exhibit. A developer runs a keytool command and sees the output above. Which command produced this output?

Exhibit

alias: mykey
Creation date: Jan 15, 2024
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=MyApp, OU=Dev, O=Company, L=City, ST=State, C=US
Issuer: CN=MyCA, OU=CA, O=Company, L=City, ST=State, C=US
Serial number: 1234abcd
Valid from: Wed Jan 15 10:00:00 UTC 2024 until: Thu Jan 15 10:00:00 UTC 2026
Certificate fingerprints:
         SHA1: 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef:12:34:56:78
         SHA256: ab:cd:ef:12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3
Question 58hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

Refer 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?

Exhibit

grant codeBase "file:${user.home}/lib/*" {
    permission java.io.FilePermission "${user.home}/config.ini", "read";
    permission java.io.FilePermission "${user.home}/logs/-", "read,write";
    // Missing permission for data files
};

grant codeBase "file:/app/lib/app.jar" {
    permission java.security.AllPermission;
};
Question 59hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 60mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

Which class from the java.nio.file package is most appropriate for efficiently transferring data between two channels on the same machine?

Question 61easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Which class provides a convenient means to read text from a file line by line?

Question 62mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A class implements Serializable. Which modification ensures that a specific field (password) is not included in the serialized stream?

Question 63mediummulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO secure coding practices should be followed when developing a Java application that handles user input? (Choose two.)

Question 64hardmultiple choice
Read the full NAT/PAT explanation →

A 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?

Question 65easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

Which interface should be implemented to create a custom filter for deserialization in Java?

Question 66mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 67mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A financial application deserializes objects received over the network using ObjectInputStream. To prevent deserialization attacks, which secure coding practice should be implemented?

Question 68easymultiple choice
Read the full NAT/PAT explanation →

A 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?

Question 69easymulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO approaches are recommended to secure Java I/O operations? (Choose two.)

Question 70mediummulti select
Read the full Java I/O API and Securing Applications explanation →

Which THREE statements are true about Java NIO.2 and its interaction with blocking I/O? (Choose three.)

Question 71hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

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?

Question 72mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 73easymultiple choice
Read the full NAT/PAT explanation →

A 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?

Question 74mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 75hardmultiple choice
Read the full Java I/O API and Securing Applications explanation →

An 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?

Question 76easymultiple choice
Read the full Java I/O API and Securing Applications explanation →

A 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?

Question 77mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

A class that stores sensitive user data implements Serializable. To minimize security exposure from deserialization attacks, which modification is the best practice?

Question 78hardmulti select
Read the full Java I/O API and Securing Applications explanation →

Which TWO are secure coding practices for Java I/O that help prevent resource leaks and unauthorized access? (Choose two.)

Question 79mediummultiple choice
Read the full Java I/O API and Securing Applications explanation →

Refer 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?

Exhibit

grant codeBase "file:/opt/app/lib/*" {
    permission java.io.FilePermission "/data/config/*", "read";
    permission java.io.FilePermission "/logs/app.log", "write";
};
Question 80hardmultiple choice
Read the full NAT/PAT explanation →

A 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?

Practice tests

Scored 10-question sessions with instant feedback and explanations.

1Z0-829 Practice Test 1 — 10 Questions→1Z0-829 Practice Test 2 — 10 Questions→1Z0-829 Practice Test 3 — 10 Questions→1Z0-829 Practice Test 4 — 10 Questions→1Z0-829 Practice Test 5 — 10 Questions→1Z0-829 Practice Exam 1 — 20 Questions→1Z0-829 Practice Exam 2 — 20 Questions→1Z0-829 Practice Exam 3 — 20 Questions→1Z0-829 Practice Exam 4 — 20 Questions→Free 1Z0-829 Practice Test 1 — 30 Questions→Free 1Z0-829 Practice Test 2 — 30 Questions→Free 1Z0-829 Practice Test 3 — 30 Questions→1Z0-829 Practice Questions 1 — 50 Questions→1Z0-829 Practice Questions 2 — 50 Questions→1Z0-829 Exam Simulation 1 — 100 Questions→

Practice by domain

Each domain maps to a weighted exam section. Focus on the domain where you are weakest.

Handling Date, Time, Text, Numeric and Boolean ValuesControlling Program FlowUtilizing Java Object-Oriented ApproachHandling ExceptionsWorking with Arrays and CollectionsWorking with Streams and Lambda ExpressionsJava Platform Overview and PackagingJava I/O API and Securing Applications

Practice by scenario

Filter questions by type — troubleshooting, exhibit, drag-and-drop, PBQ, ACLs, OSPF, and more.

Browse scenarios→

Continue studying

All Java I/O API and Securing Applications setsAll Java I/O API and Securing Applications questions1Z0-829 Practice Hub