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

11. What is the output of the following statements? Select one: a. Cal, Bob, Ann

ID: 3693037 • Letter: 1

Question

11.

What is the output of the following statements?

Select one:

a. Cal, Bob, Ann

b. Ann, Bob

c. Ann, Tony

d. Cal, Bob, Tony

12.

What is the output of the following statements?

Select one:

a. Cal, Bob, Ann

b. Ann, Bob

c. Ann, Tony

d. Cal, Bob, Tony

13.

Consider the following code snippet:

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

Select one:

a. 5

b. 6

c. 7

d. 9

14.

In a partially filled array, the number of slots in the array that are not currently used is

Select one:

a. the length of the array minus the number of elements currently in the array

b. the number of elements currently in the array minus the length of the array

c. the length of the array plus the number of elements currently in the array

d. the number of elements currently in the array

15.

Consider the following code snippet:

Which one of the following is true about the check method in the given code snippet?

Select one:

a. The check method counts all the elements with value 0 in an array list passed as a parameter to the method.

b. The check method removes all the elements with value 0 from an array list passed as a parameter to the method.

c. The check method counts all the elements with value 0 in an array list passed as a parameter to a method and also returns the count.

d. The check method adds 0 to the elements of an array list as a parameter to a method and also returns the array list.

16.

Consider the following code snippet:

What is the size of the array list somedata after the given code snippet is executed?

Select one:

a. 0

b. 1

c. 10

d. 2

17.

What is the output of the code snippet below?

Select one:

a. 5

b. 6

c. 7

d. 9

18.

Which code snippet finds the largest value in an array that is only partially full?

Select one:

a.

b.

c.

d.

19.

Consider the following code snippet:

Which value of arr is stored in the val variable?

Select one:

a. The value in the first row and the second column

b. The value in the first row and the first column

c. The value in the first row and the third column

d. The value in the third row and the second column

20.

How many elements can be stored in a two-dimensional 5 by 6 array?

Select one:

a. 5

b. 6

c. 11

d. 30

Explanation / Answer

11) c

This is how we coclude that :

names = [Bob]

names = [Ann,Bob]

name=[Ann] // remove 1

name=[Ann,Cal]

name=[Ann,Tony] (which is the answer)

12 ) c

This is how we coclude that :

names = [Bob]

names = [Ann,Bob]

name=[Ann] // remove 1

name=[Ann,Cal]

name=[Ann,Tony] (which is the answer)

13 ) b

arr2 =[[1, 2, 3, 0], [4, 5, 6, 0], [0, 0, 0, 0]]

arr2[2][1] =0 and arr2[1][2] = 6

therefor the answer is 6

14) a

the array length always return the length of the array irrespetive of the fact whehter it is full or not.

So in order to find out the left over in the array we simply have to do the array length - no. of elements present.

a. the length of the array minus the number of elements currently in the array

15) a

The check method just counts the number of zeros in the Arraylist but returns nothing.

a. The check method counts all the elements with value 0 in an array list passed as a parameter to the method.

16) b

The array list size keeps on growing as and when the elements are added. It is always equal to the number of elements present.

the answer is the size is 1. which is option b

17) b

arr = [[1, 2, 3, 0], [4, 5, 6, 0], [0, 0, 0, 0]]

arr[1][2] = 6

and arr[1][3]=0

therefore the sum is 6 so is the answer 6 which is option b

18) a and c

since array is of type double the rest of the elements would be intialized with 0.0 and would be comparable.

so both a and c can print the larget although c would be more efficient.

19) c

since the counting starts from 0 the 0 th row of array is the Row 1 in real world and column 2 is Column 3 in the real world therefore option c

c. The value in the first row and the third column

20) array can store m * n values so a 5 * 6 can store 30 values option d

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote