Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

How Will You Convert A String To Upper Case String Using Vbscript?

Answer»

USING Ucase function, which RETURNS the upper case of the SPECIFIED STRING.

Using Ucase function, which returns the upper case of the specified string.

52.

How Will You Convert A String To Lower Case String Using Vbscript?

Answer»

Using Lcase FUNCTION, which returns the LOWER CASE of the SPECIFIED string.

Using Lcase function, which returns the lower case of the specified string.

53.

How Will You Get The Last Occurrence Of One String Within Another String Using Vbscript?

Answer»

Using InStrRev FUNCTION, which RETURNS the first occurrence of one string within another string. The SEARCH happens from RIGHT to left.

Using InStrRev function, which returns the first occurrence of one string within another string. The search happens from right to left.

54.

How Will You Get The First Occurrence Of One String Within Another String Using Vbscript?

Answer»

Using InStr function, which RETURNS the first occurrence of ONE string within ANOTHER string. The SEARCH happens from left to right.

Using InStr function, which returns the first occurrence of one string within another string. The search happens from left to right.

55.

How Will You Get The Exponent Of The Given Number In Vbscript?

Answer»

Using EXP FUNCTION, which returns the value of e RAISED to the specified number.

Example:

Dim NUM : num = -645.998651<BR>document.write("Exp Result of num is : " & Exp(num))& "<br/>" '2.79479883633128E-281

Using Exp function, which returns the value of e raised to the specified number.

Example:

Dim num : num = -645.998651
document.write("Exp Result of num is : " & Exp(num))& "<br/>" '2.79479883633128E-281

56.

How Will You Get The Absolute Value Of The Given Number In Vbscript?

Answer»

Using Abs function, which returns the absolute value of the GIVEN number.

EXAMPLE:

DIM num : num = -645.998651
document.write("Abs RESULT of num is : " & Abs(num))& "<br/>" '645.998651

Using Abs function, which returns the absolute value of the given number.

Example:

Dim num : num = -645.998651
document.write("Abs Result of num is : " & Abs(num))& "<br/>" '645.998651

57.

How Will You Get The Square Root Of The Given Number In Vbscript?

Answer»

Using Sqr function, which returns the SQUARE root of the GIVEN number.

Example:

Dim num : num = -210
document.write("Sqr Result of num is : " & Sqr(num))& "&LT;br/&GT;" '14.4913767461894

Using Sqr function, which returns the square root of the given number.

Example:

Dim num : num = -210
document.write("Sqr Result of num is : " & Sqr(num))& "<br/>" '14.4913767461894

58.

How Will You Get A Random Number Between 0 And 1 In Vbscript?

Answer»

Using Rnd function,which returns a RANDOM number between 0 and 1.

Example:

Dim NUM : num = -645.998651
document.write("Rnd RESULT of num is : " &AMP; Rnd(num))& "<br/>" '0.5130115

Using Rnd function,which returns a random number between 0 and 1.

Example:

Dim num : num = -645.998651
document.write("Rnd Result of num is : " & Rnd(num))& "<br/>" '0.5130115

59.

How Will You Get The Hexadecimal Value Of The Given Number In Vbscript?

Answer»

Using Hex function, which returns the hexadecimal value of the GIVEN number.

Example:

Dim num : num = -645.998651<BR>document.write("Hex Result of num is : " & Hex(num))& "&LT;br/>" 'FFFFFD7A

Using Hex function, which returns the hexadecimal value of the given number.

Example:

Dim num : num = -645.998651
document.write("Hex Result of num is : " & Hex(num))& "<br/>" 'FFFFFD7A

60.

How Will You Get The Octal Value Of The Given Number In Vbscript?

Answer»

Using Oct FUNCTION, which returns the OCTAL value of the given number.

EXAMPLE:

Dim num : num = -645.998651
document.write("Oct Result of num is : " & Oct(num))& "&LT;br/&GT;" '37777776572

Using Oct function, which returns the octal value of the given number.

Example:

Dim num : num = -645.998651
document.write("Oct Result of num is : " & Oct(num))& "<br/>" '37777776572

61.

How Will You Get The Natural Logarithm Of The Given Number In Vbscript?

Answer»

Using Log function, which returns the natural LOGARITHM of the given number.

Example:

DIM num : num = 210<BR>document.write("Log Result of NUM2 is : " & Log(num2))& "<br/>" '5.34710753071747

Using Log function, which returns the natural logarithm of the given number.

Example:

Dim num : num = 210
document.write("Log Result of num2 is : " & Log(num2))& "<br/>" '5.34710753071747

62.

How Will You Get The Integer Part Of A Number In Vbscript?

Answer»

Using INT function, which returns the integer part of the GIVEN number.

Example:

DIM num : num = -645.998651<BR>document.write("int RESULT of num is : " & int(num))& "<br/>" '-646

Using Int function, which returns the integer part of the given number.

Example:

Dim num : num = -645.998651
document.write("int Result of num is : " & int(num))& "<br/>" '-646

63.

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

Answer»

Using FormatPercent function, which would RETURN an EXPRESSION formatted as a percent.

Example:

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

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%

64.

How Will You Format A Number Upto 3 Decimal Places In Vbscript?

Answer»

Using FormatNumber function, which would return an EXPRESSION formatted as a number.

Example:

Dim NUM : num = -645.998651<BR>document.write(FormatNumber(num, 3))& "&LT;br/>" '-645.999

Using FormatNumber function, which would return an expression formatted as a number.

Example:

Dim num : num = -645.998651
document.write(FormatNumber(num, 3))& "<br/>" '-645.999

65.

How Will You Convert A Given Number To Hexadecimal In Vbscript?

Answer»

Using Hex FUNCTION, which CONVERTS a given number of any variant subtype to Hexadecimal.

Example:

X = 123
y = 123.882
document.write("y value after converting to Hex -" &AMP; Hex(y) & "<br /&GT;")

Using Hex function, which converts a given number of any variant subtype to Hexadecimal.

Example:

x = 123
y = 123.882
document.write("y value after converting to Hex -" & Hex(y) & "<br />")

66.

How Will You Convert A Given Number To Single In Vbscript?

Answer»

Using CSng FUNCTION, which converts a given number of any VARIANT subtype to SINGLE.

EXAMPLE:

x = 123<BR>y = 123.882
document.write("x value after converting to Single -" & CSng(x) & "<br />")

Using CSng function, which converts a given number of any variant subtype to Single.

Example:

x = 123
y = 123.882
document.write("x value after converting to Single -" & CSng(x) & "<br />")

67.

How Will You Convert A Given Number To Long In Vbscript?

Answer»

Using CLng function, which CONVERTS a given NUMBER of any variant subtype to LONG.

Example:

x = 123
y = 123.882
document.write("x value after converting to Long -" & CLng(x) & "<br /&GT;")

Using CLng function, which converts a given number of any variant subtype to Long.

Example:

x = 123
y = 123.882
document.write("x value after converting to Long -" & CLng(x) & "<br />")

68.

How Will You Convert A Given Number To Integer In Vbscript?

Answer»

Using CInt FUNCTION, which converts a given NUMBER of any VARIANT SUBTYPE to Integer.

Example:

x = 123
y = 123.882
document.write("y VALUE after converting to Int - " & CInt(y) & "<br />")

Using CInt function, which converts a given number of any variant subtype to Integer.

Example:

x = 123
y = 123.882
document.write("y value after converting to Int - " & CInt(y) & "<br />")

69.

How Will You Convert A Given Number To Double In Vbscript?

Answer»

Using CDbl function, which converts a GIVEN number of any VARIANT subtype to double.

EXAMPLE:

x = 123
y = 123.882
document.write("x value after converting to double - " &AMP; CDbl(x) & "&LT;br />")

Using CDbl function, which converts a given number of any variant subtype to double.

Example:

x = 123
y = 123.882
document.write("x value after converting to double - " & CDbl(x) & "<br />")

70.

How To Delete A Cookie Using Vbscript?

Answer»

Sometimes you will want to delete a cookie so that subsequent ATTEMPTS to READ the cookie return nothing. To do this, you just NEED to set the expiration date to a TIME in the PAST.

Sometimes you will want to delete a cookie so that subsequent attempts to read the cookie return nothing. To do this, you just need to set the expiration date to a time in the past.

71.

How To Read A Cookie Using Vbscript?

Answer»

Reading a COOKIE is just as simple as writing ONE, because the value of the document.cookie object is the cookie. So you can USE this string WHENEVER you WANT to access the cookie.

The document.cookie string will keep a list of name=value pairs separated by semicolons, where name is the name of a cookie and value is its string value.

You can use strings' split() function to break the string into key and values.

Reading a cookie is just as simple as writing one, because the value of the document.cookie object is the cookie. So you can use this string whenever you want to access the cookie.

The document.cookie string will keep a list of name=value pairs separated by semicolons, where name is the name of a cookie and value is its string value.

You can use strings' split() function to break the string into key and values.

72.

How To Create A Cookie Using Vbscript?

Answer»

The simplest WAY to create a cookie is to ASSIGN a string value to the document.cookie object, which looks like this:

Syntax:

document.cookie = "key1 = value1; key2 = value2; EXPIRES = date";

Here expires attribute is OPTIONAL. If you provide this attribute with a valid date or time then cookie will expire at the given date or time and after that COOKIES' value will not be accessible.

The simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this:

Syntax:

document.cookie = "key1 = value1; key2 = value2; expires = date";

Here expires attribute is optional. If you provide this attribute with a valid date or time then cookie will expire at the given date or time and after that cookies' value will not be accessible.

73.

Can You Access Cookie Using Vbscript?

Answer»

VBScript can ALSO manipulate cookies USING the cookie PROPERTY of the Document object. JavaScript can read, create, modify, and delete the cookie or cookies that apply to the current web PAGE.

VBScript can also manipulate cookies using the cookie property of the Document object. JavaScript can read, create, modify, and delete the cookie or cookies that apply to the current web page.

74.

What Is The Output Of A &amp; B In Vbscript If A = "vb" And B = "script"?

Answer»

& OPERATOR CONCATENATES TWO VALUES. So A & B will GIVE VBScript.

& operator concatenates two values. So A & B will give VBScript.

75.

What Is The Output Of A &amp; B In Vbscript If A = 5 And B = 10?

Answer»

& operator concatenates TWO VALUES. So A + B will give 510.

& operator concatenates two values. So A + B will give 510.

76.

What Is The Output Of A + B In Vbscript If A = "vb" And B = "script"?

Answer»

+ operator concatenates TWO VALUES if values are string. So A + B will GIVE VBSCRIPT.

+ operator concatenates two Values if values are string. So A + B will give VBScript.

77.

What Is The Output Of A + B In Vbscript If A = 5 And B = 10?

Answer»

+ operator ADDS two VALUES as Variable Values are Numeric. So A + B will GIVE 15.

+ operator adds two Values as Variable Values are Numeric. So A + B will give 15.

78.

Which Opearator Can Be Used To Do An Xor Operation In Vbscript?

Answer»

XOR Called LOGICAL Exclusion operator. It is USED to do an XOR OPERATION.

EXAMPLE:

A. DIM a : a = 5
Dim b : b = 10
Dim c
c = b XOR a
Document.write ("XOR Check is " &c)

XOR Called Logical Exclusion operator. It is used to do an XOR operation.

Example:

A. Dim a : a = 5
Dim b : b = 10
Dim c
c = b XOR a
Document.write ("XOR Check is " &c)

79.

Which Opearator Can Be Used To Check If Two Numbers Are Equal Or Not In Vbscript?

Answer»

&LT;&GT; operator is USED to check if two NUMBERS are equal or not.

Example:

Dim a : a = 5
Dim b : b = 10
Dim c
c = b <> a
Document.write ("Equality Check is " &AMP;c)

<> operator is used to check if two numbers are equal or not.

Example:

Dim a : a = 5
Dim b : b = 10
Dim c
c = b <> a
Document.write ("Equality Check is " &c)

80.

Which Opearator Can Be Used To Get The Exponent Of A Number In Vbscript?

Answer»

^ OPEATOR is USED to get the EXPONENT of two numbers.

Example:

Dim a : a = 5
Dim b : b = 10
Dim c
c = b ^ a
Document.write ("EXPONENTIATION RESULT is " &c)

^ opeator is used to get the exponent of two numbers.

Example:

Dim a : a = 5
Dim b : b = 10
Dim c
c = b ^ a
Document.write ("Exponentiation Result is " &c)

81.

Which Opearator Can Be Used To Get The Modulus Of Two Numbers In Vbscript?

Answer»

MOD opeator is used to GET the modulus of two NUMBERS.

Example:

Dim a : a = 5
Dim B : b = 10
Dim c
c = b MOD a
Document.write ("Modulus Result is " &c)

MOD opeator is used to get the modulus of two numbers.

Example:

Dim a : a = 5
Dim b : b = 10
Dim c
c = b MOD a
Document.write ("Modulus Result is " &c)

82.

How Many Types Of Operators Vbscript Supports?

Answer»

VBScript LANGUAGE SUPPORTS following types of OPERATORS:

  1. ARITHMETIC Operators
  2. Comparison Operators
  3. Logical (or Relational) Operators
  4. Concatenation Operators

VBScript language supports following types of operators:

83.

What Is The Scopt Of Constant Declared Using Private?

Answer»

PRIVATE Constants are available WITHIN the procedure or CLASS.

Private Constants are available within the procedure or Class.

84.

What Is The Scope Of A Constant Declared Using Public?

Answer»

The PUBLIC CONSTANTS are AVAILABLE for all the SCRIPTS and PROCEDURES.

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

85.

How Will You Declare A Constant In Vbscript?

Answer»

CONSTANTS are DECLARED USING "CONST" KEYWORD.

Constants are declared using "const" keyword.

86.

What Is The Scope Of A Variable Declared Using Private?

Answer»

Variables that are DECLARED as "PRIVATE" have SCOPE only within that script in which they are declared. When declaring a VARIABLE of type "Private", Dim keyword is replaced by "Private".

Variables that are declared as "Private" have scope only within that script in which they are declared. When declaring a variable of type "Private", Dim keyword is replaced by "Private".

87.

What Is The Scope Of A Variable Declared Using Public?

Answer»

Variables declared USING "PUBLIC" KEYWORD are available to all the PROCEDURES ACROSS all the associated scripts. When declaring a variable of type "public", Dim keyword is replaced by "Public".

Variables declared using "Public" Keyword are available to all the procedures across all the associated scripts. When declaring a variable of type "public", Dim keyword is replaced by "Public".

88.

What Is The Scope Of A Variable Declared Using Dim?

Answer»

Variables DECLARED USING "Dim" KEYWORD at a Procedure level are available only within the same procedure. Variables declared using "Dim" Keyword at script level are available to all the PROCEDURES within the same script.

Variables declared using "Dim" keyword at a Procedure level are available only within the same procedure. Variables declared using "Dim" Keyword at script level are available to all the procedures within the same script.

89.

What Are The Valid Scopes Of A Variable In Vbscript?

Answer»

FOLLOWING are the scopes of variable in VBSCRIPT:

Following are the scopes of variable in VBScript:

90.

How To Assign A Date Value To A Variable?

Answer»

Date and TIME variables should be ENCLOSED WITHIN hash SYMBOL(#).

Date and Time variables should be enclosed within hash symbol(#).

91.

How To Assign A String Value To A Variable?

Answer»

The STRING VALUES should be ENCLOSED WITHIN DOUBLEQUOTES(").

The String values should be enclosed within doublequotes(").

92.

How To Assign A Numeric Value To A Variable?

Answer»

The NUMERIC VALUES should be ASSIGNED without double QUOTES.

The numeric values should be assigned without double quotes.

93.

Do You Need To Specify The Type Of Variable During Declaration?

Answer»

No SINCE there is only ONE FUNDAMENTAL data type, all the DECLARED variables are variant by default. Hence, a user NEED NOT mention the type of data during declaration.

No Since there is only ONE fundamental data type, all the declared variables are variant by default. Hence, a user NEED NOT mention the type of data during declaration.

94.

How Do You Declare A Variable In Vbscript?

Answer»

VARIABLES are DECLARED USING "DIM" KEYWORD.

Variables are declared using "dim" keyword.

95.

What Are The Variable Naming Conventions In Vbscript?

Answer»

Variable is a named memory location used to hold a value that can be CHANGED during the script EXECUTION. VBScript has only ONE fundamental DATA type, VARIANT.

Rules for Declaring Variables:

  • 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.

Variable is a named memory location used to hold a value that can be changed during the script execution. VBScript has only ONE fundamental data type, Variant.

Rules for Declaring Variables:

96.

Is Vbscript Case Sensitive?

Answer»

No! VBScript is a case-insensitive LANGUAGE. This means that language keywords, variables, function names and any other identifiers NEED NOT be TYPED with a consistent CAPITALIZATION of LETTERS.

So identifiers int_counter, INT_Counter and INT_COUNTER have the same meaning within VBScript.

No! VBScript is a case-insensitive language. This means that language keywords, variables, function names and any other identifiers need NOT be typed with a consistent capitalization of letters.

So identifiers int_counter, INT_Counter and INT_COUNTER have the same meaning within VBScript.

97.

What Are The Disadvantages Of Vbscript?

Answer»

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.

Following are the disadvantages of VBScript:

98.

What Are The Advantages Of Vbscript?

Answer»

Following are the advantages of VBSCRIPT:

  1. VBScript is a lightweight scripting language, which has a lightning fast interpreter.
  2. VBScript, for the most part, is case insensitive. It has a very simple syntax, easy to learn and to implement.
  3. Unlike C++ or Java, VBScript is an object-based scripting language and NOT an Object-Oriented Programming language.
  4. It uses Component Object MODEL (COM) in order to ACCESS the elements of the ENVIRONMENT in which it is executing.
  5. 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).

Following are the advantages of VBScript:

99.

What Is Vbscript?

Answer»

Microsoft VBScript (Visual Basic Script) is a general-purpose, lightweight and active scripting LANGUAGE DEVELOPED by Microsoft that is modelled on Visual Basic. Nowadays, VBScript is the primary scripting language for Quick Test PROFESSIONAL (QTP), which is a test automation tool.

Microsoft VBScript (Visual Basic Script) is a general-purpose, lightweight and active scripting language developed by Microsoft that is modelled on Visual Basic. Nowadays, VBScript is the primary scripting language for Quick Test Professional (QTP), which is a test automation tool.