Courseiva

CCNA Files, Folders, and Data Manipulation Questions

19 questions · Files, Folders, and Data Manipulation · All types, answers revealed

1
MCQmedium

Which method is the most appropriate for checking if a specific string contains a key piece of information in a file path?

A.Use a Regular Expression (Regex) for every check.
B.Use the 'Contains' method.
C.Convert the string to an array and iterate through it.
D.Use the 'String.Equals' method.
AnswerB

The 'Contains' method is the most efficient and readable way to check for the existence of a substring within a string. It is a native .NET method, making it fast and reliable. For most path validation tasks, it provides exactly the required functionality without the overhead of more complex evaluation techniques.

Why this answer

The 'Contains' method is the standard .NET string comparison operator. It is case-sensitive by default but can be made case-insensitive, providing a flexible and efficient way to validate paths. This is superior to using regular expressions for simple substring checks, as it is much faster and easier for other developers to read and understand, which is critical for maintaining long-term project viability and reducing the complexity of common string validation tasks in automation.

Exam trap

Candidates often select Regular Expressions or complex string manipulation methods, assuming they are more powerful, failing to recognize that 'Contains' is the most direct, efficient, and readable method for simple substring validation.

2
Multi-Selecthard

A developer is building an automation that reads a DataTable from an Excel file, performs transformations, and must output the result to a new Excel workbook. The developer wants to ensure the output preserves data types and column structure correctly. Which two actions should the developer take? (Choose two.)

Select 2 answers
A.Use the Write Range activity inside an Excel Application Scope to write the DataTable to a specified sheet.
B.Use Write CSV instead of Write Range to ensure Excel compatibility.
C.Ensure the DataTable columns have the correct data types before writing, using Build Data Table or casting during transformation.
D.Delete all columns from the DataTable before writing to avoid schema conflicts.
E.Convert the DataTable to a JSON string and write it into a single Excel cell.
AnswersA, C

Write Range within an Excel Application Scope writes a DataTable directly to a worksheet, mapping columns and rows automatically. It preserves the DataTable's column structure and writes values to the target sheet starting at the specified cell. This is the standard UiPath approach for exporting a transformed DataTable to Excel while maintaining its schema.

Why this answer

Writing the DataTable with Write Range inside an Excel Application Scope places the data into a worksheet with its column structure intact, and validating column data types beforehand ensures numeric and date values are stored correctly rather than as text. Converting to JSON, switching to CSV, or deleting columns all undermine the requirement to preserve structure and types.

Exam trap

The trap here is treating CSV as an equivalent Excel output, when CSV loses both workbook structure and type information.

3
MCQeasy

Which activity is best suited for deleting a folder along with all its contents?

A.Use the 'Remove Directory' activity.
B.Use the 'Delete' activity with 'IsFolder' checked.
C.Use a 'For Each' to delete all files, then 'Delete' the folder.
D.Use 'Invoke Power Shell' with the 'rmdir' command.
AnswerB

The 'Delete' activity is the native tool for filesystem management. By checking 'IsFolder', the developer instructs the activity to perform a recursive deletion, covering the folder and all its contents. This is the standard, supported method for directory removal, ensuring that all filesystem permissions are respected and the operation is clean.

Why this answer

The 'Delete' activity in UiPath supports an 'IsFolder' property. When set to true, it recursively deletes the directory and all contained files. This is the native and most efficient way to perform a cleanup operation.

It is important to handle this with care, as it is a destructive action, necessitating robust error handling and validation before the activity is executed in any production automation workflow to prevent accidental data loss.

Exam trap

Candidates often use the 'Delete' activity without checking the 'IsFolder' property, which causes the activity to fail or behave unexpectedly when targeting a directory path.

4
MCQhard

Refer to the exhibit. Your automation is failing with this error when trying to move a file. Which technique is most effective to resolve this intermittent access violation?

A.Increase the timeout property on the Move File activity to 60 seconds.
B.Wrap the Move File activity in a Retry Scope with a short delay and a condition.
C.Use the Kill Process activity to force close all applications before moving the file.
D.Change the file extension to .tmp before moving it, then rename it.
AnswerB

A Retry Scope allows the robot to repeatedly attempt an operation until it succeeds or a retry limit is reached. Adding a Delay activity within the loop ensures the robot waits for the file to be released, effectively handling intermittent file locks caused by external software still accessing the file.

Why this answer

Intermittent file access errors are common when an external application has not yet released its handle on a file. Implementing a retry scope with a delay allows the process to wait for the file to become available. This pattern is essential in real-world scenarios where file generation speeds vary, ensuring the automation remains stable and does not fail due to external application latency.

Exam trap

Candidates often attempt to use a simple 'Delay' activity to wait for a file, which is inefficient and unreliable, failing if the application takes longer than the static delay.

5
MCQmedium

When writing data to a CSV file, which property should be set to true if you want to avoid overwriting existing data?

A.Set 'Overwrite' to false.
B.Set 'Append' to true.
C.Set 'Create' to false.
D.Set 'Delimiter' to 'New'.
AnswerB

Setting 'Append' to true tells the activity to add the new data to the end of the existing file contents. This is the correct way to ensure that previous records are preserved during a data export process, fulfilling the requirement of maintaining a continuous data record without manual file manipulation.

Why this answer

The 'Append' property in the 'Write CSV' activity is specifically designed for this purpose. By setting 'Append' to true, the automation adds new rows to the end of the file instead of clearing the existing content. This is essential for logging, audit trails, and batch data processing, where maintaining historical data is a critical business requirement that must be handled safely to avoid accidental data loss during export operations.

Exam trap

Candidates often forget to check the 'Append' property, assuming write activities automatically preserve historical data instead of overwriting the entire file.

6
MCQeasy

A developer is building a UiPath automation that must read every row of a CSV file into a DataTable so that each row can be processed by a For Each Row in Data Table activity. The CSV uses standard comma delimiters and the first row contains column headers. Which activity should the developer use?

A.Excel Application Scope
B.Deserialize JSON
C.Read Text File
D.Read CSV
AnswerD

Read CSV is the UiPath activity designed specifically to load a delimited text file into a DataTable. It automatically uses the first row as column headers when the IncludeColumnNames property is enabled, and it provides a delimiter property that defaults to comma. Using it directly satisfies the requirement of reading all rows for subsequent For Each Row processing without writing custom parsing logic.

Why this answer

Read CSV is purpose-built to parse delimited text files into a DataTable, honoring the header row and delimiter settings. It returns structured data that For Each Row in Data Table can iterate directly, which matches the scenario exactly. The other activities either return unparsed text, target a different file format, or expect a different data structure entirely.

Exam trap

The trap here is assuming any activity that can open a file will also structure its contents into a DataTable.

7
MCQmedium

You need to update a specific cell in an Excel file without loading the entire document into a DataTable. Which approach is most efficient?

A.Read the entire file into a DataTable, update, and write back.
B.Use 'Write Cell' within an 'Excel Process Scope'.
C.Use 'Invoke VBA' to update the cell.
D.Use 'Append Range' to add the new value.
AnswerB

The 'Write Cell' activity targets a specific coordinate without affecting other data. Using 'Excel Process Scope' ensures proper application lifecycle management, leading to faster execution and reliable cell updates. This is the industry-standard approach for modifying existing Excel files, as it minimizes the risk of corruption and ensures optimal throughput.

Why this answer

Using the 'Excel Process Scope' and 'Write Cell' activity is the most efficient method for localized updates. By keeping the Excel process active and performing direct writes, you avoid the overhead of reading, modifying, and rewriting the entire file structure. This approach is significantly faster and more resource-efficient, especially for large Excel files where the modification is limited to a single cell or small range of data values.

Exam trap

Candidates often use the 'Read Range' activity to load an entire Excel file into a DataTable just to update one cell, which is extremely memory-intensive and slow.

8
MCQmedium

You are developing an automation that processes thousands of small CSV files located in a local directory. Which approach provides the best performance while ensuring file integrity during the read operation?

A.Use the Read Text File activity and manual splitting to parse the data.
B.Move files to a subfolder named 'Processed' immediately after reading.
C.Utilize the Read CSV activity with 'Has Headers' enabled and default buffering.
D.Read all files into a single master DataTable using an Invoke Code activity.
AnswerC

The Read CSV activity is highly optimized for performance and handles common CSV edge cases automatically. Using its built-in buffering mechanisms ensures that system resources are managed effectively without manually loading the entire file into memory before processing, which is essential for maintaining stability during bulk file operations.

Why this answer

Using the Read CSV activity within a For Each File In Folder loop is standard, but memory efficiency is key when processing large volumes. Streaming data or using the proper DataTable configuration prevents memory bottlenecks. Understanding file locking and stream management is critical for robust automation, as improper handling leads to read-write conflicts or resource exhaustion in high-throughput enterprise environments.

Exam trap

Candidates often use the 'Read Range' activity inside a loop for thousands of files, which causes massive overhead by repeatedly opening and closing the Excel application process for every file.

9
Multi-Selectmedium

Which TWO methods are recommended for safely handling file paths in UiPath to ensure cross-platform compatibility?

Select 2 answers
A.Concatenating strings using the '+' operator.
B.Using Path.Combine for joining directory and file names.
C.Hardcoding full paths using double backslashes in all variables.
D.Using Path.GetFullPath to resolve relative paths.
E.Always using forward slashes for all file operations.
AnswersB, D

Path.Combine dynamically inserts the correct platform-specific separator between directory components. This eliminates hardcoded slash issues, making the automation highly portable. It is the preferred method for building dynamic paths, as it automatically resolves potential inconsistencies in path formatting, ensuring the automation successfully locates target files on both Windows and Linux target systems.

Why this answer

Using Path.Combine ensures that directory separators are handled according to the host operating system, preventing issues when migrating between Windows and Linux environments. Path.GetFullPath is equally critical for resolving relative paths into absolute ones, which prevents ambiguity during runtime execution. Together, these methods form the foundation of secure and portable automation design, ensuring that file operations consistently point to the correct locations regardless of the execution context or environment variables.

Exam trap

Candidates frequently use hardcoded slashes like backslashes for file paths, causing cross-platform workflows to break when moving between Windows and Linux execution environments.

10
MCQeasy

You need to retrieve the name of a file without its extension from a full path string. Which method should you use?

A.Use 'Split' on the dot character.
B.Use 'Path.GetFileNameWithoutExtension'.
C.Use 'Substring' with 'LastIndexOf'.
D.Use the 'Get File Name' activity and then remove the last 4 chars.
AnswerB

This method is purpose-built for the task. It correctly identifies the file name component and strips the extension, handling all edge cases automatically. It is the best practice for professional automation, as it minimizes code complexity and relies on reliable, system-tested methods that are guaranteed to work correctly in all standard environments.

Why this answer

Path.GetFileNameWithoutExtension is the built-in, platform-independent method for exactly this requirement. It correctly handles various OS-specific directory separators and edge cases in file naming. Using this method is much safer than manually parsing the string with 'LastIndexOf', as it avoids common pitfalls like unexpected dots in the path or missing extensions, ensuring the automation remains robust and predictable across different file naming conventions and operating systems.

Exam trap

Candidates often attempt to use complex string manipulation like 'Split' or 'LastIndexOf' to remove extensions, which fails when file names contain multiple dots.

11
MCQmedium

A developer stores a DataTable named dtOrders that was read from an Excel file. They need to keep only the rows where the column "Status" equals "Open" and store the result in a new DataTable variable called dtOpenOrders. Which activity should they use to accomplish this with the least configuration effort?

A.Remove Data Row activity executed repeatedly until only rows where Status equals "Open" remain
B.Filter Data Table activity with the condition Status = "Open" configured in the Filter Wizard
C.For Each Row activity with an If activity inside that adds matching rows to a second DataTable
D.Select method on the DataTable with a lambda expression that returns rows where Status equals "Open"
AnswerB

The Filter Data Table activity is purpose-built for this scenario: it accepts an input DataTable, applies row/column filter conditions defined in its wizard (such as Status = "Open"), and outputs a new DataTable without any loop or LINQ code. It is the native, least-effort approach for filtering a DataTable by a column value inside a UiPath Studio sequence.

Why this answer

Filtering rows by a column value is a standard DataTable operation, and UiPath provides the Filter Data Table activity specifically for it. Configuring the condition Status = "Open" in the activity's wizard produces a new DataTable in one step, preserving the source table. Loop-based alternatives or DataTable.Select require more activities or type conversions that this scenario does not call for.

Exam trap

The trap here is assuming that DataTable.Select returns a DataTable, when it actually returns a DataRow array that would need additional conversion.

12
MCQhard

A developer is building an automation that reads a large CSV file into a DataTable and then needs to keep only rows where the 'Status' column equals 'Active' and the 'Region' column equals 'EMEA'. The developer wants to avoid iterating through every row. Which method should be used to produce the filtered DataTable?

A.Use a For Each Row activity and an If activity to remove non-matching rows with Remove Data Row.
B.Use the Sort Data Table activity with the 'Status' column and then delete rows from the top.
C.Use the Filter Data Table activity with two conditions joined by the AND operator.
D.Use the Select method on the DataTable with a filter expression and assign the result to a DataRow array.
AnswerC

Filter Data Table is designed to filter rows based on one or more column conditions and can combine them with AND or OR. Setting Status = 'Active' AND Region = 'EMEA' produces the required subset without any explicit loop, which is the most efficient and maintainable approach for this scenario.

Why this answer

Filter Data Table evaluates column conditions and returns only matching rows, supporting AND/OR combinations natively. This satisfies the requirement to avoid row-by-row iteration and produces a DataTable directly. The other options either iterate, return a different data structure, or do not filter at all, making them unsuitable for this scenario.

Exam trap

The trap here is confusing the DataTable.Select method, which returns an array, with Filter Data Table, which returns a filtered DataTable.

13
Multi-Selecthard

Which THREE actions are essential for ensuring data integrity when overwriting an existing file during a data export operation?

Select 3 answers
A.Always delete the file before starting the write operation.
B.Check if the file is currently in use by another process.
C.Create a temporary backup of the existing file.
D.Perform a 'File Exists' check prior to write operations.
E.Set file attributes to Read-Only during the move.
AnswersB, C, D

Verifying if a file is in use prevents access denied exceptions that crash automation. This check allows the bot to implement a retry logic or alert the user, ensuring the workflow remains resilient against external process conflicts that are common in shared directory environments where multiple users or processes access files.

Why this answer

Data integrity requires verifying file state before writing. Checking if the file is locked prevents I/O exceptions. Taking a backup of the original file provides a rollback mechanism if the write process fails, while verifying existence and permissions ensures the bot has the authority to complete the task.

These steps are crucial in production environments to avoid data loss and maintain a reliable audit trail for all file modifications during execution.

Exam trap

Candidates often jump straight into file overwrite operations without checking for file locks or creating backups, resulting in runtime exceptions and data loss.

14
Multi-Selectmedium

A developer needs to read a CSV file named invoices.csv whose first line contains column headers and whose values are separated by semicolons rather than commas. The resulting data must be available as a DataTable for downstream processing. Which TWO actions are required to accomplish this correctly? (Choose two.)

Select 2 answers
A.Use the Read Text File activity to load the whole file and then split each line manually in a loop
B.Leave the Read CSV activity's IncludeColumnNames property checked so the header line becomes the DataTable column names
C.Set the Read CSV activity's Encoding property to a specific code page to change the delimiter interpretation
D.Use the Read CSV activity and set its Delimiter property to ";"
E.Use the Excel Read Range activity inside Excel Application Scope, pointing at invoices.csv
AnswersB, D

The IncludeColumnNames property, when enabled, causes the first line of the file to be interpreted as column headers rather than data. Since the scenario states the first line contains headers, keeping this property checked produces a DataTable whose columns are named from that line, which is exactly what downstream processing expects.

Why this answer

Read CSV is the activity designed to turn delimited text into a DataTable. Because this file uses semicolons, the Delimiter property must be changed from the default comma, and because the first line holds headers, IncludeColumnNames must remain enabled so those headers become the DataTable's column names. Together these two settings produce the expected structured data.

Exam trap

The trap here is assuming the default comma delimiter will work, or confusing the Encoding property with delimiter handling.

15
MCQmedium

An automation must append new transaction rows to an existing CSV file at the end of each run without deleting the data already present. The developer is configuring the Write CSV activity. Which property must be set to achieve append behavior?

A.Set the IncludeColumnNames property to False.
B.Set the Delimiter property to a newline character.
C.Set the Encoding property to UTF-8.
D.Set the Append property to True.
AnswerD

The Write CSV activity exposes an Append property. When set to True, new rows are added to the end of the existing file instead of overwriting it. This directly satisfies the requirement to preserve previously written transaction rows while adding the current run's data. Leaving it at the default False would truncate and replace the file content.

Why this answer

Write CSV overwrites the target file by default, so preserving existing rows requires explicitly enabling the Append property. IncludeColumnNames, Delimiter, and Encoding affect formatting and character representation, not whether prior content survives. Only Append changes the write mode to add rows at the end of the file.

Exam trap

The trap here is confusing formatting properties such as IncludeColumnNames with the property that actually controls overwrite versus append behavior.

16
MCQmedium

Which data manipulation approach is most efficient for transforming a DataTable with 10,000 rows without using activities in a loop?

A.Use the 'For Each Row' activity to update values.
B.Use the 'Invoke Code' activity with a LINQ query.
C.Write the data to Excel, perform the transformation there, and read it back.
D.Use the 'Filter Data Table' activity 10,000 times.
AnswerB

Executing LINQ within 'Invoke Code' provides the highest performance for complex transformations. It allows the developer to use the full power of the .NET framework to manipulate DataTable objects in a single, memory-resident pass. This is the preferred method for large-scale data manipulation that requires high throughput and minimal latency in production.

Why this answer

Using LINQ on a DataTable allows for high-performance data transformation in memory. By leveraging 'AsEnumerable', you can perform complex filtering, sorting, and grouping operations without the overhead of UI-based activities. This approach is highly efficient for large datasets, significantly reducing the execution time compared to iterating row-by-row, as it utilizes optimized .NET underlying collection processing which is designed for speed and memory efficiency in enterprise-grade automation scenarios.

Exam trap

Candidates often default to a 'For Each Row' loop because it is easier to write, ignoring that it is significantly slower than LINQ for large datasets.

17
MCQhard

Refer to the exhibit. You are reading this JSON file to configure a file mover. Which activity sequence correctly parses this JSON and moves the files?

A.Use 'Read Text File', then 'Deserialize JSON', then 'Move File'.
B.Use 'Read CSV' and map the columns directly to the 'Move File' input arguments.
C.Use 'Read Text File' and regex extract the paths, then move the file.
D.Use 'Get Environment Variable' to read the JSON file contents.
AnswerA

This sequence correctly retrieves the raw content, transforms it into a structured object, and then utilizes the extracted keys for the file movement logic. It is the most reliable way to handle external configuration files, ensuring that values like 'SourcePath' are correctly retrieved and utilized during the execution of the file movement process.

Why this answer

Deserializing the JSON string into a custom object or JObject allows for type-safe access to configuration values. Using the 'Deserialize JSON' activity is the standard approach to convert raw text into a manageable format. Once parsed, the resulting object can be passed into the 'Move File' activity.

This pattern ensures that configuration changes are reflected dynamically without modifying the underlying workflow logic, which is essential for maintaining scalable and robust automation solutions.

Exam trap

Test-takers frequently confuse raw string handling with deserialization, attempting to pass unparsed JSON strings directly into file or data manipulation activities.

18
MCQmedium

When extracting a specific column from a DataTable into an array, which method provides the most concise and efficient syntax?

A.Use a 'For Each' activity to iterate and assign values to an array.
B.Use the 'Filter Data Table' activity.
C.Use LINQ: DataTable.AsEnumerable.Select(Function(row) row("Col").ToString).ToArray().
D.Use the 'Read Range' activity with a specific range.
AnswerC

This LINQ projection is the standard, optimized way to extract column data in UiPath. It is concise, readable, and executes efficiently in memory. By avoiding loops, it reduces the risk of errors and keeps the codebase clean, which is a fundamental requirement for scalable and professional-grade RPA development practices.

Why this answer

Using LINQ's 'Select' method on a DataTable's Rows collection allows for a direct projection to an array. This is the idiomatic way to handle column extraction in .NET and UiPath, providing both readability and speed. By using 'AsEnumerable().Select(Function(r) r("ColumnName").ToString()).ToArray()', you avoid manual loops and temporary variable management, resulting in cleaner and more maintainable code that effectively isolates data for subsequent processing tasks.

Exam trap

Candidates often attempt to iterate through the DataTable using a For Each row activity and manually adding items to a List, which is inefficient, verbose, and prone to indexing errors.

19
MCQmedium

An automation downloads a daily report to a temporary folder. Before processing, the developer must confirm that the file C:\Temp\report.xlsx exists and is not currently locked by another process. Which activity should be used to check whether the file exists?

A.Get File Info
B.Path Exists
C.File Exists
D.Move File
AnswerB

Path Exists is the UiPath activity that checks whether a specified file or folder path exists and returns a Boolean result. It is designed exactly for this validation step before processing a downloaded file. The developer can branch on its output to handle missing files gracefully, which is the intended use in this scenario.

Why this answer

Path Exists returns a Boolean indicating whether a file or folder is present at the given path, which is precisely the validation needed before processing a downloaded report. Get File Info retrieves metadata but errors on missing files, Move File performs an action rather than a check, and File Exists is not a real activity in the package.

Exam trap

The trap here is assuming a File Exists activity exists when the actual UiPath activity covering files and folders is Path Exists.

Ready to test yourself?

Try a timed practice session using only Files, Folders, and Data Manipulation questions.