Chapter 11: Using Arrays - Chapter 11 Quiz

Ace your homework & exams now with Quizwiz!

When you declare an array of six double elements but provide no initialization values, the value of the first element is _______________________. a. 1 b. unknown c. 0 d. 5

c. 0

When an ages array is correctly initialized using the values {20, 30, 40, 50}, then the value of ages[1] is _______________________. a. 20 b. undefined c. 30 d. 0

c. 30

If you use the BinarySearch() method, and the object you seek is not found in the array, _______________________. a. an error message is displayed b. the value false is returned c. a negative value is returned d. a zero is returned

c. a negative value is returned

Which of the following declares an integer array that contains eight rows and five columns? a. int [ , ] num = new int[5, 8]; b. int [ , ] num = new int[8, 5]; c. int [8][5] num = new int[]; d. int[8, 5] num = new int[ , ];

b. int [ , ] num = new int[8, 5];

Initializing an array is _______________________ in C#. a. difficult b. optional c. prohibited d. required

b. optional

When an ages array is correctly initialized using the values {20, 30, 40, 50}, then the value of ages[4] is _______________________. a. 0 b. undefined c. 50 d. 4

b. undefined

When you declare an array as int[] temperature = {0, 32, 50, 90, 212, 451};, the value of temperature.Length is _______________________. a. 6 b. unknown c. 7 d. 5

a. 6

Which of the following traits do the BinarySearch() and Sort() methods have in common? a. Both methods belong to the System.Array class. b. They both operate only arrays made up of numeric data. c. Both methods take a single argument that must be an array. d. The array that each method uses must start in ascending order.

a. Both methods belong to the System.Array class.

In an array, every element has the same _______________________. a. data type b. all of these c. memory location d. subscript

a. data type

The operator used to create objects is _______________________. a. new b. += c. create d. =

a. new

Which of the following correctly declares an array of four integers? a. int[] ages = {20, 30, 40, 50}; b. all of these c. int[] ages = new int[4] {20, 30, 40, 50}; d. int[] ages = new int[] {20, 30, 40, 50};

b. all of these

If you define an array to contain 10 elements, then the highest array subscript you can use is _______________________. a. 11 b. 9 c. 10 d. 8

b. 9

Assume an array is defined as int[] nums = {2, 3, 4, 5};. Which of the following would display the values in the array in reverse? a. for(int x = 3; X > 0; --x) Write(nums[x}); b. for(int x = 4; X > 0; --x) Write(nums[x}); c. for(int x = 3; X >= 0; --x) Write(nums[x}); d. for(int x = 4; X >= 0; --x) Write(nums[x});

c. for(int x = 3; X >= 0; --x) Write(nums[x});

Which of the following doubles every value in a 10-element integer array named amount? a. both of these b. foreach(int number in amount) number *= 2; c. for(int x = 9; x >= 0; --x) amount[x] *= 2; d. neither of these

c. for(int x = 9; x >= 0; --x) amount[x] *= 2;

Which of the following correctly declares an array of six integers? a. int[6] array; b. int[] array = 6; c. int[] array = new int[6]; d. int array[6];

c. int[] array = new int[6];

The BinarySearch() method is inadequate when _______________________. a. array items are not numeric b. you want to find an exact match for a value c. the array holds duplicate values and you want to find them all d. array items are in ascending order

c. the array holds duplicate values and you want to find them all

Assume an array is defined as int[] nums = {7, 15, 23, 5};. Which of the following would place the values in the array in descending numeric order? a. Array.Reverse(nums); b. Array.Reverse(nums); Array.Sort(nums); c. Array.Sort(nums); d. Array.Sort(nums); Array.Reverse(nums);

d. Array.Sort(nums);Array.Reverse(nums);

The value placed within square brackets after an array name is ______________________. a. all of these b. always a constant c. always a double d. called a subscript

d. called a subscript

Which of the following adds 10 to every value in a 16-element integer array named points? a. both of these b. foreach(int sub in points) points += 10; c. for(int sub = 0; sub > 16; ++sub) points[sub] += 10; d. neither of these

d. neither of these

Two arrays that store related information in corresponding element positions are _______________________ arrays. a. rectangular b. parallel c. jagged d. relative

parallel


Related study sets

Checkpoint 16 Exam Questions- SIE

View Set

Missouri laws and pertinent to insurance

View Set

HITT 2343 Test #3 Chapters 13-18

View Set

Health Unit 3 Quiz 3:Disease and Prevention

View Set

Chapter 6: Wireless LANs I (Test Your Knowledge)

View Set