VBScript Advanced Interview Questions & Answers

  1. Question 1. Explain About Vb Script?

    Answer :

    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. Question 2. Give Examples Where Vb Script Can Directly Run On Users System With Windows As Os?

    Answer :

    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. QTP Interview Questions

  4. Question 3. Explain About .wsf Files?

    Answer :

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

  5. Question 4. Explain About The Extension .hta?

    Answer :

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

  6. QTP Tutorial

  7. Question 5. Explain Some Uses Of Vb Script?

    Answer :

    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.

  8. Visual Basics Interview Questions

  9. Question 6. Compare Java Script And Vb Script?

    Answer :

    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.

  10. Question 7. Explain About The Support Of Asp For Vb Script Functionality?

    Answer :

    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 with in <% and %> context switches. ASP can provide varied functionality to VB Script.

  11. VB Script Tutorial
    Active Directory Interview Questions

  12. Question 8. Explain About The Functionality Of Vb Script?

    Answer :

    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.

  13. Question 9. Explain About Scrrun.dll?

    Answer :

    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.

  14. ActiveX Interview Questions

  15. Question 10. Explain About Adodb.stream Class?

    Answer :

    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.

  16. Software testing Tutorial

  17. Question 11. Explain About Arrays In Vb Script?

    Answer :

    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.

  18. VB Script Interview Questions

  19. Question 12. Explain About The Asc Function?

    Answer :

    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.

  20. QTP Interview Questions

  21. Question 13. Explain About Filter Expression?

    Answer :

    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.

  22. script.aculo.us Tutorial

  23. Question 14. Explain About Constants In Vb Script?

    Answer :

    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.

  24. Question 15. Explain About Tristate Constants?

    Answer :

    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.

  25. Software testing Interview Questions

  26. Question 16. Explain About Operator Precedence In Vb Script?

    Answer :

    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.

  27. Software Development Lifecycle (SDLC) Tutorial

  28. Question 17. What Are The Different Types Of Operators And Their Order Of Precedence?

    Answer :

    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.

  29. Test Cases Interview Questions

  30. Question 18. What Is Event Handling In Vbscript?

    Answer :

    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.

  31. Visual Basics Interview Questions

  32. Question 19. Explain Few Date Functions In Vbscript?

    Answer :

  33. Unittest Framework Tutorial

  34. Question 20. What Are String Functions In Vbscript?

    Answer :

    Asc() - Returns ANSI Character Code
    Chr() - Returns Character from ANSI Code
    InStr() - Find a string within another
    InStrRev() - Find a string within another (Reverse)
    LCase() - Convert a string to lowercase
    Left() - Crops a string from left
    Len() - Determine the length of a string
    LTrim() - Remove leading spaces from a string
    Mid() - Crops a string
    Replace() - Replace a substring within a string
    Right() - Crops a string from right
    RTrim() - Remove trailing spaces from a string
    Space() - Creates a string with the specified number of spaces
    StrComp() - Compare two strings
    String() - Creates a repeated character string
    StrReverse() - Reverse the characters of a string
    Trim() - Remove both leading and trailing spaces from a string
    UCase() - Convert a string to uppercase
  35. Software Development Lifecycle (SDLC) Interview Questions

  36. Question 21. Explain Vbscript In Detail?

    Answer :

    This is a scripting language developed by Microsoft and is based loosely on Visual Basic. Its functionality in a web environment is defendant upon either an ASP engine or the Windows Scripting Host, and must be used on a Windows hosting platform.

  37. Question 22. How To Open Browser In Vb Script?

    Answer :

    set ie=createobject(“internetexplorer.application”)
    set ie = nothing
  38. QUnit Testing Tutorial

  39. Question 23. Why To Use Option Explicit In Vb Script?

    Answer :

    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
    msgbox abcd
    dim bcde
    msgbox bcdef
  40. Unittest Framework Interview Questions

  41. Question 24. How To Open A File. What Is The Perpose Of True And False Mode There?

    Answer :

    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”)
    msgbox str
    set files=nothing
  42. Active Directory Interview Questions

  43. Question 25. If Else For Do While Select In Vb Script?

    Answer :

    if i>j then
    msgbox i
    elseif i msgbox j
    msgbox “nothing”
    end if
    for i=5 to 10 step 2
    msgbox i
    do while i<15
    msgbox i
    select case mycase
    case “abcd”
    msgbox “abcd”
    case mycase
    msgbox mycase
    case else
    msgbox “wrong”
    end select
  44. TypeScript Tutorial

  45. Question 26. How To Write Functions And Sub In Vb Script?

    Answer :

    function add(a,b)
    end function
    msgbox s
    sub add2(x,y)
    msgbox sum
    end sub
    call add2(6,8)
  46. QUnit Testing Interview Questions

  47. Question 27. What Is Variant In Vb Script?

    Answer :

    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.

  48. ActiveX Interview Questions

  49. Question 28. How To Open Excel In Vb Script?

    Answer :

    set xl=createobject(“excel.application”)
    set wb=xl.workbooks.open(“d:/sample.xls”)
    set ws=wb.worksheets(1)
    set wb=nothing
    set ws=nothing
    set xl=nothing
  50. Question 29. Difference Between Dim,public And Private Variables In Vb Script?

    Answer :

    Use of dim ,private and public variables in vb script function first

    dim a
    msgbox a ‘ 20 displays
    end function
    msgbox a ‘ this gives empty value
    ‘ so dim variables are not public if we use within function
    dim b
    function second
    msgbox b ‘ 30 displays
    end function
    ‘ if we declare dim variables outside the function then it will act as public
    class myclas
    public c
    private d
    dim e
    sub mysub
    msgbox “public:“&c&” private :”&d&”dim :”&e
    end sub
    end class
    set obj=new myclas
    msgbox obj.c
    ‘msgbox obj.d ‘it won’t allow to display private
    msgbox obj.e
  51. Microsoft Visual C++ Interview Questions

  52. Question 30. What Is Difference Between Vbscript And Vba?

    Answer :

    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.

  53. Question 31. What Is The Difference Between Function And Procedure?

    Answer :

    A function, which is called differently from a subroutine, returns a value to the code that calls it, while a procedure (subroutine) does not. Functions must be set equal to a return value:

    Variable_1 = My_Function(A, B, C)

    A subroutine, on the other hand, isn’t set to a variable. It can be called like

    My_Subroutine A, B, C
    Call My_Subroutine(A, B, C)

  54. Question 32. Is Vbscript A Case-sensitive Or Case-insensitive?

    Answer :

    VBScript is a case-insensitive programming language; i.e. case is ignored when reading VBScript scripts. So myVar, MyVar, MYvar all refer to the same variable.

  55. TypeScript Interview Questions

  56. Question 33. What Are The Data Types Supported By Vbscript?

    Answer :

    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.

  57. VB Script Interview Questions

  58. Question 34. By Default In Vbscript The Arguments Passed To Functions And Subroutines Are By Reference Or By Value?

    Answer :

    By default, arguments are passed to functions and subroutines by reference; that is, the address of the argument is provided to the function or subroutine.

  59. Question 35. Which Function Allows You To Instantiate An Object Given Its Programmatic Identifier Or Progid?

    Answer :

    CreateObject function.

  60. Question 36. What Is Dictionary Object In Vbscript? Explain?

    Answer :

    The Dictionary object stores name / value pairs (referred to as the key and item respectively) in an array.

    Write the below code in a notepad and save it with a .vbs extension and run it from Command Prompt by just typing the name of the file.

    Dim Beers

    Set Beers = CreateObject("Scripting.Dictionary")
    Beers.Add "a", "Strauss"
    Beers.Add "b", "Kingfisher"
    Beers.Add "c", "Budweiser"
    Msgbox ("The value corresponding to the key'b'is"&Beers.Item("b"))

    The Dictionary object has many properties like Count, Item, CompareMode etc and many methods like Exists, Add, and Keys etc.

  61. Software testing Interview Questions

  62. Question 37. What Is The Difference Between A Dictionary And An Array?

    Answer :

    A dictionary can’t be multidimensional but an array can be.

    A dictionary has extra methods to add new items and check for existing items.

    When you delete a particular item from a dictionary, all the subsequent items automatically shift up. For example, if you delete the second item in a three-item dictionary, the original third item automatically shifts up into the second-item slot.

  63. Question 38. What Is The Purpose Of On Error Resume Next Statement?

    Answer :

    The On Error Resume Next statement provides you some degree of error handling by preventing program interruptions from runtime errors.

    When an error occurs, by using this statement, the line of code containing the error is simply skipped over and the program continues.

    On Error Resume Next statement does not correct an error, just ignore it, without even displaying the error message.

    The Statement essentially has two ways it is used. First to turn off the script engine error checking:

    On Error Resume Next

    The second is to turn it on, thereby allowing the script engine to stop execution of a script when an error is encountered. Like so:

    On Error Goto 0

  64. Question 39. Which Object Provide Information About A Single Runtime Error In A Vbscript?

    Answer :

    Err Object.

  65. Question 40. What’s The Difference Between Vbscript And Vb.net?

    Answer :

    VBScript is script – a text-based code that gets interpreted by a “host”, like the Windows Script Host or IE. VB.Net is a semi-compiled language for writing java-like software.

  66. Test Cases Interview Questions

  67. Question 41. Which Command Is Used For Writing Text On A Page?

    Answer :

    Document.Write (text).

  68. Question 42. What Aspects Of Vbscript Make It Safe So That A Web Page Using Vbscript Cannot Destroy Or Corrupt Information On A User’s Computer?

    Answer :

    The VBScript code that comes along in a Web page cannot directly access any files on the client’s computer. This prevents a Web page from making any modifications to sensitive files on the user’s computer. VBScript is also very safe in that it doesn’t give programmers the ability to create unrecoverable crashes by virtue of its language syntax.

  69. Software Development Lifecycle (SDLC) Interview Questions

  70. Question 43. Write The Code Required Within A Procedure To Create A Variable For Storing Your Name With Vbscript Code. Assign Your Name To That Variable?

    Answer :

    Dim Name

    Name = “Harry Manis”

  71. Question 44. Assume You Have A Variable Called Age That Contains An Age Provided By The User. Write The Code That Ensures That The User Has Entered A Number As Her Age. If The User Hasn’t Entered A Number, Tell Her She Needs To Enter Her Age Correctly?

    Answer :

    If IsNumeric(Age) = False Then

    MsgBox "The size should be a number. Please type it again."
    End If
  72. Question 45. Write A Vbscript Procedure That Converts Feet To Inches. Hint: There Are 12 Inches In A Foot?

    Answer :

    Option Explicit

    Sub feet_to_inch()
    Dim Inches, Feet
    Feet=inputbox("Enter feet value ")
    Inches = Feet * 12
    MsgBox "There are " & Inches & " inches in " & Feet & " feet."
    End Sub 
    Call feet_to_inch()
  73. Question 46. Why Is The Use Of Exit Do Or Exit For Statements Within Loops Discouraged?

    Answer :

    These statements are acceptable for specific conditions, but they often make code less readable, which makes it difficult for others who look at your code to know what’s really going on. If you make sure the only way out of a loop is to not satisfy the loop’s condition, it’s much easier to follow your code. Often, breaking out of a loop by force with an exit statement is a sign of a poorly constructed loop with a condition that does not meet your goals. Take a look at the loop structure and condition again to make sure you’re not leaving something out.

  74. Question 47. What Is The Difference Between Vb Debugger And The Script Debugger?

    Answer :

    Difference between VB Debugger and the Script Debugger:

    No “on the fly” editing

    Because the scripting window is read-only, you cannot edit the code during execution, as you can most of the time with VB.

    No Instant Watch (Shift-F9)

    The VB debugger’s instant watch facility, which allows you to highlight a variable in your code, press Shift-F9, and see the value of the variable, is not available in the Script Debugger.

    Cannot set watches Watches do not exist in the Script Debugger.

    Cannot set the next statement Using the VB Debugger, you can place the cursor on a line of code and, by clicking CTRL-F9, have program execution resume at that line. This is particularly useful to backtrack or to re-execute a section of code. Unfortunately, this feature is not available in the Script Debugger.

  75. Question 48. Explain Few Date Functions In Vbscript?

    Answer :

    Date(), Time(), Now(), Left(), Right(), & Mid()

  76. Question 49. What Is The Function Of Smon?

    Answer :

    The SMON background process performs all system monitoring functions on the oracle database.
    Each time oracle is re-started, SMON performs a warm start and makes sure that the transactions that were left incomplete at the last shut down are recovered.

    SMON performs periodic cleanup of temporary segments that are no longer needed.

  77. Question 50. Explain Different Types Of Segment?

    Answer :

    There are four types of segments used in Oracle databases:

    • data segments
    • index segments
    • rollback segments
    • temporary segments

    Data Segments:

    There is a single data segment to hold all the data of every non clustered table in an oracle database. This data segment is created when you create an object with the CREATE TABLE/SNAPSHOT/SNAPSHOT LOG command. Also, a data segment is created for a cluster when a CREATE CLUSTER command is issued. The storage parameters control the way that its data segment’s extents are allocated. These affect the efficiency of data retrieval and storage for the data segment associated with the object.

    Index Segments:

    Every index in an Oracle database has a single index segment to hold all of its data. Oracle creates the index segment for the index when you issue the CREATE INDEX command. Setting the storage parameters directly affects the efficiency of data retrieval and storage.

    Rollback Segments:

    Rollbacks are required when the transactions that affect the database need to be undone. Rollbacks are also needed during the time of system failures. The way the roll-backed data is saved in rollback segment, the data can also be redone which is held in redo segment.

    A rollback segment is a portion of the database that records the actions of transactions if the transaction should be rolled back. Each database contains one or more rollback segments. Rollback segments are used to provide read consistency, to rollback transactions, and to recover the database.

    Types of rollbacks:

    • statement level rollback
    • rollback to a savepoint
    • rollback of a transaction due to user request
    • rollback of a transaction due to abnormal process termination
    • rollback of all outstanding transactions when an instance terminates abnormally
    • rollback of incomplete transactions during recovery.

    Temporary Segments:

    The SELECT statements need a temporary storage. When queries are fired, oracle needs area to do sorting and other operation due to which temporary storages are useful.

    The commands that may use temporary storage when used with SELECT are:


  78. Question 51. Explain Sga Memory Structures?

    Answer :

    SGA (System Global Area) is a dynamic memory area of an Oracle Server. In SGA,the allocation is done in granuels. The size of the SGA is dependent on SGA_MAX_SIZE parameter.

    The memory structures contained by SGA are:

    Shared Pool :

    this memory structure is divided into two sub-structures which are Library Cache and Data Dictionary Cache for storing recently used PL/SQL statements and the recent data definitions. The maximum size of the Shared Pool depends on the SHARED_POOL_SIZE parameter.

    Database Buffer Cache :

    This memory structure improves the performance while fetching or updating the recently used data as it stores the recently used datafiles. The size of this block is decided by DB_BLOCK_SIZE.

    Redo Log Buffer :

    This memory structure is used to store all the changes made to the database and it’s primarily used for the data recovery purposes. The size of this block is decided by LOG_BUFFER.

    Java Pool :

    This memory structure is used when Java is installed on the Oracle server. Size that can be used is stored in parameter named JAVA_POOL_SIZE.

    Large Pool :

    This memory structure is used to reduce the burden of the Shared Pool, as the Session memory for the Shared Server, as the temporary storage for the I/O and for the backup and restore operations or RMAN. Parameter that stores the maximum size is LARGE_POOL_SIZE.

  79. Question 52. What Is Sql Loader? Explain The Files Used By Sql Loader To Load File?

    Answer :

    SQL*Loader is a bulk loader utility used for moving data from external files into the Oracle database. SQL*Loader supports various load formats, selective loading, and multi-table loads. When a control file is fed to an SQL*Loader, it writes messages to the log file, bad rows to the bad file and discarded rows to the discard file.

    Control file:

    The SQL*Loader control file contains information that describes how the data will be loaded. It contains the table name, column datatypes, field delimiters, etc.

    controlfile.sql should be used to generate an accurate control file for a given table.

    Log File:

    The log file contains information about the SQL*loader execution. It should be viewed after each SQL*Loader job is complete.