VB Script interview questions for freshers/VBScript Interview Questions and Answers for Freshers & Experienced

What Are The Data Types Supported By Vbscript?


VBScript has only one data type called a Variant. There are different categories of information that can be contained in a Variant, called subtypes. These subtypes are:

Empty, Null, Boolean, Byte, Integer, Long Single, Double, Date/Time, Currency , String , Object and Error.

What Is Difference Between Vbscript And Vba?

VBScript is a subset of Visual Basic for Applications, but there are still many differences:

VBScript doesn't have a debugger like Visual Basic or you can say that VBScript does not provide any debugging features.You'll resort to using lots of message boxes, instead.

Unlike Visual Basic and Visual Basic for Applications, in which the developer can define the data type of a variable in advance, all variables in VBScript are variants.

There is no integrated development environment for VBScript that parallels the IDE for Visual Basic and Visual Basic for Applications.

Because variables are untyped and code is not compiled, all external objects instantiated in VBScript code are necessarily late-bound. This has a number of implications. First, late binding typically entails a substantial performance penalty in comparison to early binding. Second, while the properties and methods of early-bound objects can be examined in Visual Basic or hosted VBA environments using the Object Browser, this is not the case with late-bound objects. Finally, the help facilities available for early-bound objects in VB and VBA (like Auto List Members and Auto Quick Info) are not available, making syntax errors more likely and ready access to good documentation all the more necessary.

Which loop is used in the case of arrays in the VBScript language?

For Each Loop is used in the case of Arrays. This is an extension of For Loop only. In case of repeating the code for each index value of an array then you can use ‘For Each Loop’.

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

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.

What Is Purpose Of Scripting.filesystemobject Class In Vbscript?

This class provides file system objects which help the developers to work with drives, folders and files.

Example:

Dim oFS, drive
Set oFS = CreateObject("Scripting.FileSystemObject")
Set drive = oFS.GetDrive(oFS.GetDriveName("C:"))
Document.write drive.VolumeName

How Strcomp Function Works?

The StrComp Function returns an integer value after comparing the two given strings. It can return any of the three values -1, 0 or 1 based on the input strings to be compared.

* If String 1 < String 2 then StrComp returns -1
* If String 1 = String 2 then StrComp returns 0
* If String 1 > String 2 then StrComp returns 1

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.

In what way program “hello world” you can write in VBScript?

In VBScript, you can write hello world in two ways, the program will display a message box with text hello world.

1. MsgBox “Hello World”
2. Echo “Hello World”

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.

Mention what is the main difference between function and sub-procedure?

The main difference between function and sub-procedure is that function returns a value whereas a Sub-procedure does not.

Mention if QTP generates VBScript code as we record actions, can’t it possible to directly write using VBScript code when QTP does the same thing too?

No. it is not possible. QTP is the engine that runs through it. The VBScript relies on the QTP UI to perform the actions, such as clicking on a link on a web page.

What are the different types of loops available in the VBScript language?

The loops which are available in the VBScript language are broadly categorized into 3 types and they are – For Loops, Do Loops and While Loops.

What are the 2 ways in which a variable can be declared in the VBScript language?

Two ways to declare a variable are:

Implicit Declaration: When variables are used directly without declaration, it is termed as Implicit Declaration. However, it’s not a good practice because at any point if the variable name is not spelled correctly in the script then it can produce wrong results while running and at times, it will not even be easy to be detected by the user.
Explicit Declaration: Declaring the variables before using them is known as the Explicit Declaration of variables.

What are the advantages of VBScript?

Following are the advantages of VBScript −
i. VBScript is a lightweight scripting language, which has a lightning fast interpreter.
ii. VBScript, for the most part, is case insensitive. It has a very simple syntax, easy to learn and to implement.
iii. Unlike C++ or Java, VBScript is an object-based scripting language and NOT an Object-Oriented Programming language.
iv. It uses Component Object Model (COM) in order to access the elements of the environment in which it is executing.
v. Successful execution of VBScript can happen only if it is executed in Host Environment such as Internet Explorer (IE), Internet Information Services (IIS) and Windows Scripting Host (WSH).

What Is The Scope Of A Constant Declared Using Public?

The Public constants are available for all the scripts and procedures.

Is VBScript language a Case-Sensitive language and what does it mean?

No. This actually means that variable names, keywords, constants, and other identifiers are not required to be typed with a consistent capitalization of letters i.e. if you type ‘Optional’ keyword as OPTIONAL, optional or Optional then these all mean the same in the VBScript language.

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.

Mention what is the use of Option Explicit in VBScript?

The use of Option Explicit statement in VBScript is to initialize all the variable before using them. It helps to avoid typing error in the code.

Mention what if you do not specify anything when you call a procedure?

If you do not specify anything when you call a procedure, then the argument/arguments are passed by reference by default.

Mention what is ByRef and ByVal Parameters in VBScript?

ByRef and ByVal Parameters in VBScript is used to pass VBScript argument to the procedures by reference or by value

In HTML file what is an ideal position to include VBScript?

An ideal position to include VBScript in HTML is,

Inside Head Section
Inside Body Section
Inside External File

Mention how to access Array Data?

Data in an array can be accessed by referring to the name of the array and the element’s index number.

Mention how to create a Cookie using VBScript?

The simplest way to create a cookie is to assign a string value to the document.cookie object.

Mention how to assign a date value to a variable?

To assign a date value to a variable, Date and Time variables should be enclosed within a hash symbol(#).

Which keyword is used to declare a variable in the VBScript language?

The Dim keyword is used to declare a variable in the VBScript language. However, depending upon the scope of the variable, public or private keywords can also be used.

What Are The Disadvantages Of Vbscript?

Following are the disadvantages of VBScript:

1. VBscript is used only by IE Browsers. Other browsers such as Chrome, Firefox DONOT Support VBScript. Hence, JavaScript is preferred over VBScript.
2. VBScript has a Limited command line support.
3. Since there is no development environment available by default, debugging is difficult.

What are the naming conventions while declaring a variable in the VBScript language?

Following are the rules for declaring a Variable name:

1. It must always start with a letter. For Example, output, name, etc. Variable Name should not start with a number or any special character like _va123, 12non, etc.
2. It cannot exceed the limit of 255 characters.
3. It should never contain a period (.).

How Will You Format A Number In Percetage Format In Vbscript?

Using FormatPercent function, which would return an expression formatted as a percent.

Example:

Dim num : num = -645.998651
document.write(FormatPercent(num, 2))& "<br/>" '-64,599.86%

Is VBScript language a Case-Sensitive language and what does it mean?

No. This actually means that variable names, keywords, constants, and other identifiers are not required to be typed with a consistent capitalization of letters i.e. if you type ‘Optional’ keyword as OPTIONAL, optional or Optional then these all mean the same in the VBScript language.

Mention when to use Function procedures and what are its characteristics?

You use Function procedures when you want to execute a series of statements and return a value.

1. Function procedures start and end with Function and End Function statements
2. A function procedure may or may not take input.
3. Function procedures return a value by assigning the value to its name

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.

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.

Mention what is VBScript Procedures?

VBScript procedures are primarily used for code organization and reuse. There are mainly two types of VBScript procedures: Sub procedures and Function procedures.

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.

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.

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.

What are the keywords in the VBScript language?

There are some words that work as Reserved Words and they cannot be used as Variables names, Constant names or any other Identifier names, these are known as keywords. Some of the keywords in the VBScript language are Not, Nothing, Preserve, Optional, etc.

Mention what is variant in VBScript?

A variant in VBScript is a data type. A Variant can contain either string or numeric information. A Variant behaves like a string when you use it in a string context and as a number when you use it in a number context.

Explain what is loose binding? Why is it not a good practice to use it?

VBScript allows you to use variables without declaring it known as ‘loose binding.’ It is not an ideal practice to use it. Because if you misspell the same variable when you use it again then VBScript will not show you of the error.

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.

Which respective symbols are used to separate a line and to break the lengthy statement into multiple statements in the VBScript language?

Colons (:) act as a line separator and Underscore (_) is used to break the lengthy statement into multiple statements in the VBScript language.

How are Comments handled in the VBScript language?

Any Statement that starts with a single quote (‘) or with the keyword ‘REM’ is treated as a Comment.

What is the extension of the VBScript file?

VBScript file is saved with an extension of .vbs.

Which data type/types are supported by VBScript language and what are their specialties?

There is only one data type that is supported by VBScript language and it is called as the ‘Variant’. If we use this data type in the String context then this will behave like a String and if we use this in Numeric context then this will behave like a Number. This is the specialty of the Variant data type.

Mention what are the rules to name variable in VBScript?

To name variable in VBScript there are certain rules, you need to use the keyword ‘Dim‘. For example, Dim salary. Also, you need to remember the following things

>> Variable name must begin with a letter
>> Variable name cannot exceed 255 characters
>> Variable name should not contain a period (.)

What are the environments supported by VBScript language?

VBScript can run in the following 3 environments:

* IIS (Internet Information Server) – This is Microsoft’s Web Server.
* WSH (Windows Script Host) – This is the hosting environment of the Windows Operating System.
* IE (Internet Explorer) – This is the most frequently used environment to run scripts and this is the simple hosting environment.

What is VBScript language used for and which earlier language is it modeled upon?

VBScript is a lightweight primary scripting language which is used for automation of the Scripts in QTP (Quick Test Professional) tool. This is modeled upon Visual Basic language.

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.

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.

Search
R4R Team
R4R provides VBScript Freshers questions and answers (VBScript Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,VB Script interview questions for freshers,VBScript Freshers & Experienced Interview Questions and Answers,VBScript Objetive choice questions and answers,VBScript Multiple choice questions and answers,VBScript objective, VBScript questions , VBScript answers,VBScript MCQs questions and answers Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for VBScript fresher interview questions ,VBScript Experienced interview questions,VBScript fresher interview questions and answers ,VBScript Experienced interview questions and answers,tricky VBScript queries for interview pdf,complex VBScript for practice with answers,VBScript for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .