1. (TCO 7) Assuming that you are connected to a database called Computers.mdb with the fields Computer, Hostname Room_Num, CPU_Type, Num_CPUs, Bit_Size, OS_Type, Memory, and HDD_Size, write the SQL Query String sqlStr such that all the fields will be displayed for the records that indicate a speed less than two and a memory value less than four. The returned records should be sorted by Room_Num.
2. (TCO 1) Write the Windows CLI command that will share the folder C:\Data as the share name PublicData.
3. (TCO 1) Write the Windows CLI command that will map the network share called PublicData on FileServer1 to the X: drive for the user netuser with a password of netpass.
4. (TCO 6) Write the VBScript code that defines the Scripting.FileSystemObject and the file C:\Data\DataFile.txt for writing. Make sure the file will be created if it doesn't exist, and ensure that the format is ASCII.
5. (TCO 2) Write the VBScript code lines that perform the following tasks: define a variable age that is initialized to 25. Display a message that uses the variable to display "Your age is 25, but in 10 years you will be 35." where the value 25 and 35 use the variable age.
6. (TCO 5) Write a VBScript procedure (or subroutine) called Swap(ByRef num1,ByRef num2) that accepts two number variables by reference and exchanges the two values whereby num1 is assigned the original value of num2 and num2 is assigned the original value of num1.
7. (TCO 4) Write the VBScript code that initializes all the variables in the numArray(10) to the square of the index value ( numArray(0)=0, numArray(1)=1,numArray(2)=4 ,&#-123;,numArray(10)=100.
8. (TC0 3) Given the variable age, write the VBScript code that will decide whether the age is of a Teenager or Not a Teenager. Display the message "The value of age is a Teenager" or "The value of age is NOT a Teenager," depending on the value of the age.
NY Programmer :
Hello, when do you need the solution (date, time, timezone)? Thank you.
It is currently 8:15 eastern. Is it possible to have this done in an hour? 9:20?
Item 3 is:
net use X: \\FileServer1\PublicData netpass /user:netuser
I can do all the ones except the VBScript items fairly quickly, the VBScript is going to take me some time to write and test. I might be able to nail it in that amount of time though.
That's fine lets do it!
In #1 they don't give the table name so I'll assume they mean Computers is the table name.
sqlStr = "SELECT * FROM Computers WHERE ((Computers.Num_CPUs < 2) And (Computers.Memory < 4)) ORDER BY Computers.Room_Num;"
They say a 'speed of less than two' but there is no column indicating speed, so I assume they mean number of CPU's.
=== #2 is ===
net share PublicData=C:\Data
=== #3 is ===
=== #4 is ===
Const ForAppending = 8dim objFS, objStSet objFS = CreateObject("Scripting.FileSystemObject")Set objSt = objFS.OpenTextFile("C:\data\DataFile.txt", ForAppending, True)=== #5 is ====
dim ageage = 25Wscript.Echo "Your age is " & age & ", but in 10 years you will be " & (age + 10) & "."
Thank you. This isn't so bad after all, got the hang of it now.
=== #6 is ===
Sub Swap(ByRef num1, ByRef num2)dim numTempnumTemp = num1num1 = num2num2 = numTempEnd Sub
And for the above, a stub to test it is:
dim num1dim num2num1=1num2=2Swap num1, num2Wscript.Echo "num1 num2:" & num1 & ", " & num2
=== #7 is ===
dim numArray(10)dim iFor i = 0 to 10 numArray(i) = (i * i)Next
And a test stub for above in case it is needed:
'Test codedim strOutstrOut = ""For i = 0 to 10 strOut=strOut & numArray(i) & ","NextWscript.echo strOut
And === #8 is ===
If (age > 12) And (age < 20) Then Wscript.echo "The value of age is a Teenager"Else Wscript.echo "The value of age is NOT a Teenager"End if
All VBscript I tested to verify it works properly.
Looks good, it is greatly appreciated. Thanks!