1) What is VB Script?
VBScript stands for Visual Basic Scripting Language. It is a light version of Microsoft Visual Basic. It is a client side scripting Language.
2) What is the stable version of VBScript?
The stable version of VBScript is
5.8.
3) What are the features of VBScript?
The features of VBScript are:
It is a lightweight scripting language.
It is easy to learn.
It uses COM (Common Object Model).
It executes in host environment such as IE, IIS and WSH.
4) How can we write a simple program?
We can write a simple program by using following steps:
<html>
<body>
<script language="vbscript" type="text/vbscript">
document.write("Hello World!")
</script>
</body>
</html>
5) What are the environments where VBScript could be run?
VBScript could be run into three environments that are:
IIS (Internet Information Server)
WSH ( Windows Script Host)
IE ( Internet Explorer)
6) How can we declare the variable in VBScript?
We can declare the variable by using
DIM keyword.
Example: Dim name.
7) What are the technologies used by VBScript?
VBScript use following technologies:
Functions
String manipulation
Subroutines
Data/time
Error Handling, etc.
8) Is VBScript case sensitive?
No, VBScript is case sensitive but function name, keywords , variables and identifiers are case sensitive.
9) What are string functions in VBScript?
There are various functions in VB Script:
Asc(): It returns ANSI character code.
UCase(): It conver a string to uppercasse.
InStr(): It is used to find a string within another.
Lcase(): It convert a srting to lowercase.
Ltrim(): It removes leading space from a string.
10) How can we assign a date and time value to a variable?
We can assign a date and time value to a variable by using hash symbol(#).
11) What are the operators of VBScript ?
VBScript operators are:
Arithmetic Operators
Comparison Operators
Logical (or Relational) Operators
Concatenation Operators
12) How can we create cookies in VBScript?
We can create cookies by assign a string value to the
document.cookie object.
Syntax:
document.cookie = "key1 = value1; key2 = value2; expires = date";
13) How can we create a class in VBScript?
We can create a class in VBScript by using enclosed within Class .... End Class.
Example:
'Defining the Class
Class classname 'Declare the object name
...
End Class
' Instantiation of the Class
Set objectname = new classname
14) How to throw an error in VBScript?
In VBScript, an error is thrown by
Err.Raise.
Example:
Err.Raise 6 ' Raise an overflow error.
15) Who is the developer of VBScript?
Microsoft is the developer of VBScript.
16) What are the filename extensions of VBScript?
The filename extension of VBScript are
.vbs , .vbe, .wsf, .wsc.
17) What are the host environments of VBScript?
Host environment of VBScript are WSH(Windowj- Script Host), IE( Internet Explorer), IIS(Internet Information Services).
18) In VBScript how can we comment any statement?
In VBScript, we can comment with single Quote(‘).
Example:
<script language="vbscript" type="text/vbscript">
<!-
'comment line with single quote
' Hello VBScript
//- >
</script>
19) What the rules are for declare variables?
There are following rules for declaring variable:
- Variable Name must begin with an alphabet.
- Variable names cannot exceed 255 characters.
- Variables Should NOT contain a period(.)
- Variable Names should be unique in the declared context.
20) Can we change the value of constant during the script Execution?
No the value of Constant cannot be change during the Script Execution.
21) Write an example of Do…Until loop?
The example of Do..Until loop is given below:
<!DOCTYPE html>
<html>
<body>
<script language="vbscript" type="text/vbscript">
i=10
Do Until i>15 'Condition is False.Hence loop will be executed
ii = i + 1
Document.write("The value of i is : " & i)
Document.write("<br></br>")
Loop
</script>
</body>
</html>
22) What are the mathematical functions used in VBScript?
In VBScript, there are various mathematical functions used like Log, Rnd, Sgn, Abs, Hex and many more.
23) Which function is used to reverse the sequence of the characters of the given string?
StrReverse() function is used to reverse the sequence of the characters of the given string.
24) Can we start an array index with negative?
No, we cannot start an array index with negative.
25) What is the use of Redim statement?
ReDim statement is used to declare dynamic array and allocate or reallocate storage space.
26) What is a Dialog Box?
Dialog Box is just like a message box. It is used to display a message to a user .
Synatx:
MsgBox(prompt[,buttons][,title][,helpfile,context])
27) How to assign a data value to a variable?
Date and Time variables should be enclosed within hash symbol(#).
28) How can we create cookies in VBScript?
We can create a cookies to assign a string value to the document .cookies object.
Syntax:
document.cookie = "key1 = value1; key2 = value2; expires = date";
29) What are sub procedures in VBScript?
In VBScript, sub procedures are different from function that is given below:
- Sub procedures does not return a value
- Sub procedures can be called without call keyword.
- Sub procedures are always enclosed within Sub and End Sub statements.
30) What is the use of Scripting.FileSystemObject class in VBScript?
In VBScript,
Scripting.FileSystemObject class is used for the developer to work with drivers, folders and files.
Example:
Dim oFS, drive
Set oFS = CreateObject("Scripting.FileSystemObject")
Set drive = oFS.GetDrive(oFS.GetDriveName("C:\"))
Document.write drive.VolumeName