July 29, 2021
VBScript interview questions and answers

VBScript interview questions and answers

VBScript interview questions and answers

1. Explain VBScript?

ANS: This is a scripting language developed by Microsoft and is based loosely on Visual Basic. Its functionality in a web environment is dependant upon either an ASP engine or the Windows Scripting Host, and must be used on a Windows hosting platform.

2. Explain the functionality of VB Script?

Ans: Using Active X technology we give much more functionality to VB Script. VB provide us sub routines, functions, string manipulation, data/time , error handling etc. We can increase the functionality of VB by using language like that ASP.

3. Define some use of VB Script?

Ans: As per functionality we can say that VB Script acts same to Java Script. But VB Script is only compatible with internet explorer. VB Script act with Document object model. We can use Visual basic script used for server side processing with ASP.

4. How Visual Basic is differ from VBScript?

Ans: VBScript is much differs from Visual Basic.

1. Both VBScript and VBScript are compiled in different way.
2. Internet explorer support VBScript on your PC and also we can create web pages using VBScript.
Where in case to run Visual Basic you need some like text editor, ActiveX, Control Pad and Web Browser.

5. What are the Variants in VBScript?

Ans: Variant are the single datatype(Kind of data that we store in variable. Datatype may be a character data, string data, number data, boolean data and byte data.)that we used in VBScript.

6. What type of loops used in VBScript?

Ans: When you want to execute same blocks of code a particular number of times than we use looping. VBScript provide us four types of looping statements these are:

1.For..Next statement
2.For Each..Next statement
3.Do..Loop statement
4.While..Wend statement

7. Explain few date functions in VBScript.

ANS: Date(),

8. What is the use of optional key word in VBScript?

ANS: VB Script functions cannot use the Optional keyword because it VB Script we need to declare every argument that we want to use. In Visual Basic the Optional keyword, which allows some arguments to be left out, which is not implemented in VB Script. Hence we can pass null value to the function in VB script.

9. Give examples where VB script can directly run on users system with Windows as OS?

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

10. Can we pass optional argument to function in VBScript?

Ans: Yes, We can pass optional argument to VBScript functions. We can use optional argument in VBScript by specifying optional keyword.

11. How you define parametrization in VBScript?

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

12. How you define Option Explicit in VBScript?

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

13. How Sub Procedures and Function Procedures are differ in VBScript?

Ans: VBScript support two types of procedures. These are Sub Procedures and Function Procedures.

The main difference b/w Sub Procedures and Function Procedures are given below:

1. In case of Sub Procedures we write series of VBScript statements inside the Sub and End Sub statement Where as in Function Procedures we write series of VBScript statements inside the Function and End.
2. Sub Procedures does not return any value where as Function Procedures return a value.
3.Procedures has two build-in VB Script functions these are MsgBox and InputBox.

14. Define Tristate constants in VB Script?

Ans: We can allow formatting of numbers by using Tristate constants with functions. Tristate functions are used to reflect and represent the values any where in the code. Without defining Tristate constant it can be used with VB Script.

15. What conditional statement we used in VBScript?

Ans: Conditional statements that we used in VBScript are given below:

1.if statement
2.if..than..else statement
3.if..than..elseif statement
4.select case statement

16. What is the VBScript Procedure?

Ans: In VBScript their are two types of procedure available. They are Sub Procedure and Function Procedure.

1.Sub Procedure: In this series of statement are closed b/w the Sub and End Sub statements. It may be Sub procedure performs actions without returning any value. We can passed argument when we called this procedure. There is no mandatory to pass argument b/w the parentheses.

2.Functional Procedure: In this series of statement must enclosed b/w the Function and End Function statements. When it perform any action may return a value. We can passed arguments when we called the procedure. There is no mandatory to pass argument b/w the parentheses. When we assign value to variable than it returns that value.

17. What’s the scope of variable in VBScript?

Ans: The scope of the variable means we can set an variable can access in whole function or it only access by its local instance. Because of scope of variable we can say variable are of two types Local and Global variables.

18. How can we add VBScript to web pages?

Ans: We use scripting language like VBScript and JavaScript as
the extension of HTML language. Only internet explorer read
the VBScript and its has a work to read Script with whole
content of an web page and to execute them. These are use
as an client side scripting language.

19. What is event handling in VBScript?

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

20.Compare JavaScript and VBScript?

ANS: VB and JavaScript are much similar in functionality. They both interact with the document object model of the page. Many browsers have compatibility with Java Script but they are not compatible with VB script as such. For client side scripting developers using VB Script should always make sure of cross browser compatibility which is not the case when working with VBScript.

21.Explain about operator precedence in VB Script?

ANS: In operator precedence expressions are evaluated and resolved in a predetermined order. The order of evaluation can be modulated if you use parenthesis. Expressions present in parenthesis are evaluated first.