Name:     ID: 
 
Email: 

C# Quiz 3

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

 1. 

Arrays are useful when you need to store just one value in memory at a time.
 

 2. 

When you instantiate an array, you can choose its location in memory.
 

 3. 

When loop structures are nested, the inner loop must be entirely contained within the outer loop; loops can never overlap.
 

 4. 

In C#, an array's elements are numbered beginning with 1.
 

 5. 

In C#, arrays are objects.
 

 6. 

A Boolean expression is evaluated within every while loop to determine whether the loop body will execute.
 

 7. 

Statements in a for loop body cannot be blocked.
 

 8. 

You cannot use a while loop for indefinite loops.
 

 9. 

The power of arrays becomes apparent when you use subscripts that are variables rather than constant values.
 

 10. 

You can improve loop performance by using prefix incrementing.
 

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

 11. 

What will be the highest subscript value possible for an array with 15 elements?
a.
14
c.
16
b.
15
d.
17
 

 12. 

A loop that is controlled by user input rather than altered by arithmetic is known as what type of loop?
a.
definite
c.
sentinel
b.
indefinite
d.
infinite
 

 13. 

When you declare an object, what are the character fields set to?
a.
‘ ‘
c.
0
b.
false
d.
null
 

 14. 

What type of loop allows you to indicate the starting value for the loop control variable, the test condition that controls loop entry, and the expression that alters the loop control variable, all in one convenient place?
a.
for
c.
repeat
b.
do
d.
while
 

 15. 

What technique can be used to combine two different loops into one?
a.
pretesting loop
c.
loop accumulation
b.
short-circuiting loop
d.
loop fusion
 

 16. 

What can you use to assign a list of nondefault values to array elements at declaration?
a.
value specification
c.
initializer list
b.
array specification
d.
array initializer
 

 17. 

You are writing a program that defines a variable within a loop, and then tries to use that variable outside the loop. However, the program does not run as intended. What is the issue?
a.
The variable is being overwritten inside the loop.
c.
The variable is limited to the scope of the loop.
b.
The variable is declared with an incorrect type.
d.
The variable name conflicts with a built in keyword.
 

 18. 

What type of loop checks a Boolean expression at the "top" of the loop before the body has a chance to execute?
a.
do
c.
switch
b.
repeat
d.
while
 

 19. 

When using nested loops, what loop is contained entirely within an outer loop?
a.
posttest loop
c.
inner loop
b.
pretest loop
d.
for loop
 

 20. 

What C# method should you use in order to arrange an array in ascending order?
a.
Reverse()
c.
Order()
b.
BinarySearch()
d.
Sort()
 

 21. 

An array subscript can be an expression, but only as long as the expression evaluates to what type?
a.
int
c.
double
b.
float
d.
boolean
 

 22. 

What is a garbage value in the C# programming language?
a.
It is an unknown, unassigned value.
c.
It is a variable that is used as a placeholder.
b.
It is a variable that is assigned a value that has no purpose.
d.
It is a variable that holds output text after it is displayed.
 

 23. 

What operator is used for the purpose of creating objects in C#?
a.
save
c.
new
b.
initialize
d.
reserve
 

 24. 


What can be used to distinguish each element from the others in an array?
a.
an element operator
c.
an element ID
b.
an object location
d.
a subscript
 

 25. 

Totals that are summed one at a time in a loop are known as what type of totals?
a.
decremented
c.
accumulated
b.
incremented
d.
derived
 



 
         Start Over