0% found this document useful (0 votes)
7 views13 pages

DocMerit Devry University Comp 230 Final Exam 3 Complete Solution Graded A

The document contains a series of exam questions and answers related to VBScript and SQL, covering topics such as Boolean operators, SQL SELECT clauses, Windows commands, and VBScript programming concepts. It includes multiple-choice questions, coding tasks, and explanations for various programming scenarios. Additionally, it promotes a platform called DocMerit for selling study notes.

Uploaded by

maxxymakau
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views13 pages

DocMerit Devry University Comp 230 Final Exam 3 Complete Solution Graded A

The document contains a series of exam questions and answers related to VBScript and SQL, covering topics such as Boolean operators, SQL SELECT clauses, Windows commands, and VBScript programming concepts. It includes multiple-choice questions, coding tasks, and explanations for various programming scenarios. Additionally, it promotes a platform called DocMerit for selling study notes.

Uploaded by

maxxymakau
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

DeVry University.

COMP 230 Final


Exam - 3. Complete Solution. Graded
A

written by
realer

Did you know a seller earn


an average of $450 per month
selling their study notes
on DocMerit

Scan the QR-code and learn how you can also turn your class
notes, study guides into real cash today.

DocMerit.com - The Best Study Notes

Uploaded by: realer on DocMerit. Distribution of this document is illegal


Question 1. 1. (TCO 7) In an SQL Query statement used in a VBScript program,
what Boolean operator can be used to test a set of conditions whereby any condition
being true must test true? (Points : 5)
OR
AND
XOR
NOT

Question 2. 2. (TCO 7) Which one of the following is a correct SELECT clause in a


VBScript program for selecting the fields: FirstName and LastName and Age?
(Points : 5)
SELECT FirstName and LastName and Age
SELECT FIELDS(FirstName,LastName,Age
SELECT FirstName,LastName,Age
SELECT FROM FirstName,LastName,Age

Question 3. 3. (TCO 7) What SQL clause is used in a VBScript program to


determine the Table or Tables to be accessed in an SQL Query statement? (Points :
5)
TABLE
FROM
SELECT
WHERE

Question 4. 4. (TCO 7) Which one of the follows fields would be suitable as a


primary key in a table that contains employee records? (Points : 5)
Area code
Last name
Birth date
Employee number
Question 5. 5. (TCO 1) Which Windows shutdown command switch is used to log
off the current user of the local computer? (Points : 5)
-l
/logoff
-f
/f

Question 6. 6. (TCO 1) Which one of the following Windows NET commands will
allow other computers to access the C:\Data directory under the share
name UserData? (Points : 5)
NET USE UserData=C:\Data
NET SHARE UserData=C:\Data
NET USE C:\Data = UserData
NET SHARE C:\Data=UserData

Question 7. 7. (TCO 1) From the Start/Run dialog, the command used to open the
32-bit Windows command prompt is _____. (Points : 5)
command
cmd
start
prompt

Question 8. 8. (TCO 1) Which of the following Windows commands will shutdown


and power down the computer FileServer in 2 minutes? (Points : 5)
shutdown -s -m //FileServer -t 2
shutdown -s -m //FileServer -t 120
shutdown -s -m \\FileServer -t 2
shutdown -s -m \\FileServer -t 120

Question 9. 9. (TCO 6) What WSH object is required for VBScript File I/O?
(Points : 5)
Scripting.FileSystemObject
FileSystemObject
Scripting.FileSystem
WScript.FileSystemObject

Question 10. 10. (TCO 6) To evaluate whether a file exists or not before you
overwrite it in VBScript, use the following command (assuming that fso is an object
of type Scripting.FileSystemObject). (Points : 5)
If fso.FileCreated(file) Then
If fso.FileExists(file) Then
If fso.FileNotFound(file) Then
If fso.FileFound(file) Then

Question 11. 11. (TCO 6) The following VBScript statement will open a text file.

Set file = fso.OpenTextFile(“C:\Data\CustData.txt”, ForWriting)

To open this file for writing, the value of ForWriting must be _____. (Points : 5)
1
2
true
false

Question 12. 12. (TCO 2) Given the rules of operator precedence, what value would
the variable contain after the following statement was executed? distance = 2 + 5 * 3
(Points : 5)
21
17
4
3.33

Question 13. 13. (TCO 2) What is an example of a numeric constant? (Points : 5)


"1"
"oops"
12432
"12332"
Question 14. 14. (TCO 2) What is the problem with the following statement? 75 =
percent (Points : 5)
75 is not a reasonable percent value.
Data types don't match.
75 should be in quotes.
The value on the left must be a variable name.

Question 15. 15. (TCO 2) What is the best choice for a variable name representing a
bank balance? (Points : 5)
bankBalance
balance
bb
b

Question 16. 16. (TCO 2) What is the problem with the following statement? 65 =
seniorAge (Points : 5)
65 is not a reasonable age for a senior.
The data types don't match.
65 should be in quotes.
The value on the left must be a variable name.

Question 17. 17. (TCO 5) What name is best suited to a function or subroutine that
calculates overtime pay? (Points : 5)
calcO()
calculate overtime()
cO()
calculateOvertime()

Question 18. 18. (TCO 5) A good example of a well-named constant is _____.


(Points : 5)
340
speed
SPEED_OF_SOUND
sound340

Question 19. 19. (TCO 3) What VBScript decision-making statement would be for a
single condition and two alternative code blocks to be executed? (Points : 5)
If/Then
While
If/Then/Else
Do/Until

Question 20. 20. (TCO 3) What produces the same result as the following
pseudocode?

if empRate >= 10.00 then


if empRate < 20.00 then
print empIdNumber, empLastName, empFirstName
endif
endif (Points : 5)

if empRate >= 10.00 AND empRate < 20.00 hen


print empIdNumber, empLastName, empFirstName
end if

if empRate >= 10.00 AND empRate < 20.00 then


WScript.Echo empIdNumber & empLastName & empFirstName
end if

if empRate>= 10.00 OR empRate < 20.00


print empIdNumber, empLastName, empFirstName
end if

if empRate>= 10.00 OR empRate < 20.00


WScript.Echo empIdNumber & empLastName & empFirstName
end if
Question 21. 21. (TCO 3) In VBScript, which relational operator is used to test for
equality? (Points : 5)
==
#
=
:=

Question 22. 22. (TCO 3) Boolean expressions can have which outcomes? (Points :
5)
Only true
Only false
True or false
True, false, or maybe

Question 23. 23. (TCO 3) When using the _____ operator, both conditions must be
true in order for the entire expression to be evaluated as true. (Points : 5)
math
Not
OR
AND

Question 24. 24. (TCO 4) What is the issue with the following VBScript While
loop?
count = 1
While count < 10
WScript.Echo count
count = count - 1
Wend (Points : 5)
The loop will not terminate properly.
The loop is missing a loop condition.
The loop is not initialized.
The loop is missing loop body.
Question 25. 25. (TCO 4) When a VBScript loop control variable is not altered
during loop execution, a(n) _____ loop may result. (Points : 5)
single pass
indeterminate
endless
default

Question 26. 26. (TCO 4) Which VBScript statement represents incrementing the
loop counter variable called count? (Points : 5)
count = 1
while (count <= 10)
count = count + 1
count++

Question 27. 27. (TCO 4) When a variable is incremented by 1, _____. (Points : 5)


1 is added to the value
the value is multiplied by 1
1 is subtracted from the value
the value is divided by 1

Question 28. 28. (TCO 4) What is the term used to represent individual items in an
array? (Points : 5)
Variable
Index
Element
Superscript

Question 1. 1. (TCO 1) Write the Windows CLI commands that will Clear the
screen; Turn off Command echo; and display the current IP address, Subnet Mask,
and Default Gateway. (Points : 13)
Clear the screen

Cls

To turn off command

echo;@echo off

To display current IP addess, subnet mask and default gateway;

Ipconfig

Question 2. 2. (TCO 1) Write the Windows CLI command that will shutdown and
restart your computer in 2 minutes with the message “Restart in 2 Minutes!!”
(Points : 13)

shutdown -r -t 120 -c "Restart in 2 Minutes!!"

Question 3. 3. (TCO 2) Write the VBScript code lines that perform the following
tasks: Define a variable name that is initialized to “John Doe” and a variable age
that is initialized to 35. USING THESE VARIABLES, display the following
message: “Your name is John Doe and your age is 35.” (Points : 14)

Dim name
Dim age
name="John Doe"
age=35
MsgBox "Your name is " & name & " and your age is" & age

Question 4. 4. (TC0 3) Given the variables hoursWorked and payRate, write the
VBScript code that will calculate grossPay. Keep in mind that any hours worked
over 40 are paid at time and a half. (Points : 14)

Dim payRate
Dim hoursWorked
Dim grossPay
payRate = InputBox("Enter the pay Rate :")
hoursWorked = InputBox("Enter the hours worked :")
if hoursWorked> 40 then
grossPay = 40 * payRate + (hoursWorked - 40) * 1.5 * payRate
else
grossPay = hoursWorked * payRate
End if
MsgBox "Gross Pay " & grossPay

Question 5. 5. (TCO 3) Write the VBScript code that implements this logic. Given
the numeric variable age, display the message “You are a Senior” if age is greater
than or equal to 65, otherwise display the message “You are not a Senior”. (Points :
14)
Dim age

age = InputBox("Enter the Age :")

If (age >65) Then

Wscript.echo "You are a Senior"

Else

Wscript.echo "You are not a Senior"

End if

Question 1. 1. (TCO 5) Write a VBScript function called MaxNum that accepts


two numbers and returns the largest to the two numbers. (Points : 14)

Function MaxNum(ByVal num1, ByVal num2)

If (num1 > num2) Then

MaxNum = num1

Else

MaxNum = num2

End If

End Function

To Test, if needed:
num1 = 1

num2 = 2

Wscript.echo "Max of 1,2: " & MaxNum(num1,num2)

Wscript.echo "Max of 2,1: " & MaxNum(num2,num1)

Question 2. 2. (TCO 6) Write the VBScript code that will delete the
file C:\Data\DataFile.txt using a Script.FileSystemObject, but do this only if the
file exists. (Points : 14)

Dim FileSystem
Set FileSystem = CreateObject("Scripting.FileSystemObject")
If FileSystem.FileExists("C:\Data\DataFile.txt") Then
FileSystem.DeleteFile "C:\Data\DataFile.txt"
End If

Question 3. 3. (TCO 7) Assuming that you are connected to a database called


Computers.mdb with a table called Inventory 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 the fields Computer,
Room_Num, and OS_Type will be displayed for the records that indicate an
OS_Type of “Fedora 10” or “Windows XP.” The returned records should be sorted
by OS_Type. (Points : 14)
sqlStr = "SELECT Computer, Room_Num, and OS_Type FROM
Computers WHERE (OS_Type= “Fedora 10” OR OS_Type= “Windows
XP.”) ORDER BY Computers. OS_Type;"

You might also like