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...


Why do we use Option Explicit?

Answers were Sorted based on User's Feedback



Why do we use Option Explicit?..

Answer / farah

If we declare variables in option explicit and if
undeclared variabled are used in the code then it displays
error messages

Is This Answer Correct ?    6 Yes 0 No

Why do we use Option Explicit?..

Answer / jim c

Option Explicit forces the programmer to declare all
variables, rather than letting them be implicitly declared
upon their first use.
This enforces good programming practices and avoids
ambiguity of variable scope.
Here are some simple code examples:
'*************************************
i = 1
Call mySub
WScript.Echo i

Sub mySub
i = 10
End Sub
'*************************************
In this first example, because the programmer is relying on
implicit variable declaration, the subroutine is modifying
global variable i, and the printed result is 10. Now, modify
the code so that the variables are declared:
'*************************************
dim i
i = 1
Call mySub
WScript.Echo i

Sub mySub
dim i
i = 10
End Sub
'*************************************
Now, we actually have two different variables named i, one
with global scope, and one with local scope. The printed
result is now 1.
Since a lot of programmers use i in For..Next loops, you can
see how this could result in unpredictable results without
explicit variable declaration

Is This Answer Correct ?    8 Yes 3 No

Why do we use Option Explicit?..

Answer / rekha

there are different ways of declaring variables
this option is used to declare multiple values

Is This Answer Correct ?    6 Yes 3 No

Why do we use Option Explicit?..

Answer / veena

vb supports a datatye called variant which can store any
interger,variable,float..by using option explicit it will
not allow the variables to declare implicitly.

Is This Answer Correct ?    3 Yes 0 No

Why do we use Option Explicit?..

Answer / harry

hi,
when you declare varible you use option Explicit as a
first line of your script .
ex
DIM name

if you do any spelling mistake like nime instead of name
then vb will take this as an new verible and endup giving
unpredictable result while runing.

Is This Answer Correct ?    2 Yes 0 No

Why do we use Option Explicit?..

Answer / p.shivakumar

option explicit is used to declare variable where implicit
command without declaration of variable

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More VB Script Interview Questions

Diff between web table ,datatable and data base (QTP)

2 Answers   TCS,


My Salary is 65000. How Much TDS I have to pay

0 Answers  


Mention what is variant in vbscript?

0 Answers  


what is the use of QCUtil? explain with one example?

1 Answers  


How to create a cookie using vbscript?

0 Answers  


What is the use of the ‘open’ method to work with the database in the vbscript language and what connection string is passed in the same and what is its usage?

0 Answers  


Mention what is vbscript?

0 Answers  


What is the purpose of folders object of scripting.filesystemobject class in vbscript?

0 Answers  


Which command is used for writing text on a page?

0 Answers  


What variable can you use to share info across the whole application for one user?

2 Answers  


1. How to handle object implementation change in DP for Ex: i have login page with username,pasword (editboxes),login,cancel(buttons). Here i written DP code for login page with the help properties. My questions: 1.If properites are changing dynamically i will do (i want code for that) 2.if objects are changed dynamcally i will do (i wnat code for that)

0 Answers   iFlex,


When importing an excel file that has several columns each with different number of rows into QTP's Global datatable, how can you count the number of rows in a particular column?

3 Answers   Logica CMG, McGraw Hill,


Categories