DEVRY CIS170B WEEK 5 quiz- Array Declaration

Question

(TCO 11) An array is a list of data items that _____.

share the same data type

are all integers

have different faces

the different flavors

Comments:

Question 2. Question :

(TCO 11) Which statement is true about this array declaration?

int [] myArray = {1,4,3,5,6};

It declares a 5 dimensional array.

The size of the array is five.

It sets the element myArray[1] to 1.

It won’t compile due to a syntax error.

Comments:

Question 3. Question :

(TCO 11) What will be the output of this code?

int[] size = {2,3,5,6,4,5};

Array.Sort(size);

foreach (int

val in size)

Console.Write(“{0} “, val);

2 3 5 6 4 5

5 4 6 5 3 2

6 5 5 4 3 2

2 3 4 5 5 6

Comments:

Question 4. Question :

(TCO 11) When a single array element, such as myArray[2], is passed to a method, the method receives _____.

a copy of the array

the starting address of the array

the address of the element

a copy of the value in the element

Comments:

Question 5. Question :

(TCO 12) The size of a(n) _____ must be determined when the program is written, whereas elements of a(n) _____ can be added or deleted at runtime.

array, ArrayList

ArrayList, array

array, Array class

ArrayList, Array class

Comments:

Question 6. Question :

(TCO 12) In your program, myList was declared as an ArrayList. To append the number 7 to the end of myList, write _____.

myList.Add(7);

myList.Append(7);

myList.Insert(7);

myList.Set(7);

Comments:

Question 7. Question :

This is a valid statement:

decimal [] price = new decimal[5];

True False

Comments:

Question 8. Question :

In the following, we can code height[1,1] in a two-dimensional array that will have values

like this (this is partial code): height = { {2.1, 3.2, 6.5, 7.2},

{5.4, 6.7, 3.5, 3.6} };

True False

Comments:

Question 9. Question :

The following is valid code for a one-dimensional array:

int[] size = {2,3,5,6,4,5};

True False

Comments:

Question 10. Question :

ArrayList “Count” property to give the user the current number of integers with a value of ‘1’ in TempArray.

True False

Comments:

* Times are displayed in (GMT-07:00) Mountain Time (US & Canada)