Sei sulla pagina 1di 4

Basic QTP interview Questions and answers for Freshers

Hello Guys - on this page you will find frequently asked QTP interview questions for freshers in
MNCs like Cognizant, Infosys, TCS, Wipro, HCL, Mindtree, Tech Mahindra, Igate, Capgemini,
Accenture etc.

Here is the list of top 50/100 QTP interview Questions for freshers.

Q1. What is the latest version of QTP in the market?
Answer - Latest stable version of QTP is 11.

Q2. What is Environment Variable in QTP and why to
use it?
Answer - Environment variables are global variables in QTP and they are used to store the global
values like User Id, password of the APP. There are 2 types of variables 1. Built-in 2.User Defined.

Q3. What is the difference between local and shared
Object Repository in QTP?
Answer - Local object Repository is associated with particular action. While Shared object
repository is independent of action. We can associate the shared object repository to current test.

Q4. What is the default object synchronization
timeout in QTP?
Answer -The default object synchronization in QTP is 20 seconds.

Q5. What do you mean by checkpoints in QTP?
Answer - Checkpoints are nothing but verification points in QTP. We can verify if particular property of
the object has specified value in checkpoints.
Q6. How to check which add-ins are associated with
a test in QTP?
Answer - To see which add ins are associated with the test in QTP, you have to open the test settings
in QTP and then select properties of test. There you will find the list of add-ins that are associated
with the test.

Q7. How to find the path of folder in which test is
saved in QTP?
Answer -To get the path of the test you can access built-in environment variable called "TestDir"

Q8. How to find the name of machine where you are
running your automation scripts in QTP?
Answer -To get the name of machine, you can access built-in environment variable called

Q9. What is the extension of Recovery Scenario file
in QTP?
Answer - Recovery Scenarios in QTP are saved in file with extension .qrs which stands for quicktest
recovery scenario. In one qrs file you can have multiple scenarios defined in it.
Q10. What is the extension of shared object
repository in QTP?
Answer - Shared object repository in QTP is stored in .tsr file. You create .tsr file using export option
in local repository. To edit .tsr file you have to open .tsr file in object repository manager and then
modify it.

Q11. How to associate shared object repository to
test in QTP?
Answer -To associate shared object repository you have to go to Resources->Associate Repositories
option and then choose and select the .tsr file and associate it with particular or all actions in test.

Q12. How to merge 2 shared object repositories in
Answer -To merge 2 shared object repositories in QTP, you have to open object repository
manager tool and then select merge tool in Tools menu.

Q13. What is the use of object spy tool in QTP?
Answer -QTP provides one tool called object spy that can be used to find out the properties and the
values of the object in QTP.

Q14. How to find the length of string in QTP?
Answer -You can find the length of the string using one vb script function called len.
Suppose you want to find the length of "salunke" then you will have the below statement which will
print the length of string .
print len("salunke")

Q15. How to find the current system time in QTP?
Answer - You can find the current system time using Time function in vbscript.
Print time

Q16. How to Comment a line in QTP script?
Answer - You can comment the line using rem or '.
' this line is commented.
rem this line is also commented.

Q17. What is the difference between QTP and
Answer - QTP is not open source tool while Selenium is open source tool.
We can use QTP to test different kinds of applications like web, .net, java, mainframe, peoplesoft etc.
But Selenium is used only for Web application testing. QTP supports only vb script as language but
we can develop selenium scripts using JAVA, .Net, Ruby, Perl etc.

Q18. How to remove all spaces from given string in
Answer - We can use replace function in vbscript to remove all spaces in string.
e.g. newstring = replace(stringwithspaces," ","")

Q19. How to find the modulus of a number in QTP?
Answer - We can find the modulus of given number using MOD operator.
a = 10 mod 5
print a

Q20. How to find the length of array in QTP?
Answer - To find the length of array, we can use ubound function in QTP.
print ubound(arr) - 'prints upper bound of array.

Q21. What is difference between byref and byval in
Answer - You can pass the parameters to function or procedure using byref or byval method.
byref will pass the address of variable but byval will pass the copy of variable. So when you want the
passed value to change, you can pass the value using byref method. Otherwise you can pass it using
byval method.

Q22. How to find the difference between 2 dates in
Answer - You can find the difference between 2 dates using datediff function. You can get the
difference in terms of minutes, seconds, hours, months or years.

Q23. How to check if given variable is scalar or array
in QTP?
Answer - You can use Isarray function to check if variable is array or not.
abc = IsArray(vartotest)
If vattotest is array variable, abc will contain true else false.

Advanced QTP Interview Questions and Answers For
Experienced Guys
Well on this page you will find all the advanced QTP interview Questions and their answers.

Here is the list of top 50/100 Advanceed QTP interview Questions for experienced professionals.

Q1. When Should we use Descriptive Programming
in QTP?
Answer - As you must be knowing, QTP identifies objects using either Object Repository or
Description Programming. So you might wonder that in which Scenrios we should use Description
here is the list of scenarios where descriptive programming is better than Object Repository.
Same object exists in different windows/screens of your application. If you use OR in this
case, you will have to store the same object under different object hierarchy in OR. So to handle this
situation we can access this object using description programming. This will help us remove duplicate
In certain situations, It is not feasible to store the objects inside OR. For example - If you want
to print all the links (say 100 links) on the webpage, You should not store all links in OR. But you
should use Description programming to access those links.

Q2. What is settoproerty and when to use it in QTP?
Answer - Settoproperty stands for set test object property. At run time you can edit the property
values of the object. When execution ends the value of the property is not saved in OR.So changes
you make to OR using settoproperty are temporary.
You need to use this method when object values change at runtime. Thus by changing the value of
the property at run time you can identify the object.