VB Script Interview Questions

Share Embed Donate


Short Description

Download VB Script Interview Questions...

Description

VB Script Interview Questions 1) Explain about VB Script? VB script is a Microsoft programming language and it rese mbles 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 o f 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 o f VB Script is by utilizing Windows Script host environment. Visual basic is a stand alone ap plication which has a .vbs as extension. e xtension. 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. T hey 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 Scr ipt as the programming language. .hta . 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 gu idelines of internet explorer. 5) Explain some uses of VB Script? Scr ipt? If functionality aspect is considered VB Script Scr ipt acts similar to Java Script but it is compatible only on internet explorer. They T hey interact with Document object model. Visual V isual 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 do cument object model of the page. Many browsers have compatibility with Java Script but they are no t compatible with VB script as such. For client side scripting developers using VB Script should always make sure of cross browser compatibili co mpatibility ty which is not the case when working with VB script. 7) Explain about the t he support of ASP for VB Script functionality? Visual Basic should rely on ASP for sever side processing. Asp.dll is used to make VB Scr ipt run on ASP engine and a nd it invokes vbscript.dll. VB Script Scr ipt should be embedded within context switches. ASP can pro vide varied functionality to VB Script. 8) Explain about the t he 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 work ing 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 ver y 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 occu rs. 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 co mpare. 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 o f 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 st ring concatenation are provided.

What are Variants?

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 o nly has a datatype of variant to store any type of data. What is the scope of a variable ?

The scope of a variable defines whether a variable will be accessible in the whole function or will be accessed only to its local instance.I have defined earlier in the tutorials that they can also be deeme d as a local variables or can be deemed as a global variables. For ex. < script > Dim name Sub cmdclickme_OnClick Dim age End Sub < / script > It is clear from the above example about the scope of the variable that the variable name will be available to the whole script as it is declared outside sub procedure so enhance his behaviour to the global as compared to the variable name age which is defined inside the sub procedure hence making his behaviour local and will be only accessed in this sub procedure only. How to Assign values to a variable ?

Simple you have to declare a variable name and assign any value. For ex. Name = ?Chandra? Status=False Age=30 Now all the above variables has been assigned values.This is a simple way to declare and assign related values to a variable.

How do you create a recordset object in VBScript?

First of all declare a variable to hold the Recordset object, exDim objRs Now, Create this varible as a Recordset object, exSet objRs=Server.CreateObject(ADODB.RECORDSET)

What Is The Difference Between the Dim, Public, and Private Statements?

Private Public

statement variables are available only to the script in which they are declared.

statement variables are available to all procedures in all scripts.

Variables declared with Dim at the script le vel are available to all procedures within the script. At the procedure level, variables are available only within the procedure.

What is The Difference Between a Sub-Procedure and a Function?

Both a Sub-Procedure and a Function are very similar. The only difference is that you may use a Function on the right side of an equation like you would a Cos( ) function or number.

function will return a value ex-fun() { } return value;  but sub-procedure will not return a value How Do I Use Arrays?

Arrays may either be static or dynamic. A static array has its dimensions pre-defined and may not be resized, whereas a dynamic array does not have a pre-defined number of dimensions and must be resized to store any data. To define any of the two arrays first use either the Dim, Public, or Private statments as you would with a normal variable. Then, to define a one-dimensional static array with three elements, you could go: Dim myArray(2) To assign values to each element go: myArray(0) = 34 myArray(1) = 45 myArray(2) = 12 You may have also defined the above array by using the Array( ) function like so: Dim A A = Array(34,45,12) Arrays may be defined with as many as 60 dimensions. Array dimensions are separated by commas. For example to define a three-dimensional array you could go: Public

myArray(4, 7, 9)

Where the first dimension has 5 ele ments, the second has 8 elements, and the last has 10 elements.

Dynamic arrays have no dimensions when they are defined and cannot contain data until they are redimensioned. To define a dynamic array simply go: Dim myArray( )

Which Platforms Support VBScript?

VBScript is supported by Windows 95, Windows NT (including a native version for Alpha), 16-bit Windows, and Unix Solaris. Microsoft is currently working with others to bring VBScri pt to UNIX versions for HP, Digital, and IBM platforms.

How to send content of a file line by line to a batch file as a parameter ?

Give examples where VB script can directly run on u sers system with Windows as OS?

A simple example detailing the running o f VB Script is by utilizing Windows Script host environment. Visual basic is a stand alone ap plication 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.

How Do I Re-Dimension Arrays?

You may only re-dimension dynamic arrays. To do so, use the ReDim stateme nt in the same manner as either the Dim, Public, or Private statments. For example to re-dimension an existing dynamic array you could go: ReDim myArray(5, 5) Note that using the ReDim statement will r eset all data within the array. To keep the data from being erased use the Preserve statement in conjuction with the ReDim statement like so: ReDim Preserve myArray(5, 5) There is no limit to the number of times you can resize a dynamic array, but if you make an array smaller than it was, the data in the eli minated elements will be lost.

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF