Reply = InputBox(“Knock Knock!”)
If Reply = “Who’s there?” then
Msgbox “Correct Answer”
Else
Msgbox “Wrong Answer”
End If
A = “100”
B = A & “10*10”
C = B & “1000/10”
A:
B:
C:
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. _____ 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 |
This line of code will _______________________________________________.
X = 1
For Counter = 0 to 3
X = X + 2
Next
WScript.Echo X
X = Weekday(Date)
WScript.Echo WeekdayName(X)
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 ?
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. 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
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?
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
msgbox Join(myArray, “-“)
Dim MyArray()
Redim MyArray(10)
For I = 1 To 10
Load Array Here
Next
Display with msgbox and Join
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.
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 moreEach 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 moreThanks 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 moreYour 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 moreBy 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
Recent Comments