ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Testing  >>  Automation Testing  >>  QTP
 
 


 

 
 WinRunner interview questions  WinRunner Interview Questions
 Load Runner interview questions  Load Runner Interview Questions
 QTP interview questions  QTP Interview Questions
 Test Director interview questions  Test Director Interview Questions
 Rational TestSuite interview questions  Rational TestSuite Interview Questions
 Silk Test interview questions  Silk Test Interview Questions
 Automation Testing AllOther interview questions  Automation Testing AllOther Interview Questions
Question
write vb script code to delete the duplicate values in an 
array.
 Question Submitted By :: Damodhar
I also faced this Question!!     Rank Answer Posted By  
 
  Re: write vb script code to delete the duplicate values in an array.
Answer
# 1
dim a
aList=Array(5,5,5,5,12,10,15,10,125,5)
Dim sNewList
dim newArray
b= ubound(aList)

For x=0 to b
	If InStr(sNewList,(aList(x) & ",")) <= 0 Then
  sNewList = sNewList & aList(x) & ","
 End If


Next
newArray = split(sNewList,",")
MsgBox sNewList
 
Is This Answer Correct ?    5 Yes 0 No
Guest
 
  Re: write vb script code to delete the duplicate values in an array.
Answer
# 2
There are many ways this script can be written.
One simple algo which i followed was:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''Script Starts Here'''''''''''''''''''''''''''''''

Option Explicit 

Dim i, j, k, aMyArr, aNewArr( ), iNewIndex, iNewLim, bFlag

bFlag = 0 

aMyArr = Array("AA","BB","AA", "BB" )

iNewIndex = UBound(aMyArr)

ReDim aNewArr(0)
aNewArr(0) = aMyArr(0)

For  i=0 To  UBound(aMyArr)

	iNewLim = UBound(aNewArr)

	For j = 0 To iNewLim
		 If  aMyArr(i) = aNewArr(j) Then
			bFlag = 0  
			Exit For
		Else 
				bFlag = 1
		End If
    Next

	If bflag = 1 Then
		k=iNewLim+1
		ReDim Preserve aNewArr(k)
		aNewArr(k)=aMyArr(i)
	End If
			
Next

' To display the new array...
For i = 0 to UBound(aNewArr)
	msgbox aNewArr(i)
Next


Erase aMyArr
Erase aNewArr

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''Script Ends Here'''''''''''''''''''''''''''''''

Please let me know if it satisfies ur query.
 
Is This Answer Correct ?    2 Yes 0 No
Jay Prakash
 
 
 

 
 
 
Other QTP Interview Questions
 
  Question Asked @ Answers
 
I have a Webedit object. some text is entered in that object I want to know the font sixe of that text.How could I do this using QTP? This is a requirement for me. I am happy if any one help on this GE3
In an(AUT) web application their are two frames as fraMain and fraFooter. Both the frames contain link which needs to be retrieved at a single step. I tried it using "Regular Expression" as fra.* but QTP doesn't recognize the object. So Plz help me out to get resolve the problem:-)  1
how do u copy object repository?  1
How many function you use in your application? Polaris1
what is the diff between Procedure and function iFlex3
What is the latest version in QTP? Polaris26
This is Ajay i have few douts if anybody know pls give me reply. 1. i have opend 2 gmails i am working with 1 gmail i want to close other gmail by usig script. 2.i have 10 links in a page all of them have same properties& names i want to click on 5link by using script. 3.i have one combobox in that i want to see all the citynames in the combobox and i have to check weather hyderabad is present or not. 4. size of objectrepository. 5.what r problems we get during writing the script. 6.is it possible to compare to excel sheets in qtp if possible wht is the script. 7.example for lowlevelrecording Symantic-Space2
Hi All Below is my script which i made for lgin into Flight.exe. SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open" Dialog("Login").WinEdit("Agent Name:").Set DataTable ("p_Text", dtGlobalSheet) Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure DataTable ("p_Text1", dtGlobalSheet) Dialog("Login").WinButton("OK").Click If Dialog("Login").Dialog("Flight Reservations").WinButton ("OK").exist Then Dialog("Login").Dialog("Flight Reservations").WinButton ("OK").Click datatable.Value(3)= "Incorrect password. Please try again" Dialog("Login").WinButton("CANCEL").Click elseif Dialog("Login").Dialog("Flight Reservations").WinButton("OK").exist Then Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click datatable.Value(3)="Please enter agent name" Dialog ("Login").WinButton("CANCEL").Click elseif Dialog("Login").Dialog("Flight Reservations").WinButton("OK").exist then Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click datatable.Value(3)= "Please enter password" Dialog("Login").WinButton ("CANCEL").Click else Window("Flight Reservation").Move 309,146 datatable.ExportSheet "C:\Raj\Result.xls" ,1 Window("Flight Reservation").Close End If I want to capture the Message string from Dialog("Login").Dialog("Flight Reservations" Also pls let me know if this is the right way to do the script for login. Pls provide some script for login Flight.exe Thanks in advance Raj Dhiman  1
in QTP,how to write a descriptive program for "yahoo" or "gmail" Login page  1
How to enable the text check point in qtp? By default it is disables ssinformatics1
How to make "TEST Batches" in manual testing . How it is possible plz explin in detail?  1
what is virtual object?  2
in QTP we test web based application at that time what script is run? is support vb script? plz tell me  3
Hi, Can anyone write the following qtp script...please its urgent ·Navigate to Google in a new IE instance ·Search for the following word "Gap, Inc." ·Iterate thought the first 10 pages of google ·On each page collect the following ·The "blue" page title ·The "green" url ·Output all the data into a file named "test_output.txt" ·Format "Title – URL"  1
Can we directly automate testscripts accrdoing to requirements Novartis2
.mtr ( modular test repository or mercury test repository) plz give correct answer??  3
HI. Plz Clarifie my doubt,having 2+yrs experience in Testing , But My accedamics(Xth,INTER) are Less than 60%, But B.Tech 72%. It creats any problem , When i change to any MNC. plz tell me......... lot of friends told it's a problem, Some people says NO problem, What .............  3
How to parameterize Object Repository?  2
how to do spell check in QTP? reply please  7
is it possible to map an image as standard Object or u've to treat as virtual? how to map an Dynamic image into standard object?  1
 
For more QTP Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com