Question: Question 14 pts Consider the following code snippet: int val = arr[0][2]; Which value of arr is stored in the val variable? the value in

Question 14 pts

Consider the following code snippet:

int val = arr[0][2];

Which value of arr is stored in the val variable?

the value in the first row and the first column
the value in the first row and the third column
the value in the third row and the second column
the value in the first row and the second column

Flag this Question

Question 24 pts

Consider the following code snippet:

int[][] arr = 
 {
 { 1, 2, 3 },
 { 4, 5, 6 }
 };
int val = arr[0][2] + arr[1][2];
System.out.println(val);

What is the output of the given code snippet on execution?

5
9
10
7

Flag this Question

Question 34 pts

Assume the following variable has been declared and given a value as shown:

int[][] data = 
 {
 {9, 17, -4, 21 },
 {15, 24, 0, 9},
 {6, 2, -56, 8},
 };

Which is the value of data[0].length?

4
21
12
3

Flag this Question

Question 44 pts

Assume the following variable has been declared and given a value as shown:

int[][] data = 
 {
 {9, 17, -4, 21 },
 {15, 24, 0, 9},
 {6, 2, -56, 8},
 };

Which is the value of data.length?

12
3
4
6

Flag this Question

Question 54 pts

Consider the following code snippet:

ArrayList arrList = new ArrayList();
for (int i = 0; i < arrList.size(); i++)
{
 arrList.add(i + 3);
}

What value is stored in the element of the array list at index 0?

None
6
0
3

Flag this Question

Question 64 pts

Which one of the following is the correct code snippet for calculating the largest value in an integer array list arrList of size 10?

int maximum = arrList.get(1);
for (int counter = 1; counter < arrList.size(); counter++)
{
 if (arrList.get(counter) > maximum)
 {
 maximum = arrList.get(counter);
 }
}
int maximum = 0;
for (int counter = 1; counter < arrList.size(); counter++)
{
 if (arrList.get(counter) > maximum)
 {
 maximum = arrList.get(counter);
 }
}
int maximum = arrList.get(0);
for (int counter = 1; counter < arrList.size(); counter++)
{
 if (arrList.get(counter) > maximum)
 {
 maximum = arrList.get(counter);
 }
}
int maximum = arrList.get(0);
for (int counter = 1; counter > arrList.size(); counter++)
{
 if (arrList.get(counter) < maximum)
 {
 maximum = arrList.get(counter);
 }
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!