The WSH (Windows Scripting Host) is a programming environment that allows you to write and execute scripts that run on the Windows and Linux operating systems?

  1. The WSH (Windows Scripting Host) is a programming environment that allows you to write and execute scripts that run on the Windows and Linux operating systems?
    1. True
    2. False

 

  1. The WSH Architecture is made up of a number of different components which include script engines, script execution hosts, and the WSH core object model?
    1. True
    2. False

 

  1. An IDE (Integrated Development Environment) is an application development program that gives programmers the tools required to create applications. An IDE provides tools such as a(n) ____________________ , which translates application code into a finished executable program.
  2. Debugger
  3. Compiler
  4. Editor
  5. VBScript

 

  1. Will this code run without an error? Yes    No       If No then circle the error.

 

Reply = InputBox(“Knock Knock!”)

If Reply = “Who’s there?” then

Msgbox “Correct Answer”

Else

Msgbox “Wrong Answer”

End If

 

  1. VBScript assigns all variables to the variant datatype. The way VBScript determines if something is a string or a number is using double quotation marks. What is the value of A, B and C:

A = “100”

B = A & “10*10”

C = B & “1000/10”

 

A:

B:

C:

 

  1. The WScript object lies at the top, or root, of the WSH core object model. All other WSH Core Object Model objects are created from or instantiated from, this object.
    1. True
    2. False

 

  1. Match up the methods below with their definition.
1.       _____  CreateObject() A.      Displays text message in the Windows Console or as a pop-up dialog depending on which execution host runs the script
2.       _____ DisconnectObject() B.      Terminates a script’s execution
3.       _____ Echo() C.      Establishes an instance of the specified object
4.       _____ Quit() D.      Pauses the execution of a script for a specified number of seconds
5.       _____ SendKeys() E.       Emulates keystrokes and sends typed data to a specified window
6.       _____ Sleep() F.       Prevents a script from accessing a previously instantiated object

 

 

  1. Match up the functions below with their definition.
1.       _____ Array A.      Creates an automation object and returns a reference to it.
2.       _____ CDate B.      Returns a randomly generated number
3.       _____ CreateObject C.      Returns an Uppercase string
4.       _____ LBound D.      Converts an expression to a variant subtype of Date and returns the result
5.       _____ Rnd E.       Returns the smallest possible subscript for the specified array dimension
6.       _____ Ucase F.       Returns an array based on the supplied argument list

 

 

  1. VBScript Syntax Rules –  By default, all VBScript statements must fit on one line.
    1. True
    2. False
  2. You can spread a single statement out over multiple lines by ending each line with the continuation character & _
    1. True
    2. False
  3. More than one VBScript statement can be placed on a single line by ending each statement with the “:” colon character.
    1. True
    2. False
  4. By default, VBScript is not case-sensitive.
    1. True
    2. False
  5. You can enforce case-sensitivity to your code by adding the Option Explicit statement to the beginning of the script.
    1. True
    2. False
  6. By default, an error will halt the execution of any VBScript.
    1. True
    2. False
  7. You can prevent an error from terminating a VBScript’s execution by adding the On Error Resume Next Statement.
    1. True
    2. False
  8. One sign of an experienced programmer is the amount of and usefulness of comments added to their scripts.
    1. True
    2. False
  9. The _____________________________ contains statements that globally affect the scripts, including Option Explicit and On Error, as well as the declaration of any variables, constants, arrays, and objects used by the script.
    1. Main Processing Section
    2. Initialization Section
    3. Procedure Section
    4. Documentation Section

 

  1. Set FsoObject = WScript.CreateObject(“Scripting.FileSystemObject”)

This line of code will _______________________________________________.

  1. Use the FileSystemObject Free Space property
  2. Use the VBScript FormatNumber Function
  3. Display the amount of free space on the C: drive
  4. Instantiate the VBScript FileSystemObject

 

  1. What is the value of X _________

X = 1
For Counter = 0 to 3
X = X + 2
Next
WScript.Echo X

  1. Data is information that a computer program collects, modifies, stores, and retrieves during execution.
  2. True
  3. False
  4. A _____________ is a VBScript construct that contains information that does not change during the execution of a script.
  5. Variable
  6. Variant
  7. Method
  8. Constant
  9. ________ Defines a VBScript variable or Array
  10. Const
  11. ReDim
  12. Dim
  13. String
  14. A ___________________ is a collection of script statements that are processed as a unit and create reusable units of code.
  15. Property
  16. Procedure
  17. Dictionary
  18. Array
  19. What is the value for X: ____________

X = Weekday(Date)
WScript.Echo WeekdayName(X)

 

  1. The & _ character is a VBScript string _______________ operator.
  2. Diagnosis
  3. Concatenation
  4. Script
  5. Initialization
  6. The VBScript string Constant _____________ executes a carriage return and a line feed
  7. vbLF
  8. vbCrLf
  9. vbTab
  10. vbFormFeed

 

  1. A variant is a type of variable that can contain any number of different types of data. Which answer below is not a variant data type.
  2. String
  3. Integer
  4. Double
  5. Square Root

 

 

 

  1. Dim intCounter, strMessage

Dim x(2)

x(0) = “Joe”:  x(1) = “Windows”:  x(2) = “Soda”

intSize = UBound(x)

For intCounter  = 1 to  intSize

strMessage = strMessage & x(intCounter) &  “, “

Next

MsgBox strMessage

 

What is the value of the variable strMessage ?

  1. Windows, System
  2. Unix, Java
  3. Joe, Windows, Soda
  4. Windows, Soda
  5. None of the above
  6. ReDim astrMyName(9) – This ReDim statement has set up the array to store up to 10 elements.
  7. True
  8. False
  9. The use of the Preserve key word on the ReDim statement will prevent the array from losing any data stored in it before increasing the array size. (EX. ReDim Preserve astrMyName)
  10. True
  11. False
  12. When your script is done working with the data stored in an array, you can erase or delete it, thus freeing up a small portion of the computer’s memory. Erase astrMyName
  13. True
  14. False
  15. In addition to variables and arrays, VBScript also lets you store and manage data using Dictionary objects. With dictionaries, data is stored in an associative array and retrieved using key/value pairs.
  16. True
  17. False
  18. SumA=30: SumB = 15

Wscript.echo “SumA:  “ & TypeName(SumA)

Wscript.echo “SumB: “ & TypeName(SumB)

 

What is the Value of SumA: _______________________

What is the Value of SumB: _______________________

 

Hint: TypeName() is a function that returns the Data Type

 

 

 

  1. An argument is a piece of data passed to the script at the beginning of its execution.
  2. True
  3. False
  4. Analyze this script below. Look at the comment’s in steps 1,2,3. Now describe what will this script return. What is the value of WScript.Echo i

‘ 1. initialize array

Dim myArray(3)

 

‘2. set array values

For i = 0 to 3

myArray(i) = “myArrayValue = ” & i

Next

 

‘3. display array values

For Each i IN myArray

WScript.Echo i

Next

 

 

  1. Set objArgs = WScript.Arguments

If objArgs.Count <> 3 then

WScript.Echo “error: invalid number of arguments”

Wscript.Quit

End If

 

Question: If I save this script as myArg.vbs then run:

C:\> CScript.exe Arg.vbs tom peter bill

Will the script Echo and error?

  1. Yes
  2. No

 

 

 

 

 

 

 

 

  1. Write a script:
  2. load an array with 5 elements.
  3. use the For Each intCounter In astrArray …. Next  Loop  to store array elements in a variable strMessage
  4. Display the array with WScript.Echo strMessage

Option Explicit

Dim intCounter, strMessage

strMessage = “The array contains the following elements: “ & vbCrLf & vbCrLf

Dim astrArray(4)

For Each intCounter in astrArray

strMessage = strMessage & astrArray(intCounter) & vbCrLf

Next

Msgbox strMessage

38.   Write in comments to each line of Code.     ‘ File: sortThreeNums.vbs

‘ Sort three Numbers

 

Option Explicit

 

dim num1, num2, num3           ‘ used for input

dim largeNum                   ‘ variable for largest number

dim middleNum                  ‘ variable for second largest number

dim smallNum                   ‘ variable for smallest number

dim temp

 

num1 = InputBox(“Please enter the first number”)

num2 = InputBox(“Please enter the second number”)

num3 = InputBox(“Please enter the third number”)

 

‘ check to make sure all input are “numeric” – integer/float/double

if IsNumeric(num1) and IsNumeric(num2) and IsNumeric(num3) then

MsgBox “You have entered: ” & num1 & ” ” & num2 & ” ” _

& num3, vbOKOnly, “Entered Values”

 

largeNum = CDbl(num1)

middleNum = CDbl(num2)

smallNum = CDbl(num3)

 

if largeNum < middleNum then

temp = largeNum

largeNum = middleNum

middleNum = temp

end if

 

if largeNum < smallNum then

temp = largeNum

largeNum = smallNum

smallNum = temp

end if

 

if middleNum < smallNum then

temp = middleNum

middleNum = smallNum

smallNum = temp

end if

 

MsgBox “The numbers sorted: ” & smallNum & ”  ” & middleNum & ”  ” _

& largeNum, vbOKOnly, “Sorted Numbers”

else

MsgBox “You must enter three numbers! Try Again”, vbOKOnly, _

“Invalid Input”

end if

 

 

 

  1. Write code that will load an array using a “Do” or “For” Then display with:

msgbox Join(myArray, “-“)

 

Dim MyArray()

Redim MyArray(10)

For I = 1 To 10

Load Array Here

Next

Display with msgbox and Join

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!