Courseiva

UiPath-ADAv1 Files, Folders, and Data Manipulation Practice Question

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

⚠ Common 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.

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

✓

Use 'Path.GetFileNameWithoutExtension'.

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.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Use 'Split' on the dot character.

    Why it's wrong here

    Splitting on a dot is fragile because directory names or path components can also contain dots. This will result in an incorrect file name if the path is not perfectly clean. Built-in path manipulation methods are designed to handle these complexities correctly, making manual string splitting an outdated and risky practice in modern automation.

  • ✓

    Use 'Path.GetFileNameWithoutExtension'.

    Why this is correct

    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.

  • ✗

    Use 'Substring' with 'LastIndexOf'.

    Why it's wrong here

    While this can technically work, it is error-prone if the file has no extension or if the path is malformed. It requires manual index management, which is unnecessary given the built-in Path library methods. Developers should always prefer standardized methods over manual string manipulation to reduce the risk of bugs and improve code maintainability.

  • ✗

    Use the 'Get File Name' activity and then remove the last 4 chars.

    Why it's wrong here

    Removing a fixed number of characters assumes that all extensions are exactly three characters long (e.g., .txt or .png), which is incorrect. Files can have extensions of any length (e.g., .jpeg, .html, .config). This assumption is a common cause of bugs in automation and should be avoided in favor of dynamic extension parsing methods.

About these practice questions

One of 285 original UiPath-ADAv1 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official UiPath exam blueprint

This UiPath-ADAv1 practice question is part of Courseiva's free UiPath 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 UiPath-ADAv1 exam.