UiPath-ADPv1 Advanced Data Manipulation Practice Question
A developer is using a 'For Each' activity to iterate over a DataTable and needs to access the value of a column named 'Amount' for each row. The column may contain DBNull.Value for some rows. Which expression safely retrieves the amount as a Decimal, handling DBNull by returning 0?
⚠ Common exam trap
The trap here is assuming that CDec or Field(Of Decimal) will automatically handle DBNull, when they actually throw exceptions.
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
✓
If(row.IsNull("Amount"), 0D, CDec(row("Amount")))
The correct expression uses row.IsNull to check for DBNull and the If operator to return 0D when null, otherwise convert to Decimal. This safely handles null values and avoids exceptions. Other options either throw exceptions on DBNull or incorrectly parse the value.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Decimal.Parse(row("Amount").ToString())
Why it's wrong here
This attempts to convert the value to a string and then parse it as Decimal. If the value is DBNull, calling ToString() returns an empty string, and Decimal.Parse throws a FormatException. Additionally, if the value is already a Decimal, converting to string and back is inefficient and may lose precision. This approach is not safe for DBNull.
- ✗
CDec(row("Amount"))
Why it's wrong here
CDec attempts to convert the value to Decimal, but if the value is DBNull.Value, it throws an InvalidCastException. This does not handle DBNull safely. The developer would need to check for DBNull before conversion or use a method that handles it, such as If(row.IsNull("Amount"), 0, CDec(row("Amount"))).
- ✗
row.Field(Of Decimal)("Amount")
Why it's wrong here
The Field extension method is available in .NET but in UiPath, it may not be directly accessible without importing System.Data.DataSetExtensions. More importantly, if the column value is DBNull, Field(Of Decimal) throws an InvalidCastException. It does not automatically convert DBNull to 0. Thus, it does not handle nulls safely.
- ✓
If(row.IsNull("Amount"), 0D, CDec(row("Amount")))
Why this is correct
This expression uses the If operator to check if the 'Amount' column is null via row.IsNull. If null, it returns 0D (Decimal zero); otherwise, it converts the value to Decimal using CDec. This safely handles DBNull and returns a Decimal, meeting the requirement.
About these practice questions
Courseiva writes every UiPath-ADPv1 question from scratch — 276 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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-ADPv1 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-ADPv1 exam.