Tuesday 30 July 2013

Explain Ubound function in QTP.

Ubound stands for upper bound. This functions is used to find the upper bound of the array.

Syntax -

ubound(arrayname, dimension)

It returns the upper bound of the arrayname and dimension used is specified in second parameter.
By default dimension is 1.

Example -

Single dimension array

Dim a(2)
'Declare an array with upper bound (index) as 2.

a(0) = 0
a(1) = 0
a(2) = 0

print ubound (a)           'will print 2
print ubound (a,1)        'will print 2

'This will print the value 2 as upper bound of the array is 2.

Please note that size or length of the single dimension array is ubound + 1.

Multi dimension array

Dim b(2,3,5)

print UBound(b, 1)           ' will print 2

print UBound(b, 2)           '  will print 3

print UBound(b, 3)           '  will print 5


More interview questions and answers on arrays in QTP are given below.
  1. What is the difference between dictionary and array in QTP?
  2. How to create dynamic 2 dimensional array in QTP?
  3. How to sort array of strings in qtp?
  4. How to create array of dictionary in qtp?
  5. How to define or declare array in qtp?
  6. How to return array from function in qtp?
  7. How to find the length of array in qtp?
  8. How to find the size of array in qtp?
  9. Explain the ubound function in qtp.
  10. Explain the split function in qtp with example.
  11. What is dotnetfactory object in qtp?

Please give your inputs, suggestions, feedback to Us. We value your thoughts.

No comments:

Post a Comment

Please Leave your reply. We value your feedback and inputs

Best QTP Books

Everything About QTP

Hello Friends,
You can find QTP study material, Multiple choice questions (mcq), QTP question bank, QTP question papers, QTP notes, QTP questionnaire, scenario based QTP interview questions, QTP tutorial and QTP training on this site.

If you are a fresher or experienced QTP professional with (1/2/3/4) years of experience, this blog is just for you.