Name:     ID: 
 
Email: 

COSC 2328 Chap 14 and 15 Quiz

True/False
Indicate whether the statement is true or false.
 

 1. 

A repetition structure can be either a pretest loop or a posttest loop.
 

 2. 

The difference between pretest and posttest loops pertains to how the accumulator is evaluated.
 

 3. 

The instructions in a pretest loop will be processed at least once.
 

 4. 

Most programmers use posttest loops.
 

 5. 

A pretest loop is easier to write and understand than a posttest loop with a selection structure.
 

 6. 

The Do…Loop statement can be used to code a pretest loop as well as a posttest loop.
 

 7. 

In the pretest syntax, the condition is evaluated after the loop instructions are processed.
 

 8. 

In the posttest syntax, the condition is evaluated before the loop instructions are processed.
 

 9. 

In the posttest syntax, the only purpose of the Do clause is to mark the beginning of the loop.
 

 10. 

The repetition diamond appears at the top of the loop in the flowchart of a posttest loop.
 

 11. 

When concatenating strings, you must be sure to include a space before and after the ampersand; otherwise, the Code Editor will not recognize the ampersand as the concatenation operator.
 

 12. 

The ControlChars.NewLine constant is used to create a new line.
 

 13. 

A counter loop can be either a pretest loop or a posttest loop.
 

 14. 

A pretest counter loop can only be coded using the Do…Loop statement.
 

 15. 

The For...Next statement provides the most convenient way to code a posttest counter loop.
 

 16. 

You do not need to specify the counter variable’s name in the Next clause, but doing so is highly recommended because it makes your code more self-documenting.
 

 17. 

When you declare a variable in the For clause, the variable stays in the computer’s internal memory when the loop ends.
 

 18. 

You can declare the counter variable in a Dim statement, as long as the Dim statement appears somewhere after the For…Next statement.
 

 19. 

The My.Computer object provides access to other objects, such as your computer’s Audio object.
 

 20. 

To have the Audio object play an audio file, you use its Sound method.
 

 21. 

If the audio file is not in the project’s bin\Debug folder, you will need to include the path to the file in the fileName argument.
 

 22. 

With the negation operator, a positive number preceded by the negation operator remains a positive number.
 

 23. 

The mathematical formula for calculating a periodic payment on a loan is rather complex, so Visual Basic provides a method that performs the calculation for you.
 

 24. 

In the Financial.Pmt method, if Rate is a monthly interest rate, then NPer must specify the number of monthly payments.
 

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 25. 

The ____ loop condition is evaluated before the instructions within the loop are processed.
a.
posttest
c.
before
b.
pretest
d.
after
 

 26. 

The ____ loop condition is evaluated after the instructions within the loop are processed.
a.
posttest
c.
before
b.
pretest
d.
after
 

 27. 

The instructions in a posttest loop ____.
a.
may never be processed
c.
always will be processed at least twice
b.
should only be processed once
d.
always will be processed at least once
 

 28. 

In the ____ loop, the condition appears in the first line.
a.
sequential
c.
posttest
b.
pretest
d.
iterative
 

 29. 

In the ____ loop, the condition appears in the last line.
a.
sequential
c.
posttest
b.
pretest
d.
iterative
 

 30. 

____ loops should be used only when their instructions must be processed at least once.
a.
Posttest
c.
DoAfter
b.
Pretest
d.
ProcessAfter
 

 31. 

In the pretest syntax for a Do…Loop statement, the {While | Until} condition section is part of the ____ clause.
a.
Execute
c.
Do
b.
Process
d.
Loop
 

 32. 

In the posttest syntax for a Do…Loop, the {While | Until} condition section is part of the ____ clause.
a.
Execute
c.
Do
b.
Process
d.
Loop
 

 33. 

You are given the following statement and conditions:
Do Until intCounter > intNumTimes, where intCounter=1, there is an increment of one inside the loop body, and intNumTimes = 5.
The loop condition would be tested exactly _____ times.
a.
five
c.
seven
b.
six
d.
eight
 

 34. 

One problem with posttest loops is that they always execute at least once. You can fix the problem in the Posttest Loop button’s code by placing the posttest loop in a(n) ____ structure.
a.
selection
c.
iterative
b.
execute
d.
another posttest loop
 

 35. 

You use the ____ operator to connect or link strings together.
a.
addition
c.
join
b.
concatenation
d.
multiplication
 

 36. 

The concatenation operator is the ____.
a.
forward slash (/)
c.
asterisk (*)
b.
plus sign (+)
d.
ampersand (&)
 

 37. 

The ____ constant represents the Enter key on your keyboard.
a.
EnterKey
c.
ControlChars.NewLine
b.
NewLine.ControlChars
d.
Control.NewLine
 

 38. 

A loop whose instructions you want processed a precise number of times is often referred to as a ____ loop.
a.
conditional
c.
counter
b.
precision
d.
sequential
 

 39. 

A counter loop uses a counter ____ to keep track of the number of times the loop instructions are processed.
a.
variable
c.
condition
b.
constant
d.
control
 

 40. 

You code a posttest counter loop using the ____ statement.
a.
Execute…Until
c.
For…Next
b.
Do...Loop
d.
Do…Counter
 

 41. 

The counter variable must be a(n) ____ variable.
a.
iterative
c.
alphanumeric
b.
alpha
d.
numeric
 

 42. 

You can use the ____ portion of the For clause to declare the counter variable.
a.
As dataType
c.
Dim As dataType
b.
dataType
d.
Dim dataType
 

 43. 

When you declare a variable in the For clause, the variable has ____ scope and can be used only within the For...Next loop.
a.
program
c.
solution
b.
block
d.
method
 

 44. 

When a variable is declared in a(n) ____ statement at the beginning of a procedure, it has procedure scope and can be used by the entire procedure.
a.
Dim
c.
As
b.
New
d.
Create
 

 45. 

Fewer unintentional errors occur in applications when the variables are declared using the ____ scope needed.
a.
broadest
c.
minimum
b.
most open
d.
maximum
 

 46. 

The ____ object refers to your computer.
a.
This.Computer
c.
Computer
b.
My.ComputerObject
d.
My.Computer
 

 47. 

To have an application play an audio file while it is running, you use the syntax ____.
a.
My.Computer.Play(fileName)
c.
My.Computer.Audio.Play(fileName)
b.
Play(filename)
d.
fileName.Play
 

 48. 

Visual Basic’s ____ feature is a feature that exposes a set of commonly used objects to the programmer.
a.
Obj
c.
MyObj
b.
My
d.
ComObj
 

 49. 

The ____ operator reverses the sign of a number.
a.
sign change
c.
sign
b.
change
d.
negation
 

 50. 

The ____ method contains a complex mathematical formula for calculating a periodic payment.
a.
Fincl.Pmt
c.
Fin.Pmt
b.
Financial.Pmt
d.
Fin.Payment
 



 
         Start Over