• VBScript FAQ1

    Posted on May 28, 2013 by in Desktop Engineering, Frequently Asked Interview Q's, Scripting, VB Script

    The following are Frequently Asked Questions on VBScript during an interview for Application Packaging/Scripting  Position:
    The question and answers are being collected from Various blogs and Articles. My effort is confined to collecting as much material as possible from various sources and publishing it at once place.

     

    S No.

    Question

    Answer

    1

    How you define option explicit in Vbscript? If you want to use Option Explicit in VBScript you should have to declare all variables using the Dim, Private, Public, or ReDim statements.
    Using Option Explicit to avoid incorrect typing the name of an existing variable or to avoid confusion in code where the scope of the variable is undefined.

    2

    Can you pass optional arguments to function in Vbscript? Yes, We can pass optional argument to VBScript functions.We can use optional argument in VBScript by specifying optional keyword.

    3

    What is hta extension? .hta extension is used whenever you want to include a VB script in HTML. Here HTML acts as an interface and VB Script as the programming language. .hta extension files do run in the safe and trusted zone of Internet explorer. Although they run in the trusted zone querying is restricted as it has to pass the guidelines of internet explorer.

    4

    How is variable declared in VbScript? Using Dim StatementExample
    Dim Value

    5

    What is Variant data type in VbScript? VBScript has only one data type called a Variant. A Variant is a special kind of data type that can contain different kinds of information, depending on how it’s used. Because Variant is the only data type in VBScript, it’s also the data type returned by all functions in VBScript.

    6

    How you define parametarization in VbScript? Parametrization is useful when we want to change object’s parameters in accordance with a mathematical rule, or data from a file.
    We can say that Parametrization is the best way to protect your database from SQL injection attacks

    7

    What is the difference between Dim, Public and Private statements? Private statement variables are available only to the script in which they are declared.
    Public statement variables are available to all procedures in all scripts.
    Variables declared with Dim at the script level are available to all procedures within the script. At the procedure level, variables are available only within the procedure.

    8

    What are variant? VbScript deals with a single datatype called variant. Datatype means the kind of the data a variable will store.It can be a character data,string data,number data , byte data and a Boolean data. But you don?t have to worry in Vb Script as it only has a datatype of variant to store any type of data.

    9

    Explain about SCRRUN.DLL? Scripting Runtime library is very important for the functioning of Visual basic script because it gives much more functionality such as File management, text operations and file modification features. Scrrun.dll is used very much in programming VB.

    10

    Give me examples where Vb Script can directly run on users system with windows as os? A simple example detailing the running of VB Script is by utilizing Windows Script host environment. Visual basic is a stand alone application which has a .vbs as extension. Input can be provided through graphical user interface and output can be obtained by Wscript.exe from dialog and input boxes. From command line it can be invoked by Cscript.exe.

    11

    What is event handling in Vbscript? The actions that are performed by clicking, pressing keys, moving mouse, dragging and dropping etc are called as events. Event handling is the way to capture these events and perform the actions accordingly.
    Be Sociable, Share!

    Written by

    View all articles by

    Email : [email protected]

    Leave a Reply