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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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
When and why do you use "OPTION EXPLICIT" in VB Script.
Is there any online help or something to learn the script 
for Beginners?
 Question Submitted By :: Siva
I also faced this Question!!     Rank Answer Posted By  
 
  Re: When and why do you use "OPTION EXPLICIT" in VB Script. Is there any online help or something to learn the script for Beginners?
Answer
# 1
On the top of the QTP script if u write Option Explicit 
that means u r going to define every variable u r going to 
define every variable u r using in the script as DIM.
  for an example if u want to define an array ......
  Option Explicit
 Dim A(10)
  
 
Is This Answer Correct ?    4 Yes 2 No
Minni
 
  Re: When and why do you use "OPTION EXPLICIT" in VB Script. Is there any online help or something to learn the script for Beginners?
Answer
# 2
When you use the Option Explicit statement, you must 
explicitly declare all variables using the Dim, Private, 
Public, or ReDim statements. If you attempt to use an 
undeclared variable name, an error occurs.

VBScript ingeneral doesn't need variable declaration. For 
example without using "Dim" a variable can be directly used 
for assigning etc. For ex: temp=1

However, such practise can always be error prone. Ex: if i 
want to use the same variable in someother statement and 
miss spell it,say 

tempe=temp+1

VBScript still considers "tempe" as valid. This case if we 
use OPTION EXPLICIT On top of our application and proceed 
then application will not proceed unless until u declare 
each and every variable. Hence u make sure that ur variable 
is serving ur purpose.

in this example u recognize that "tempe" is not desired. 
Hope this clarifies.
 
Is This Answer Correct ?    7 Yes 0 No
Pallavi Nandula
 
 
 
  Re: When and why do you use "OPTION EXPLICIT" in VB Script. Is there any online help or something to learn the script for Beginners?
Answer
# 3
Hi: 
Pallavi, Thank you very much for the elobarate answer.
I got the thing...

Can you also tell me the exact difference between
GUI and UI.

Thank you 
Siva..........
 
Is This Answer Correct ?    2 Yes 1 No
Siva
 
  Re: When and why do you use "OPTION EXPLICIT" in VB Script. Is there any online help or something to learn the script for Beginners?
Answer
# 4
Use Option Explicit to avoid incorrectly typing the name of
an existing variable or to avoid confusion in code where the
scope of  the variable is not clear.

when you use Option Explicit statement,you must explicitly
declare all variables using the Dim,Private,Public or ReDim
statements.If you attempt to use an undeclared variable
name,an error occurs.
 
Is This Answer Correct ?    2 Yes 1 No
Shilpi
 
  Re: When and why do you use "OPTION EXPLICIT" in VB Script. Is there any online help or something to learn the script for Beginners?
Answer
# 5
You can declare variables with the Dim, Public or the 
Private statement. Like this:

Dim myname
myname = "ritesh"

However, this method is not a good practice, because you 
can misspell the variable name later in your script, and 
that can cause strange results when your script is running.

If you misspell for example the "myname" variable 
to "mynime", the script will automatically create a new 
variable called "mynime". To prevent your script from doing 
this, you can use the 'Option Explicit' statement. This 
statement forces you to declare all your variables with the 
dim, public or private statement.

Put the Option Explicit statement on the top of your 
script. Like this:

Option Explicit
Dim myname
myname = "ritesh"
 
Is This Answer Correct ?    0 Yes 1 No
Ritesh Mahendrakar
 

 
 
 
Other QTP Interview Questions
 
  Question Asked @ Answers
 
what is the mediater between qtp and application/project in automation testing?  1
Hi This is tanya actually im facing problem in Qtp actully some time QTP doesnot recoznise the recorded object due to which script is going to fail.so can you tell me how we can handle this situation and i have another concerened issue is that at the time of run New errors comes every time so how we can handle this sitauation how we can add Recovery scenarios to the script.some time application runs successfully and some time it produces new error thats why i am facing lot of problem please give me the sugeestion as soon as possible.  2
How exactly you start scripting in QTP? In the interview he was not satisfied with my answer.Please post what is correct answer.  2
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
Please Explain The QTP real Testing process with steps.  4
Plz suggest me a good training institute in Mumbai/hyderabad for QTP…. Plz advice thank u IBM14
What is diffrence between Global variables and Environment variables...Anybody can give me answer..Thanks in advance.. IBM2
how to invoke the web application through script in qtp Synechron5
When to Insert transactions in QTP? Siemens2
Synchronizing test Wipro2
how you will do cookie testing using QTP?  2
how to get childobject from .net application. i tried but its showing child object count zero. but window has child objects.the following script i written... pls help me how to get. set parent=SwfWindow("winodw name") CheckObjectDescription parent, SwfButton Public Function CheckObjectDescription(parent, oDesc) Set oDesc = Description.Create() oDesc("micClass:").Value ="Swfbutton" Set children = parent.ChildObjects(oDesc) cntObj=children.count msgbox(cntObj) End function  1
if i have 10 actions and out of 10 actions last 3 actions i renamed will my script exicute sucesfuly r not? changed actions where i can see? IBM1
Hi all, On recording a particular Web application with QTP,Have came across a problem for which I havent found a solution so far.. The script of importance is as follows: Browser("Personalized Start Page").Page("XYZ").Frame ("mainFrame_4").Link("address.csv").Click Browser("Personalized Start Page").Page("XYZ").Sync Dialog("0% of dms.php from XYZ-").Dialog("File Download").WinButton("Save").Click My problem is that on recording the application with QTP and clicking the "address.csv" link another browser window comes up temporarily followed by the Windows "FileSave" dialog.The browser window which came up closes down when the Windows "FileSave" dialog is visible and I save the file to a windows location. On the "Record and Run" settings under Qtp,have activated settings for web and windows applications. But when I run this recorded script,and after the "address.csv" click,The browser window comes up and goes down,No Windows "FileSave" dialog comes up and the QTP shows the error Dialog("0% of dms.php from XYZ-") object is not found,though this object is there in the repository. Have tried putting the Dialog("0% of dms.php from XYZ- ").Exist property.But the "Exist" property is not recognised by the dialog at all. Any help in this direction is appreciated.. Thanks in advance J ADP1
can objects recogonised without repository? AZTEC8
Cn u please clarify my doubt Where are micTab and micReturn used.Thanx in Advance  1
pls help me with scripting,right from the beginning in QTP  1
1) What is the diff Between GetRoproprty and Gettoproperty? 2)What is Redim? STC1
During test run,How will you copy/paste from/to clipboard?  2
Describe the process for writing text check point for a web application? ssinformatics2
 
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