Courseiva

CCNA Debugging and Exception Handling Questions

19 questions · Debugging and Exception Handling · All types, answers revealed

1
MCQmedium

Which activity is used to explicitly stop the execution of a workflow and propagate a fault to the parent scope?

A.Break
B.Rethrow
C.Terminate Workflow
D.Stop
AnswerB

Rethrow is specifically used to pass an exception up the stack after handling or logging it. This is a best practice for maintaining visibility of errors while allowing local recovery efforts to be completed, ensuring that higher-level processes are fully aware of the failure.

Why this answer

The Rethrow activity is used within a Catch block to propagate an exception after it has been caught and potentially logged. This allows developers to perform logging or cleanup locally, while still signaling to higher-level workflows that a failure has occurred, ensuring comprehensive error tracking throughout the entire automation hierarchy.

Exam trap

Candidates frequently confuse 'Throw' with 'Rethrow', using 'Throw' inside a Catch block which unfortunately overwrites the original exception stack trace.

2
MCQmedium

What happens if a 'Throw' activity is executed within a 'Try' block that has no corresponding 'Catch' block?

A.The exception is ignored and the workflow continues.
B.The activity is skipped and the process continues.
C.The exception bubbles up to the caller or the Global Exception Handler.
D.The Studio debugger will automatically fix the error.
AnswerC

If no local catch exists, the exception propagates upwards. This is the intended behavior of the runtime, allowing the Global Exception Handler to capture and process the fault. This mechanism is crucial for maintaining control over the lifecycle of the automation process during failures.

Why this answer

When an exception is thrown and not caught by a local Try-Catch, it bubbles up the call stack to the next parent process or the Global Exception Handler. This is a critical architectural feature, as it allows for centralized error management while still enabling the use of specific, high-level exception handling strategies for critical failures that cannot be resolved locally.

Exam trap

Candidates mistakenly believe the process will crash immediately or ignore the error. They often overlook that the exception naturally propagates up the call stack to the parent or Global Handler.

3
Multi-Selecthard

A developer is implementing a Global Exception Handler. Which TWO of the following statements regarding the behavior of the handler are correct?

Select 2 answers
A.It can be used to retry the activity that caused the error by setting the error action to 'Retry'.
B.It only executes if a Try-Catch block is present in the main workflow.
C.It can be used to ignore an exception and continue execution from the next activity.
D.The handler can only be invoked once per project execution.
E.It must be triggered manually via an Invoke Workflow activity.
AnswersA, C

Setting the errorAction argument to 'Retry' instructs the workflow to re-execute the specific activity that threw the exception. This is a common pattern for handling transient issues like temporary network disconnects or UI element loading delays in enterprise automation projects.

Why this answer

The Global Exception Handler is a powerful tool for managing unexpected errors in UiPath. It allows developers to define a standard recovery strategy, such as logging, retrying, or aborting. Understanding that it can modify the error status or force a retry is critical for building resilient automation that can handle environmental instability without requiring extensive individual try-catch blocks throughout the entire process.

Exam trap

Candidates mistakenly believe the Global Exception Handler can only abort workflows, overlooking its powerful capabilities to retry activities or ignore errors.

4
MCQeasy

Which panel in UiPath Studio allows a developer to monitor variable values and evaluate expressions in real-time while the process is paused at a breakpoint?

A.Output panel
B.Properties panel
C.Locals panel
D.Project panel
AnswerC

The Locals panel is explicitly designed to show the values of all variables in the current execution scope when the process is paused. It is the most effective tool for debugging as it allows developers to see the exact state of data before it moves.

Why this answer

The Locals panel is the primary tool for real-time inspection. It shows the current state of variables within the current scope. Understanding this panel is fundamental for developers because it provides immediate visibility into data processing, allowing for quick identification of incorrect data transformations that lead to automation failures during runtime execution cycles.

Exam trap

Candidates often confuse the Locals panel with the Output or Immediate panels, overlooking where active scope variables are natively displayed during pauses.

5
MCQhard

A developer is debugging a workflow that intermittently throws a 'UiPath.Core.ElementNotFoundException' when clicking a button. The developer wants to inspect the state of the application and the variable values at the exact moment the exception occurs, without modifying the workflow logic permanently. Which approach best allows this?

A.Wrap the Click activity in a Try Catch block, and in the Catch block use a Take Screenshot activity to capture the screen, then rethrow the exception.
B.Add a Log Message activity immediately after the Click activity that writes the exception message to the Output panel, then run the workflow normally.
C.Set the Click activity's ContinueOnError property to True, run the workflow, and review the Output panel for the error message after execution completes.
D.Add a Breakpoint on the Click activity, run the workflow in Debug mode, and when execution pauses, use the Locals panel to inspect variables and the UI Explorer to examine the application state.
AnswerD

Breakpoints pause execution before the activity runs, allowing the developer to inspect variable values in the Locals panel and use UI Explorer to check the live application state. Running in Debug mode enables this without altering the workflow logic, and the developer can step through or resume as needed to diagnose the intermittent issue.

Why this answer

Debugging intermittent UI exceptions requires pausing execution at the point of failure to inspect live data. A Breakpoint on the Click activity, combined with Debug mode, pauses the workflow before the activity executes, enabling the developer to examine variables in the Locals panel and use UI Explorer to verify the application state. This method is non-invasive and provides the most detailed diagnostic information without altering workflow logic.

Exam trap

The trap here is assuming that logging or screenshots after the failure provide the same insight as pausing before the activity; however, only a breakpoint in Debug mode allows interactive inspection of variables and the live UI at the critical moment.

6
MCQhard

Refer to the exhibit. What is the most likely cause of this exception when iterating through a list?

A.The list is null.
B.The index is greater than or equal to the count of items in the collection.
C.The list contains duplicate items.
D.The list items are of different types.
AnswerB

This is the classic cause of an ArgumentOutOfRangeException. If you attempt to access `list(10)` when the list only contains 10 items (indices 0 to 9), the runtime will raise this exception because the requested index is outside the valid bounds of the collection.

Why this answer

An ArgumentOutOfRangeException occurs when code attempts to access a list element at an index that does not exist. This is a common logic error in loops. Understanding this helps developers ensure their loop bounds are correctly calculated.

Preventing these errors is essential for avoiding data processing crashes, especially when dealing with dynamic data sets that change size during runtime.

Exam trap

Candidates often confuse this with a 'NullReferenceException'. They fail to recognize that accessing an index equal to the collection count is a classic off-by-one error causing ArgumentOutOfRangeException.

7
MCQmedium

A developer is building an unattended process that reads a queue of invoice items. For each transaction, the process must attempt to extract data from a PDF. If extraction fails, the item should be retried up to two more times, and after all retries are exhausted, the item should be marked as failed without stopping the entire job. The developer places the extraction logic inside a Try Catch block within a Retry Scope activity. Which configuration correctly ensures that each failed attempt is retried and that the final failure is handled gracefully?

A.Place the Try Catch inside the Retry Scope, set the Retry Scope NumberOfRetries property to 2, and leave the Catch block empty.
B.Place the Retry Scope inside the Catch block, set the NumberOfRetries property to 2, and place the extraction logic in the Try block.
C.Place the Retry Scope inside the Try block, set the NumberOfRetries property to 3, and place a Catch block for System.Exception that marks the item as failed.
D.Place the Retry Scope inside the Try block, set the NumberOfRetries property to 2, and place a Catch block for System.Exception that marks the item as failed.
AnswerD

This configuration places the Retry Scope around the extraction logic, so each failed attempt triggers a retry up to the NumberOfRetries limit. After the retries are exhausted, the Retry Scope throws the exception, which is caught by the Catch block that marks the item as failed, allowing the process to continue with the next item.

Why this answer

The Retry Scope must wrap the action that can fail so it can re-execute that action on failure. The Try Catch must wrap the Retry Scope so that when retries are exhausted, the resulting exception is caught and handled by marking the item as failed. Setting NumberOfRetries to 2 gives two retries after the initial attempt, matching the requirement.

An empty Catch block would suppress the error and prevent proper item status updates.

Exam trap

The trap here is confusing the nesting order: placing Try Catch inside Retry Scope causes the first failure to be swallowed, so no retries occur, while placing Retry Scope inside Try Catch ensures retries happen before the exception is caught.

8
Multi-Selectmedium

A developer is implementing exception handling for a robotic process automation project that interacts with multiple applications. The developer wants to ensure that system exceptions are retried a limited number of times, while business exceptions are logged and the transaction is marked as failed. Which two activities or features should the developer use to achieve this? (Choose two.)

Select 2 answers
A.Use a While loop with a counter to manually retry the entire workflow on any exception.
B.Use a Try-Catch activity with multiple Catch blocks, one for System.Exception and one for BusinessRuleException.
C.Use the Retry Scope activity to automatically retry the activities that throw system exceptions.
D.Set the 'ContinueOnError' property to True for all activities that interact with applications.
E.Configure the Global Exception Handler to retry all exceptions a fixed number of times.
AnswersB, C

A Try-Catch with multiple Catch blocks allows handling different exception types separately. A Catch block for System.Exception can implement retry logic, while a Catch block for BusinessRuleException can log the error and mark the transaction as failed. This provides the required differentiation between system and business exceptions.

Why this answer

To handle system exceptions with retries and business exceptions with logging, the developer should use a Try-Catch with multiple Catch blocks to separate the handling logic, and a Retry Scope to automatically retry activities that throw system exceptions. The Retry Scope can be configured to retry a specified number of times, and any business exceptions can be caught and handled appropriately. This combination provides robust and differentiated exception handling.

Exam trap

The trap here is thinking that the Global Exception Handler can differentiate between exception types for retry purposes, but it is designed for unhandled exceptions and does not provide per-type retry logic.

9
Multi-Selectmedium

Which TWO of the following are best practices for effective exception handling in UiPath?

Select 2 answers
A.Catch the general 'System.Exception' type in all blocks to ensure no errors are missed.
B.Use the 'Log Message' activity within the 'Catch' block to record exception details.
C.Always re-throw the original exception at the end of every 'Catch' block.
D.Use meaningful custom error messages when throwing exceptions.
E.Place the entire workflow inside one massive Try-Catch block.
AnswersB, D

Logging exception details is critical for post-mortem analysis. By capturing the exception message and source, developers can quickly reconstruct the state of the process at the time of failure, which is essential for diagnosing production issues in complex automated workflows that run unattended.

Why this answer

Effective exception handling prevents process crashes and ensures meaningful errors are reported. Using specific exception types and logging descriptive messages allows developers to distinguish between business rule violations and technical failures. This distinction is critical for monitoring, as it helps stakeholders understand whether an issue is caused by faulty data or an unstable system, allowing for targeted remediation efforts.

Exam trap

Candidates often select generic default error messages or skip logging within catch blocks, making post-execution debugging and root-cause analysis extremely difficult.

10
Multi-Selecthard

A developer is configuring a Global Exception Handler in UiPath Studio. The handler uses a Try Catch activity and needs to decide whether to retry the failed transaction or terminate the process. Which TWO of the following statements about the Global Exception Handler are correct? (Choose two.)

Select 2 answers
A.The Global Exception Handler can only be used in unattended automation scenarios.
B.The Global Exception Handler can be configured to retry the entire workflow from the beginning automatically.
C.The Global Exception Handler can be used to catch exceptions that are not handled by any local Try Catch activity.
D.The Global Exception Handler can access the exception object and its properties to determine the type of error.
E.The Global Exception Handler can be used to catch exceptions thrown by the Orchestrator when starting a job.
AnswersC, D

The Global Exception Handler (GEH) is designed to catch exceptions that propagate up from the main workflow if not handled locally. It provides a centralized place to handle unexpected errors, log them, and decide on recovery actions. This is a core feature of the GEH.

Why this answer

The Global Exception Handler catches unhandled exceptions that propagate from the main workflow, and it provides access to the exception object for inspection. It does not automatically retry the workflow, nor does it catch Orchestrator-level errors or restrict usage to unattended scenarios.

Exam trap

The trap here is assuming that the Global Exception Handler automatically retries the workflow, when retry logic must be explicitly implemented.

11
MCQeasy

Which property in the 'Message Box' activity allows a developer to pause the execution until the user clicks a button?

A.Delay
B.Wait
C.None, the activity is synchronous by default.
D.Timeout
AnswerC

The Message Box activity is modal and synchronous, meaning it automatically pauses the robot's execution flow until the user dismisses the box. This built-in behavior is useful for simple debugging, though it should be removed before deploying to an unattended production environment.

Why this answer

The Message Box is a synchronous activity by design; it pauses the entire execution thread. Understanding this behavior is essential for debugging because it provides a simple way to manually inspect the UI or system state at specific points without setting complex breakpoints in the workflow during the initial phase of development.

Exam trap

Candidates often search for a non-existent property to make the Message Box asynchronous, forgetting that the activity is inherently synchronous and blocks the execution thread by design.

12
Multi-Selecthard

When dealing with 'SelectorNotFoundException', which THREE actions should a developer consider to increase the robustness of the automation?

Select 3 answers
A.Use dynamic selectors with wildcards for attributes that change frequently.
B.Always increase the 'TimeoutMS' property to a very high value like 300,000.
C.Use the 'Anchor' feature to identify elements relative to stable UI components.
D.Avoid using 'UiExplorer' as it generates overly complex selectors.
E.Use variables in selectors to make them dynamic based on runtime data.
AnswersA, C, E

Wildcards allow the robot to match UI elements even if parts of their attributes change, such as timestamps or dynamic IDs. This is a best practice for identifying elements in web applications where IDs are generated on the fly, significantly improving the selector's long-term durability.

Why this answer

SelectorNotFoundException is a common challenge in UiPath. Improving selector stability is critical because applications often change their UI structure dynamically. By using reliable attributes, wildcards, and anchors, a developer can ensure the robot remains functional despite minor interface changes, thereby reducing maintenance overhead and improving the overall stability and reliability of the automation solution in production environments.

Exam trap

Candidates often rely solely on hardcoded UI attributes, forgetting that combining dynamic variables, wildcards, and anchors is essential for robust automation.

13
MCQeasy

In the context of the Try-Catch activity, what is the purpose of the 'Finally' block?

A.To handle errors that occurred specifically in the 'Catch' block.
B.To execute code that must run regardless of success or failure.
C.To catch any remaining exceptions that the 'Catch' blocks missed.
D.To re-throw the exception that was caught in the 'Catch' block.
AnswerB

The 'Finally' block provides a guaranteed execution path for cleanup operations. Whether the 'Try' block succeeds or an exception is caught, the logic inside 'Finally' will run, ensuring that system resources are properly disposed of, which is essential for stable, long-running automation processes.

Why this answer

The 'Finally' block executes regardless of whether an exception occurred or if the 'Try' block completed successfully. This is crucial for cleanup tasks, such as closing file streams, releasing database connections, or logging end-of-process status. Mastery of this block ensures that resources are always managed correctly, preventing memory leaks or locked files that could hinder future process executions.

Exam trap

Candidates often mistake the Finally block for an error-handling catch mechanism, assuming it only runs when an exception occurs.

14
MCQhard

An unattended UiPath robot processes invoices by reading each PDF from a shared network folder, extracting the PO number, and posting it to an internal web application. Extraction works for most files, but a small subset of scanned PDFs fail OCR and throw a business-rule exception that should be logged and skipped without stopping the run. A separate class of failures — the internal web application returning HTTP 500 — must retry a few times before the item is abandoned. The developer wants a single structured design that distinguishes these two failure categories inside the per-invoice loop. Which approach should the developer implement?

A.Wrap the per-invoice processing in a Try Catch with a Catch block for System.Exception that logs the error, sleeps for 30 seconds, and then re-invokes the same workflow recursively until extraction succeeds.
B.Remove all Try Catch activities and rely solely on the Global Exception Handler, configuring it to catch BusinessRuleException and use the Continue activity to resume the For Each loop at the next invoice.
C.Wrap the per-invoice processing in a Try Catch whose Catch block filters on BusinessRuleException and continues the loop, and place the HTTP retry logic inside the Try block using a Retry Scope activity scoped only to the web-posting sequence.
D.Wrap the per-invoice processing in a Try Catch whose Catch block catches System.Exception and calls Rethrow, and configure a Global Exception Handler that logs the invoice number and resumes the next item.
AnswerC

BusinessRuleException is the correct UiPath exception type for deterministic, non-transient data problems such as unreadable scans, and catching it while continuing the loop skips the bad item without halting the run. The HTTP 500 is transient, so isolating the web-posting sequence inside a Retry Scope with a small attempt count lets it recover automatically. This single structure cleanly separates the two failure categories the scenario requires.

Why this answer

The scenario needs two distinct exception strategies inside the same loop: deterministic data failures that should be skipped, and transient HTTP failures that should be retried a bounded number of times. Catching BusinessRuleException and continuing the loop handles the unreadable scans, while a Retry Scope scoped to the web-posting sequence absorbs the HTTP 500 without affecting the rest of the item. Combining both in one Try Catch keeps the design structured and predictable.

Exam trap

The trap here is assuming that any catch-all handler or the Global Exception Handler can skip a single bad item and continue the loop, when only a properly typed Catch block inside the loop can do that.

15
MCQmedium

When debugging a process that involves a remote desktop (Citrix/RDP), which tool is best suited to verify that the robot can interact with elements correctly?

A.The Locals panel
B.UiPath Computer Vision
C.The Output panel
D.The Breakpoint debugger
AnswerB

Computer Vision is designed specifically for environments like Citrix where native selectors are unavailable. It uses AI to identify UI elements visually, making it the most robust tool for verifying interactions in virtualized environments during the debugging process when standard methods fail to work.

Why this answer

For remote environments, standard selectors often fail because the robot sees the entire window as a single image. Using UI Automation on Citrix requires specific extensions and tools like 'UI Explorer' with Image/OCR capabilities or 'Computer Vision'. Verifying these interactions during debugging is crucial because standard selector debugging is often insufficient in these virtualized and image-based UI environments.

Exam trap

Candidates frequently choose 'UI Explorer' as the primary tool. While it helps inspect elements, 'Computer Vision' is the specific technology designed to solve the interaction challenges posed by remote desktop environments.

16
MCQeasy

A developer is creating a workflow that must perform a cleanup action (such as closing an application) regardless of whether an exception occurs during the main processing. Which activity should the developer use to ensure the cleanup code always runs?

A.Try-Catch with the cleanup code in the Finally block.
B.A Sequence with the cleanup code at the end, outside any Try-Catch.
C.Try-Catch with the cleanup code in the Catch block.
D.Try-Catch with the cleanup code in the Try block after the main processing.
AnswerA

The Finally block in a Try-Catch activity always executes, regardless of whether an exception occurred or was caught. This makes it the ideal place for cleanup actions that must run unconditionally, such as closing applications or releasing resources. It ensures the workflow remains robust even when errors occur.

Why this answer

The Finally block is specifically designed to contain code that must execute regardless of exceptions. In UiPath, the Try-Catch activity includes a Finally section that runs after the Try and any Catch blocks, ensuring cleanup actions like closing applications or deleting temporary files are always performed. This guarantees resource release even when errors occur.

Exam trap

The trap here is assuming that code after the Try-Catch will always run, but if an exception is not caught, the workflow may terminate before reaching that code.

17
MCQhard

A developer is debugging a workflow that intermittently fails when interacting with a legacy application. The developer wants to capture the state of all variables and the call stack at the moment the exception occurs, without stopping the debugging session. Which feature in UiPath Studio should the developer use?

A.Enable the 'Break on Exception' option in the Debug ribbon and use the Locals and Call Stack panels when execution pauses.
B.Use the 'Step Into' debugging command to execute the workflow line by line until the exception occurs.
C.Add a Try-Catch activity around the entire workflow, log the exception message, and continue execution.
D.Set a breakpoint on the activity that throws the exception and use the Locals panel to inspect variables.
AnswerA

The 'Break on Exception' option causes the debugger to pause execution immediately when an exception is thrown, regardless of where it occurs. This allows the developer to inspect all variables and the call stack at the exact moment of failure. It is ideal for intermittent issues because it captures the state without needing to predict the failure location.

Why this answer

Enabling 'Break on Exception' in the Debug ribbon instructs UiPath Studio to pause execution immediately when any exception is thrown. At that point, the developer can examine the Locals panel for variable values and the Call Stack panel to see the sequence of workflow calls. This is the most efficient way to capture the state for intermittent failures without stopping the debugging session.

Exam trap

The trap here is confusing breakpoints with exception breakpoints; a regular breakpoint only pauses at a specific activity, while 'Break on Exception' pauses whenever an exception is thrown anywhere in the workflow.

18
MCQmedium

An automation developer is building a UiPath process that uses a Try Catch activity. Inside the Try block, a sequence of activities interacts with a desktop application. The developer wants to capture a screenshot of the screen only when an exception occurs, and also ensure that a specific cleanup activity runs regardless of whether an exception was thrown. Which configuration correctly achieves these requirements?

A.Place the screenshot activity in the Try block and the cleanup activity in the Catch block.
B.Place both the screenshot and cleanup activities in the Finally block.
C.Place the screenshot activity in the Finally block and the cleanup activity in the Try block.
D.Place the screenshot activity in the Catch block and the cleanup activity in the Finally block.
AnswerD

The Catch block executes only when an exception is thrown, so placing the screenshot activity there ensures it runs only on error. The Finally block always executes after the Try and any Catch blocks, regardless of whether an exception occurred, making it ideal for cleanup activities. This configuration meets both requirements precisely.

Why this answer

The Catch block is specifically designed to handle exceptions and runs only when an exception is caught, so placing the screenshot there ensures it is taken only on error. The Finally block always executes after the Try and Catch sections, making it the correct place for cleanup activities that must run regardless of success or failure.

Exam trap

The trap here is assuming that the Finally block runs only when an exception occurs, when in fact it always runs.

19
MCQmedium

A developer is debugging a UiPath workflow and wants to log the exact error message and stack trace of an exception caught in a Catch block. Which expression should be used to retrieve this information from the exception object?

A.exception.Message
B.exception.ToString()
C.exception.StackTrace
D.exception.InnerException.Message
AnswerB

The 'ToString()' method of an exception object returns a string that includes the exception type, the message, and the stack trace. This provides the exact error message and full stack trace, which is ideal for logging and debugging purposes. It is the most comprehensive single expression.

Why this answer

The 'ToString()' method of an exception object combines the exception type, message, and stack trace into a single string. This is the most complete way to capture error details for logging, as it includes both the exact error message and the stack trace, which are essential for debugging.

Exam trap

The trap here is assuming that the 'Message' property alone is sufficient, but it omits the stack trace that is crucial for debugging.

Ready to test yourself?

Try a timed practice session using only Debugging and Exception Handling questions.