VBScript Interview Questions

Top 30 VBScript Interview Questions
1) Explain about VB Script?
VB script is a Microsoft programming language and it resembles a lower version of the VB. It is an Active Scripting language. This scripting language is included in windows operating system by default. With the use of msscript.ocx you can install VB Script.
2) Give 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.
3) Explain about .wsf files?
.wsf files are modeled in similar to XML. They can be executed with the help of Wscript.exe and it can be done from the command line also. This .wsf file can have multiple visual basic files. Reuse functionality is present with this extension file.
4) Explain about the extension .hta?
.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.
5) Explain some uses of VB Script?
If functionality aspect is considered VB Script acts similar to Java Script but it is compatible only on internet explorer. They interact with Document object model. Visual basic script can also be used for server side processing with ASP.
6) Compare Java Script and VB Script?
VB and Java Script 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 VB script.
7) Explain about the support of ASP for VB Script functionality?
Visual Basic should rely on ASP for sever side processing. Asp.dll is used to make VB Script run on ASP engine and it invokes vbscript.dll. VB Script should be embedded within <% and %> context switches. ASP can provide varied functionality to VB Script.
8) Explain about the functionality of VB Script?
Active X technology can be used to give much more functionality to VB Script. VB provides sub routines, functions, string manipulation, data/time, error handling, etc. VB can have more functionality added to it by working with languages such as ASP.
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) Explain about ADODB.Stream class?
ADODB.Stream class can be used as string builder. VBScript string concatenation can be very costly because of frequent memory allocation features. Binary file and memory I/O operation is provided by ADODB.Stream class. This is widely used to convert bytes into string, etc.
11) Explain about arrays in VB Script?
Arrays in VB Script should be assigned within the variant separated by a comma. If arguments are not specified then the string is regarded as empty. After specifying the elements in an array an index number should be used indicating the desired element.
12) Explain about the Asc function?
According to the first letter in a string it returns the ANSI code relevant to that first letter. If string is not present then a runtime error occurs. Asc function returns the first byte used. It is used only with elements containing byte data in a string.
13) Explain about filter expression?
Filter expression returns an array based on a specific filter search condition and it returns a zero based array. Arguments included in the filter array are Input strings, value, include and compare. If there is no match for the value it returns an empty string.
14) Explain about constants in VB Script?
There are many useful constants present in Visual basic script which you can use in your code. They ease your work load by remembering value and implementing in the code. Maintenance is easy with VB Script because it can easily change the feature of constants.
15) Explain about Tristate constants?
Tristate constants can be used with functions which allow formatting of numbers. These constants can be used with VB Script without defining them. It can be used anywhere in the code to reflect and represent the values.
16) Explain about operator precedence in VB Script?
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.
17) What are the different types of operators and their order of precedence?
Order of evaluation of operators is, first arithmetic operators are evaluated, and comparison operators are evaluated next and at the last logical operators are evaluated at the last. In arithmetic operators negation, Exponentiation, multiplication and division, integer division, modulus arithmetic, addition and subtraction and string concatenation are provided.
18)how to open browser in vb script
set ie=createobject(“internetexplorer.application”)
ie.navigate(“http://www.google.co.in/”)
ie.visible=true
set ie = nothing
19)Why to use option explicit in vb script
‘If we declare variables with some values and while using if we use (spell mistake) then user can’t know
‘ putting option explicit is useful there
‘ Example starts here
option explicit
dim abcd
abcd=20
msgbox abcd
dim bcde
bcde=30
msgbox bcdef
20)how to open a file .What is the perpose of true and false mode there
‘How to read from file and write into the file
set files = createobject(“scripting.filesystemobject”)
set obj1=files.opentextfile(“d:\file2.txt”,2,true) ‘ true uses for ceating txt file
set obj2=files.opentextfile(“d:\file2.txt”,1,false) ‘ false will not create any file
obj1.writeline(“write this line into file”)
str=obj2.readline
msgbox str
set files=nothing
21)if else for do while select in vb script
i=5
j=6
if i>j then
msgbox i
elseif i msgbox j
else
msgbox “nothing”
end if
for i=5 to 10 step 2
msgbox i
next
do while i<15 br="" style="box-sizing: border-box; margin: 0px; padding: 0px;">msgbox i
i=i+3
loop
mycase=”gitam”
select case mycase
case “abcd”
msgbox “abcd”
case mycase
msgbox mycase
case else
msgbox “wrong”
end select
22)how to write functions and sub in vb script
function add(a,b)
sum=a+b
add=sum
end function
s=add(6,8)
msgbox s
sub add2(x,y)
sum=x+y
msgbox sum
end sub
call add2(6,8)
23) what is variant in vb script
variant is the only datatype in vb script.There are many subtypes under variant.
They are Empty,Null,Boolean,Byte,Integer,Currency,Long,Single,Double,Date ,String,Object,Error
24)how to open excel in vb script
set xl=createobject(“excel.application”)
set wb=xl.workbooks.open(“d:/sample.xls”)
set ws=wb.worksheets(1)
ws.cells(3,4)=”welcome”
wb.save
wb.close
set wb=nothing
set ws=nothing
set xl=nothing
25)difference between dim,public and private variables in vb script
Use of dim ,private and public variables in vb script
function first
dim a
a=20
msgbox a ‘ 20 displays
end function
first
msgbox a ‘ this gives empty value
‘ so dim variables are not public if we use within function
dim b
b=30
function second
msgbox b ‘ 30 displays
end function
second
‘ if we declare dim variables outside the function then it will act as public
class myclas
public c
private d
dim e
sub mysub
c=40
d=50
e=60
msgbox “public : “&c&” private :”&d&”dim :”&e
end sub
end class
set obj=new myclas
obj.mysub
msgbox obj.c
‘msgbox obj.d ‘it won’t allow to display private variables
msgbox obj.e
26) Explain about ADODB.Stream class?
ADODB.Stream class can be used as string builder. VBScript string concatenation can be very costly because of frequent memory allocation features. Binary file and memory I/O operation is provided by ADODB.Stream class. This is widely used to convert bytes into string, etc.
27) 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.
28) Explain about arrays in VB Script?
Arrays in VB Script should be assigned within the variant separated by a comma. If arguments are not specified then the string is regarded as empty. After specifying the elements in an array an index number should be used indicating the desired element.
29) Compare JavaScript and VBScript?
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.
30) Explain about the support of ASP for VB Script functionality?
Visual Basic should rely on ASP for sever side processing. Asp.dll is used to make VB Script run on ASP engine and it invokes vbscript.dll. VB Script should be embedded within <% and %> context switches. ASP can provide varied functionality to VB Script.

Related

Interview Questions 6440803829346862772

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item