Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write the vb script for the lowest and highest values of an
array?



Write the vb script for the lowest and highest values of an array?..

Answer / pramod mallick

Dim x(5)

x(0) = 1
x(1) = 3
x(2) = 3
x(3) = 5
x(4) = 2


Dim y
Dim strArray

'Display
For y = LBound(x) To UBound(x)
strArray = strArray & x(y) & ","
Next

MsgBox "Before Sorting " & strArray

Dim z
'Demo loop
For z = LBound(x) To UBound(x)

For y = LBound(x) To UBound(x) - 1

Dim lower As Integer
Dim higher As Integer

If x(y) > x(y + 1) Then
higher = x(y)
lower = x(y + 1)
x(y) = lower
x(y + 1) = higher
ElseIf x(y) > x(y + 1) Then
higher = x(y)
lower = x(y + 1)
x(y) = lower
x(y + 1) = higher
Else 'equal
'do nothing
End If

Next
Next


'Display
strArray = ""
For y = LBound(x) To UBound(x)
strArray = strArray & x(y) & ","
Next

MsgBox "After sorting " & strArray

msgbox "Lowest is " & Lbound(x) & "Highest is " Ubound(x)

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More QTP Interview Questions

how to write xml output check point bu useing descriptive programing .means without useing output check point

0 Answers  


What is the default object synchronization timeout in qtp?

0 Answers  


am not having intrest in coding lang like c c++ java etc can i choose Testing tools as my carrier and please suggest me which tool is good (suitable for me)

0 Answers  


why qtp supports vbscript? and not for others just like cgi,phython,shell,perl,html and all..

4 Answers   Cap Gemini,


In an interview, what r the general questions asked in QTP? pls give me anwser to this question?

0 Answers  


i have asked earlier only one question how to test web application using QTp plz send me the answer quickly

0 Answers  


What do you to script when objects are removed from application?

0 Answers  


How to open any application during Scripting in QTP?

7 Answers   Celgene, IBM,


What is object identification?

8 Answers   Wipro,


can u store QTp frame work folders in VSS? If Not where u store those?

1 Answers  


Could any one suggest web site links to learning VB Script for QTP purpose??

3 Answers  


How to face prjoect manager round what type of questions they will Ask ? (Chandana)

1 Answers   Call Centre, Convergys, IBM,


Categories