Consider the two-by-three rectangular integer array t.

a) Write a statement that declares t and creates the array.
b) How many rows does t have?
c) How many columns does t have?
d) How many elements does t have?
e) Write the names of all the elements in row 1 of t.
f) Write the names of all the elements in column 2 of t.
g) Write a single statement that sets the element of t in row 0 and column 1 to zero.
h) Write a sequence of statements that initializes each element of t to 1. Do not use a repetition statement.
i) Write a nested for statement that initializes each element of t to 3.

```
a) int[,] t = new int[2, 3];
b) two.
c) three.
d)six.
e) t[1, 0], t[1, 1], t[1, 2]
f) t[0, 2], t[1, 2]
g) t[0, 1] = 0;
h)
t[0, 0] = 1;
t[0, 1] = 1;
t[0, 2] = 1;
t[1, 0] = 1;
t[1, 1] = 1;
t[1, 2] = 1;
i)
for (int j = 0; j < t.GetLength(0); j++)
{
for (int k = 0; k < t.GetLength(1); k++)
{
t[j, k] = 3;
}
}
```

Computer Science & Information Technology

You might also like to view...

Bus frequency is the external rate data travels outside the microprocessor and is measured in

A) Nanoseconds B) Megaseconds C) Megahertz D) Megabytes

Computer Science & Information Technology

Which of the following represents a method for accessing the BIOS setup program?

A. boot Windows and go to Control Panel B. set a motherboard jumper and start the computer C. press a key or combination of keys during the BIOS POST D. boot to the BIOS setup floppy disk

Computer Science & Information Technology