27
COMP 230 Final Exam http://www.tutorialsguider.com/downloads/comp- 230-final-exam-guide/ COMP 230 Final Exam 1. (TCO 2) What is an example of a string constant? (Points : 5) 1 "oops" 12432 o

COMP 230 Final Exam

  • Upload
    rooney

  • View
    77

  • Download
    3

Embed Size (px)

DESCRIPTION

COMP 230 Final Exam

Citation preview

COMP 230 Final Exam

http://www.tutorialsguider.com/downloads/comp-230-final-exam-guide/

COMP 230 Final Exam

1. (TCO 2) What is an example of a string constant? (Points : 5)

1

"oops"

12432

o

2. (TCO 2) What is the assignment operator? (Points : 5)

=

^

*

%

3. (TCO 2) The symbols used to describe the logic of a program are known as _____. (Points : 5)

desk checking

pseudocode

flowcharts

code maps

4. (TCO 2) If a variable holds the value 12345, what is its data type? (Points : 5)

Text

Integer

Floating point

String

5. (TCO 3) The logical AND operator can replace ____ in how it behaves. (Points : 5)

a sequence of selection structures

nested selection structures

nested and sequenced selection structures

division

6. (TCO 3) Which pseudocode produces the same result as the following? if customerAge > 65 OR customerAge = 65 thendiscount = 0.10

(Points : 5)

else discount = 0

endif (Points : 5)

if customerAge >= 65 then discount = 0.10

else discount = 0 endif

if customerAge > 65 then discount = 0

elsediscount = 0.10 endif

if customerAge discount = 0.10 else

discount = 0 endif

if customerAge discount = 0 else

discount = 0.10 endif

7. (TCO 3) What logic operator could be used to replace the nested selection structure in this pseudocode?

if empMedicalIns = "Y" then if empDentalIns = "Y" then

print empIdNumber, empLastName, empFirstNameendif endif

Dual-alternative selection

Logical AND

Logical OR

Logical NOT

8. (TCO 3) In order to have the most efficient program, which question should be asked first when working with an AND decision? (Points : 5)

The one that is less likely to be true

The one that is more likely to be true

The one that involves fewer comparisons

The one with the lower value

9. (TCO 3) If you are asked to write a program that prints a list of books that have fewer than 30 pages

and more than 100 pages, what type of decision structure would you use? (Points : 5)

AND

OR

Join

Single alternative

10.(TCO 3) A ______ represents only one of two states, usually expressed as true or false. (Points : 5)

case structure

logical AND

binary selection

Boolean expression

11.(TCO 4) How many times will the following loop execute?

rep = 0while rep rep = rep + 1loop (Points : 5)

0

10

9

11

12.(TCO 4) Array subscripts are always ____. (Points : 5)

large numbers

negative values

characters

integers

13.(TCO 4) When a loop-control variable is not altered during loop execution, a(n) _____ loop may result.

(Points : 5)

decrement indeterminate infinite default

14. (TCO 4) A loop-control variable that is incremented a specific number of times is known as a(n) ____.

(Points : 5)

(Points : 5)

sentinel

trivial comparison

indefinite value

counter

15.(TCO 4) A countdown loop operates by the loop-control variable _____. (Points : 5)

initializing

checking

decrementing

incrementing

16.(TCO 4) All of the elements in an array have the same ____. (Points : 5)

subscript

memory location

name

data type

Final Exam: Page 2

1. (TCO 1) Which of the following Windows commands will shut down and restart the computer FileServer in 2 minutes? (Points : 5)

shutdown -r -m //FileServer -t 2 shutdown -r -m //FileServer -t 120 shutdown -r -m \\FileServer -t 2 shutdown -r -m \\FileServer -t 120

2. (TCO 1) The NETSH command that will set the IP address of the interface name NIC to a DHCP-

supplied IP address is _____.

netsh interface set ip address "NIC" source=dhcp netsh interface ip address "NIC" source=dhcp netsh interface ip set address "NIC" source=dhcp

netsh interface set ip address source=dhcp "NIC"

3. (TCO 1) From a 32-bit Windows CLI, the command used to open a new CLI window is _____. (Points : 5)

command cmd start prompt

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

5. (TCO 5) What statement is used to indicate the end of a function? (Points : 5)

Stop

Return

End

Done

6. (TCO 5) What variable scope is preferable? (Points : 5)

Implicit

Global

Local and global

Local

7. (TCO 5) When writing named constant identifiers, it is a common convention to ______. (Points : 5)

use mixed-case letters use only lower-case letters

Named constants do not have identifier names. use only upper-case letters

8. (TCO 5) What of the following would most likely be a named constant? (Points : 5)

(Points : 5)

(Points : 5)

(Points : 5)

x

taxRate

isFinished

TAX_RATE

9. (TCO 6) The following command opens a text file in VBScript.

Set file = fso.OpenTextFile("C:\Data\CustData.txt", ?, ??, ???)To open a file for writing, the value of ? must be _____.

1

2

True

False

10. (TCO 6) Once you have a file selected with file = fso.GetFile("C:\DataFile.dat"), what command will

allow you to access the file attributes?

file.Attrib

fso.Attributes

file.Attributes

fso.Attrib

11. (TCO 6) The following command opens a text file in VBScript.

Set file = fso.OpenTextFile("C:\Data\CustData.txt", ?, ??, ???)To ensure that the file is formatted as ASCII instead of as Unicode, the value of ??? must be _____. (Points

: 5)

0

-1

2

-2

12. (TCO 6) The following command opens a text file in VBScript.

Set file = fso.OpenTextFile("C:\Data\CustData.txt", ?, ??, ???)To open a file for reading, the value of ? must be _____.

1

2

True

False

13.(TCO 7) The general syntax of an SQL select statement is _____. (Points : 5)

Select--From--Where

Get--Date--Where

Select--Update--When

Select--Condition--Table

14.(TCO 7) The questions that cause the database software to extract the appropriate records from a

table and specify the fields to be viewed are called ____. (Points : 5)

reports keys queries indexes

15.(TCO 7) What is the name for a column that uniquely identifies a record? (Points : 5)

Primary key

Unique key

Foreign key

Table key

16.(TCO 7) What is the name for a unique key that is constructed from multiple columns? (Points : 5)

Primary key

Compound key

Foreign key

Candidate key

Final Exam: Page 3

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 : 12)

2.(TCO 1) Write the Windows CLI NET commands that will turn the Spooler service OFF and then

ON. (Points : 12)

3. (TCO 2) Write the VBScript code lines that define a constant TAXRATE that is 25%, a variable basePay that is $1000, and a variable bonusPay that is $500. Calculate the net pay, and assign that value to netPay. Then, calculate the taxes, and assign that value to taxWithheld. (Points : 11)

4. (TCO 3) Given the variable age, write the VBScript code that will decide whether the age is of a teenager or is not of a teenager. Display the message "The value of age is a Teenager" or "The value ofage is NOT a Teenager," depending on the value of the age.(Points : 11)

Final Exam: Page 4

1. (TCO 4) Write the VBScript code that initializes all the variables in the numArray(100) to the value

numArray(0)=1, numArray(1)=2,-123;,numArray(100)=101.

2. (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 assignedthe original value of num2, and num2 is assigned the original value of num1.

3.(TCO 6) Write the VBScript code that defines the Scripting.FileSystemObject and the file C:\Data\DataFile.txt for writing. Make sure that the file will be created if it doesn't already exist, and ensure that the format is ASCII. (Points : 11)

4. (TCO 7) Assuming that you are connected to a database called Computers.mdb with the fieldsComputer, 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, Hostname, and CPU_Type will be displayed for all the records that indicate that CPU_Type is "AMD" and the Bit_Size is 64. The

returned records should be sorted by Hostname.