RPA UiPath Frequently Asked – Interview Questions – Set 3

1. Why do we always use Excel as a configuration file in ReFramework? Can’t we use .txt or .csv or .json files instead of it?

We can actually use any of the above-mentioned file types as a configuration file, but we prefer an excel file because of its tabular form, it’s considered to be a more readable and easier-to-edit tool among all the above-mentioned types.

2. What is the difference between For Each, While, and a Do While activity?

Let’s first understand the meaning of a loop:

In computer programming, a loop can be defined as a sequence of instructions or statements that are continuously being repeated until a certain condition is reached.

The above can be achieved in UiPath Studio by using the following activities:

1. For Each Activity

2. While Activity

3. Do While Activity

But the main frustration comes when we don’t know when to use which activity, right?

No worries, let’s dissect them a bit.

For Each Activity

Use this when you are sure about the number of iterations you need to run, here the input can be an array, list, or any enumerable.

Example: When we have a basket full of oranges(Here basket means array or list), we take each one out and check for its quality and sell it if it’s good or throw it if it’s spoiled ( Here each orange refers to each element in the array or list)

While Activity

Use this when you are not sure about the number of iterations you need to run and the condition on which the loop should be checked changes based on what you do inside the loop.

Example: As long as the search button of a web app exists on the screen, the While Activity will keep displaying the Message – “Google Search Exists on the screen” on the screen.

But once you close the browser, it will fail and terminate the loop.

Do-While Activity

Use this when you want to run something at-least once and based on the conditions run it further till the condition fails.

Example: When you want a “Welcome” Message to be displayed on the screen irrespective of google search button exists or not, and then search for the google search button then we use the Do While Activity

There are a lot of examples and applications available for these activities and each one should be used accordingly.

3. What is the difference between Screen scraping and Data scraping?

Screen Scraping: This functionality is used to get a single text value from the screen.

Data Scraping:  This is a very helpful functionality when we are trying the scrap data of type tabular form from a browser, application, or document.

4. What types of exceptions will be retried in UiPath?

There are two types of Exceptions in UiPath

1. Business Exception
2. System Exception

1. A Business exception can be defined as a user-defined exception, it is explicitly thrown by the process when certain criteria defined for the process are not met
i.e. If the phone number contains any alphabet in it, the Provided date is out of the required date range.
Retrying the transaction does not solve the issue, so we basically notify the user about this error.

2. A System Exception can be defined as unknown exceptions which are generated by the end applications (which are automated) or slow network issues
i.e., Application not responding, while connecting to the database, while performing string manipulations.
These types of exceptions have a chance of being solved by retrying the transaction. So, only System exceptions are retried in UiPath.

5. What is a Nuget Package?

NuGet (pronounced “New Get”) is a package manager designed to enable developers to share reusable code.

Put simply, a NuGet package is a single ZIP file with the .nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package’s version number.

UiPath accepts the code in the form of a Nuget package. When you publish a project to the orchestrator or to the local drive. It is actually stored as a Nuget Package.

Even the Custom activity that we create is actually packaged as a NuGet package.

6.What is a reusable component in UiPath?

Any Workflow which can be used at different places in a project.
Ex: Login Module specific to an application can be re-used and the module can be shared with the team for use rather than building the workflow from scratch.

A reusable component can be a single XAML or a library.

This actually helps in rapid development as we will have the modules already ready with us when starting up a project.

And also it is a good practice to create smaller modules while managing a bigger or more complex project.

Additional Reference: How to create a Library in UiPath?

7. What is the purpose of the Try-Catch activity in UiPath?

The try Catch function in UiPath is similar to any other Try Catch implementations in other Programming languages.

Whenever we surround any activity or workflow with Try Catch, any exception that occurred inside it goes to the catch block and logic inside the catch block gets executed.

As we can see in the above screenshot:
Try Block is the place where we add our activities, which are to be executed.

And if there arises an exception while executing them, the Catch Block will be executed

And there is another block which we can see, the Finally block – It will be executed always(Irrespective of whether the error occurs or not).

8. Can you please name a few of the exceptions that you have faced during your automation?

Based on the type of automation that we are performing, we might have different exceptions – below are a few of them:

UiPath.Core.SelectorNotFoundException – This is one of the most seen common exceptions when we are working on UI Automation and the elements are not available on the screen during execution.

System.NullReferenceException – This exception/error mostly occurs when we are using a variable or performing any operation on it with no value set to it.

System.IO.FileNotFoundException – This exception occurs when we are trying to access a file that doesn’t exist.

System.IndexOutOfRangeException – This Exception occurs when we are trying to access an element in an array, list, or a datatable when it doesn’t actually exist.

System.OutOfMemoryException – When data or data sets that reside in memory become so large that the common language runtime is unable to allocate enough contiguous memory for them, an OutOfMemoryException exception results.

System.invalidcastexception – An InvalidCastException exception is thrown when the conversion of an instance of one type to another type is not supported. For example, attempting to convert a Char value to a DateTime value throws an InvalidCastException exception.

9. How can we retrieve the file name along with the extension from the file’s full path?

Suppose we the following path with us:

“C:\Users\User\Desktop\Sharath\RPA UiPath.txt”

System.IO.Path:  This is an important class in .NET – It provides built-in methods.

It helps when handling file paths. It is part of System.IO.

We can use the below code get the filename

Input: (“C:\Users\User\Desktop\Sharath\RPA UiPath.txt”)

Code: Path.GetFileName(“C:\Users\User\Desktop\Sharath\RPA UiPath.txt”)

Output: RPA UiPath.txt

There are many other options available to us

Important Methods and their uses:
The following list provides a sampling of the methods available in the Path
class:

ChangeExtension: This allows you to change the file
extension of a path string.

Combines: Allows you to combine
two path strings into one.

GetDirectoryName: Returns the directory
information included in a path string.

GetExtension: Returns the extension included
in a path string.

GetFileName: Returns the file name and
extension of a path string.

GetFileNameWithoutExtension: Returns the file name without
the extension for a path string.

GetFullPath: Returns the absolute path for a
path string.

GetInvalidFileNameChars: Returns a
character array containing the characters not allowed in file names.

GetPathRoot: Returns the root directory
information for a path string.

GetRandomFileName: Returns a random file or folder
name.

GetTempFileName: A uniquely named, zero-byte
the temporary file is created with the full path returned.

GetTempPath: The path to the system’s
temporary directory is returned.

Extension: Determines if a path string
contains an extension (true) or not (false).

IsPathRooted: Gets a value indicating whether
the specified path string contains absolute or relative path information.

10. How to Split a string in UiPath?

Sometimes we might want to break down a string datatype value into an array of substrings based on some separator.

A separator can be a space, a comma, a newLine e.t.c

Implementation using UiPath :

Let’s develop a project which takes a string value consisting of numbers separator by comma and displays the values.

Step 1:
Drag “Assign” activity into the designer panel and initialize the string variable with some sample data as shown below.

numbers_Data = “1,2,3,4,5”

Step 2:
Drag “Split String” activity into the designer panel and supply the below-mentioned parameters.

Input: numbers_Data
Result: result_List (Array of strings)
Separator: “,”

Step 3:
Drag “For Each” activity into the designer panel and supply the above-created list variable to it.
Then, drag “Message Box” activity to display the values available in the list variable.

Step 4:
Finally, execute the project to display all the values available in the list one by one!!!

And another way to do the same would be by using the below piece of code:

If the input is numbers_Data = “1,2,3,4,5”

Code: numbers_Data.Split(”,“c)  i.e. Here the delimiter is a comma

Output: Array of Strings

Leave a Reply