Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 When three values are contained within the square brackets, the last

ID: 3760546 • Letter: Q

Question

Question 1

When three values are contained within the square brackets, the last number represents the number of:

Select one:

a. classes

b. columns

c. planes

d. objects

e. rows

Question 2

Which of the following adds 95 to the array element that is currently storing 14?

int[,] x = {{12, 13},

{14, 15},

{16, 17},

{18, 19}};

Select one:

a. x[2] += 95;

b. x[1,0] +=95;

c. x[1,0 += 95];

d. x = 14 + 95;

e. none of the above

Question 3

How many components are allocated by the following statement?

double [,] values = new double [3, 2];

Select one:

a. 2

b. 3

c. 32

d. 6

e. 5

Question 4

Given the declaration

double [,] values = new double [3, 2];

how would you store 0 in the last physical location?

Select one:

a. values[6] = 0;

b. values[2,1] = 0;

c. values = 0;

d. values[3,2] = 0;

e. values[5] = 0;

Question 5

If you declare an array as

int [,] anArray = new int [5, 3];

you can double the value stored in anArray[2, 1] with the statement:

Select one:

a. anArray[2, 1] *= 2;

b. anArray = anArray * 2;

c. anArray[2, 1] = anArray[5, 1] * 2;

d. anArray[2, 1] *= anArray[2, 1] * 2;

e. anArray[2, 1] += 2;

Question 6

With the following declaration: int [,] points = {{300, 100, 200, 400, 600},

{550, 700, 900, 800, 100}};

The statement points[1, 3] = points[1, 3] + 10; will

Select one:

a. replace the 800 amount with 810

b. replace the 800 amount with 900

c. replace the 900 amount with 910

d. replace the 500 amount with 510

e. replace the 300 amount with 310 and 900 with 910

Question 7

With the following declaration: int [,] points = {{300, 100, 200, 400, 600},

{550, 700, 900, 800, 100}};

The statement points[0, 4] = points[0, 4 - 2]; will

Select one:

a. replace the 300 and 600 with 2

b. result in an error

c. replace the 600 with 200

d. replace the 600 with 198

e. replace the 400 amount with 2

Question 8

With the following declaration: int [,] points = {{300, 100, 200, 400, 600},

{550, 700, 900, 800, 100}};

The statement Console.Write(points[1,2] + points[0, 3]); will

Select one:

a. display 1300

b. display 900400

c. display 300

d. display points[1,2] + points[0,3]

e. result in an error

Question 9

When you pass an element from an ArrayList to a method, the method receives:

Select one:

a. a copy of the ArrayList

b. the address of the ArrayList

c. a copy of the value in the element of the ArrayList

d. the address of the element in the ArrayList

e. none of the above

Question 10

When you pass the entire ArrayList to a method, the method receives:

Select one:

a. a copy of the ArrayList

b. the address of the ArrayList

c. a copy of the value in the element of the ArrayList

d. the address of the element in the ArrayList

e. none of the above

Question 11

To convert all the uppercase letters in a string to their lowercase counterpart, you can use the ________method of the string class.

Select one:

a. IsLower()

b. ConvertLower()

c. Lower()

d. ToLower()

e. none of the above

Question 12

Which of the following array declarations would enable you to store the high and low temperatures for each day of one full week?

Select one:

a. int templLo, temp2Lo, temp3Lo, temp4Lo, temp5Lo, temp6Lo, temp7Lo, templHi, temp2Hi, temp3Hi, temp4Hi, temp5Hi, temp6Hi, temp7Hi;

b. int[,] temp = new int [8,3];

c. temp int [,] = new int [7,2];

d. int temp [7,2] = new int [7,2];

e. int[,] temp = new int [7,2];

Question 13

Which method in the ArrayList class can be used to place a value onto the end of the ArrayList?

Select one:

a. AddLAST()

b. AddLastIndex()

c. Add()

d. Insert()

e. none of the above

Question 14

Which method in the ArrayList class can be used to get or set the number of elements that an ArrayList can contain?

Select one:

a. Capacity()

b. Length()

c. Size()

d. Dimension()

e. Insert()

Question 15

Which class includes methods to create a dynamic one-dimensional structure?

Select one:

a. Array

b. String

c. array

d. ArrayList

e. all of the above

Question 16

A correct method call to a method that has the following heading would be:

int result(int[,] anArray, int num)

{ return 0;}

Select one:

a. Console.Write(result(anArray, 3));

b. result (anArray, 30);

c. Console.Write(result(anArray[], 3));

d. result(anArray[], 30);

e. none of the above

Question 17

With two-dimensional arrays a limitation on the foreach statement is that it can:

Select one:

a. not be used with dynamic arrays

b. only be used with arrays smaller than 1000 elements

c. only be used for read-only access

d. not be used with multidimensional arrays

e. only be used with integral type arrays

Question 18

In order to retrieve a value stored in an object of the Queue class you would use which method?

Select one:

a. Pop()

b. Push()

c. Remove()

d. Enqueue()

e. Dequeue()

Question 19

Assume a two-dimensional array called num is declared to hold four rows and seven columns. Which of the following statements correctly assigns the value 100 to the third physical column of each row?

int[,] num = new int[4,7];

Select one:

a. for(int x = 1; x < 4; ++x) num[x, 2] = 100;

b. for(int x = 0; x < 3; ++x) num[x, 2] = 100;

c. for(int x = 0; x < 5; ++x) num[x, 2] = 100;

d. for(int x = 1; x < 5; ++x) num[x, 2] = 100;

e. for(int x = 0; x < 4; ++x) num[x, 2] = 100;

Question 20

Choose the statement that does not apply to the following declaration:

double [ , ] totalCostOfltems = {{109.95, 169.95, 1.50, 89.95},

{27.9, 18.6, 26.8, 98.5}};

Select one:

a. declares a two-dimensional array of floating-point values

b. establishes the maximum number of rows as 4

c. sets the array element totalCostOfltems [0, 1] to 169.95

d. declares an area in memory where data of double type can be stored

e. all are correct

Question 21

What value is returned by the method named result?

int result(int[,] anArray)

{

int j = 0;

int i = 0;

for (int r = 0; r < anArray.GetLength(0); r++)

for (int c = 0; c < anArray.GetLength(1); c++)

if (anArray[r, c] < anArray[i, j])

{

i = r;

j = c;

}

return i;

}

Select one:

a. the index of the last element greater than its predecessor

b. the row index of the largest element of array anArray

c. the row index of the smallest element of array anArray

d. the column index of the smallest element of array anArray

e. the value of the largest element of array anArray

Question 22

What is the largest dimension an array can be declared to store values?

Select one:

a. There is no limit

b. 3

c. 5

d. 100

e. 10

Question 23

Using the following declaration:

char [ , ] n = {{'a', 'b', 'c', 'd', 'e' },

{'f', 'g', 'h', 'i', 'j' }};

What does n[1,1] refer to?

Select one:

a. a

b. f

c. b

d. g

e. none of the above

Question 24

A two-dimensional array is a list of data items that _________

Select one:

a. all have the same type

b. all have different names

c. all have same names

d. all are originally set to null ('')

e. none of the above

Question 25

Using the following declaration:

int[,] x = {{12, 13, 14, 15},

{16, 17, 18, 19}};

What does x [ 2, 4] refer to?

Select one:

a. 19

b. 18

c. ‘’

d. 0

e. none of the above

Explanation / Answer

rows

x[1,0] +=95;

6

values[2,1] = 0;

anArray[2, 1] *= 2;

replace the 800 amount with 810

replace the 600 with 200

display 1300

a copy of the value in the element of the ArrayList

the address of the ArrayList

ToLower()

int[,] temp = new int [7,2];

Add()

Capacity()

all of the above

Console.Write(result(anArray, 3));

not be used with multidimensional arrays

Dequeue()

for(int x = 1; x < 4; ++x) num[x, 2] = 100;

all are correct

the index of the last element greater than its predecessor

There is no limit

g

all have the same type

0

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote