RPA UiPath Frequently Asked – Interview Questions – Set 4

1. What are the different approaches to removing new lines available in a text string?

Let’s look at different ways of doing it:

Solution 1:

If we have the input string as:

Hello Sharath

Hope you are doing

well

Let’ write the code to handle it:

System.Text.RegularExpressions.Regex.Replace(myText, "\t|\n", "")

The \n symbol means literally new line. This will go to the start of the next new line.

The \t symbol means to add a tab (which is usually 4 spaces but can easily be 2 or 8 depending on the context).

Output:

Solution 2:
Code: myText.Replace(Environment.newLine,"")
Solution 3:
Code: myText.Replace(vblf,"")

2. How can you get unique values from a specific column from a DataTable in UiPath?

There a different ways to do it, let’s look at few of them:
Solution 1:

myDT.DefaultView.ToTable(true, “Name”)

Where,

myDT is our DataTable

“Name” is our Column name for which we want unique values

Let’s have a look at how it can be implemented in UiPath:

Solution 2:

We can use the below LINQ query to achieve it, but it will be a bit complex way compare to the above

myDT = myDT.AsEnumerable().GroupBy(Function(i) i.Field(Of String)(“columnWithDuplicates”)).Select(Function(g) g.First).CopyToDataTable

Note:
1. Useful when we are removing duplicates with respect to some “Column” name
2. Simply replace the “columnWithDuplicates” with your required column name.

3.What do you mean by “The given key was not present in the dictionary” error?

This error occurs when we try to access a dictionary element using a key that does not exist in it.

In .Net, the Dictionary class is a generic collection of keys and values pair of data. The Dictionary class is defined in the System.Collections.A generic namespace is a generic class and can store any data type in a form of keys and values.

Each key must be unique in the collection so that you can then use that key to access its corresponding value.

Example:

A dictionary looks like

my_Dictionary = {ID: “1”, Name: “Sharath”, Company: “Apple”}

When we want the value of ID, we can use my_Dictionary (“A”) and you will get the value 1.

Let’s implement it in UiPath:

Here we have initialized a dictionary called in_config and added some items to it called ID and Name.

But now we have tried accessing the COMPANY name which wasn’t added to it, now when the flow is executed, we can expect the mentioned error, please find the below screenshots.

Error:

In a scenario where you try to fetch the value of a key that is not available in the dictionary, then you will encounter the above error.

Here we got the error because we were trying to access the value “Apple” by using “Company” which was not added to the dictionary itself.

4.What are the different log types available in Log Message activity in UiPath?

Log Message Activity will actually allow us to log important information at specific stages of the process wherever required.

Depending on the option selected from the Log Level drop-down list, the message or the information will be logged which can be later analysed.

It accepts only string as input.

We have the above options available:

Fatal: This is an error that causes a program to abort and may therefore return the user to the operating system. When this happens, data that the program was processing may be lost and terminate prematurely

Error: It is an issue caused by some unexpected activity which has the potential to stop the entire process but most of the times the error allows an app to continue executing, but causes it to produce incorrect results. It is mostly similar to fatal but not as serious as it.

Warn: Warnings reports the unusual findings detected when running a program that may indicate a problem, although compilation can proceed.

Info: This can be helpful when we want to log some information at a specific point of execution which can be useful during auditing in the future.

Trace: This type of logs, stores all the minute details of the process during its execution and this are mostly preferred when we try to debug an issue to find it’s root cause.

5. What is the importance of project.json file in UiPath project? What happens if we delete it?

project.json is an automatically generated file which is created while creating a project in UiPath Studio.

It contains the various details regrading the project being implemented, some of them are

  • Title of the project
  • Description of the project
  • Project Dependencies
  • The version of Studio used to create the automation project
  • The version used when publishing this project to a feed
  • The language set for the process (VisualBasic or CSharp)

If project.json file is deleted, we wouldn’t be able to execute the project.

We would be faced with the below error if you try to run the project.

6.. What’s the need of debugging, can you please also mention the steps you follow? And how is it different from testing?

Debugging, in computer programming, is a process that involves identifying a problem or a bug, isolating the source of the problem and then either correcting the problem or determining a way to work around it.

The final step of debugging is to test the correction or workaround and make sure it works.

The basic steps in debugging are:

1. Recognize that a bug exists.

2.Isolate the source of the bug.

3.Identify the cause of the bug.

4.Determine a fix for the bug.

5.Apply the fix and test it

Testing vs Debugging

Testing and debugging are important activities during software development and maintenance.

Testing is performed to check if the code contains errors whereas Debugging is done to locate and fix these errors.

7. Can you please explain the difference between List, Array and Dictionary?

Use an Array when you work with a sequence of elements of same type or need to randomly access an element at a given index (0, 1, 2, …)

new string(){“value1?,”value2”}

Use a List when you are working with a collection of elements of same or different type or need to randomly access an element at a given index (0, 1, 2, …), In list it is possible to add duplicate records

new List(of string)(new string(){“value1?,”value2”})

Use a Dictionary when you have key/value format and need fast retrieval via key. In dictionary key must be unique. It is not possible to add duplicate key in dictionary.

The reason is because a dictionary is a lookup, while a list is an iteration

New Dictionary(Of String, Object) From{{"ID", "1"},{"Name", "Sharath"},{"Country", "India"}}

Which one of these is faster?

Dictionary uses a hash lookup so it’s faster, while your list requires walking through the List/Array until it finds the result from beginning to the result each time.

8.What is the difference between Watch Panel and Immediate Panel?

All the below panels are visible only during the debugging state:

Local Panel
It is helpful to understand the current values and data for various variables and arguments and also helps you understand the previous run and current run details.

Watch Panel
can be set to display the values of variables or arguments, and values of user-defined expressions that are executed till that point of time but the only difference here is it helps you concentrate only on specific things that you need to monitor rather than displaying all the information available like Local panel

Immediate Panel
It can be used for inspecting or understanding the data available at a certain point during the debugging state. It can help us understand the various aspects of variables, arguments and expressions. This can be done simply typing the variable or argument name in the Immediate window with any specific method if needed along with it and pressing the Enter button.

9.Can you please explain about LINQ and its  advantages and disadvantages?

LINQ stands for Language Integrated Query and it can be used to programmatically access and manipulate any data from different types of data sources such as Objects(Lists, Arrays, Strings..), SQL, XML, etc. using C# or VB.Net

The LINQ functionality can be achieved by importing System.Linq namespace in our applications.

Advantages:

  • LINQ provides full type checking at compile-time and supports IntelliSense. This powerful feature helps us to avoid run-time errors.
  • LINQ also allows debugging which can be useful while troubleshooting.
  • Most of the LINQ queries are reusable.
  • LINQ provides powerful filtering, ordering, and grouping capabilities with minimum application code.

Disadvantages:

  • If the LINQ query is not well optimized then the performance might degrade.
  • Sometimes it’s a tedious work to understand advanced LINQ query statements.
  • LINQ fails to take the full advantage of database features when compared to SQL queries.

LINQ vs SQL

The main difference between LINQ and SQL is that LINQ is a Microsoft .NET framework component, which adds native data querying capabilities to .NET languages, while SQL is a standard language to store and manage data in RDBMS.

10. What is the use of UI Explorer in UiPath? Uninstalling which package will affect it’s availability?

UI Explorer is an advanced tool that enables you to create a custom selector for a specific UI element. It is available as a standalone tool you can download from the Resource Center in your Automation Cloud instance, or from Studio only if the UiPath. UIAutomation.

Example:

Let’s consider we are planning to automate notepad task, and we are required to click on “Format” option

Below is the selector for Notepad.exe app’ format button, as per the requirement we can add/remove the attributes.

It basically helps us with fine tuning the selectors while automating a process so that we get more stable selectors which are immune to minor changes at UI level.

UI Explorer deals with UI Activities, so the presence of UiPath.UIAutomation.Activities package as a dependency to the project actually defines the availability or the non- availability of this tool in the UiPath Studio. Once you uninstall UiPath.UIAutomation.Activities package, the UI Explorer will not be available to us.


Leave a Reply