UiPath AI Specialist v1 — Question 139

A developer utilized the Add Data Row activity to insert a row into a data table called "dt_Reports". However, during runtime, UiPath Studio encounters an exception, "Add Data Row: Object reference not set to an instance of an object," because the data table has not been initialized.

To rectify this issue, what should the developer include in an Assign before the Add Data Row activity?

Answer options

Correct answer: B

Explanation

The correct answer is B because initializing 'dt_Reports' as a new System.Data.DataTable object is necessary before adding rows to it. Option A is incorrect since it tries to create a DataRow instead of a DataTable. Option C is wrong because a List of DataRow does not serve as a DataTable. Option D is incorrect as it attempts to assign a new DataTable to 'dt_Reports' incorrectly.