Is Exam Chp 6 & 7

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By G
G
G
Community Contributor
Quizzes Created: 1 | Total Attempts: 186
| Attempts: 186 | Questions: 59
Please wait...
Question 1 / 59
0 %
0/100
Score 0/100
1.  What would be the result of attempting to compile and run the following code? public class Test {   public static void main(String[] args) {     double[] x = new double[]{1, 2, 3};     System.out.println("Value is " + x[1]);   } } 

Explanation

The program compiles and runs fine because the syntax new double[]{1, 2, 3} is correct for creating a new array of doubles with the specified values. The output "Value is 2.0" is printed because the statement x[1] retrieves the value at index 1 of the array, which is 2.0.

Submit
Please wait...
About This Quiz
Computer Science Quizzes & Trivia

This quiz covers basic concepts of arrays in programming, focusing on array indexing, length, and element identification in Java.

2.  In the following code, what is the output for list2? public class Test {   public static void main(String[] args) {     int[] list1 = {1, 2, 3};     int[] list2 = {1, 2, 3};     list2 = list1;     list1[0] = 0; list1[1] = 1; list2[2] = 2;     for (int i = 0; i < list2.length; i++)       System.out.print(list2[i] + " ");   } }

Explanation

The output for list2 is "012" because in the code, list2 is assigned to list1 using the statement "list2 = list1". This means that list2 and list1 now refer to the same array object. Then, the values of list1[0], list1[1], and list2[2] are modified to 0, 1, and 2 respectively. Since list2 and list1 are referencing the same array, these modifications also affect list2. Therefore, when the for loop is executed, it prints the elements of list2 which are 0, 1, and 2.

Submit
3. Analyze the following code: public class Test {    public static void main(String[] args) {     int[] x = {1, 2, 3, 4};     int[] y = x;     x = new int[2];     for (int i = 0; i < x.length; i++)       System.out.print(x[i] + " ");   } }  

Explanation

The given code will result in a compile error on the statement x = new int[2]. This is because the variable x is declared as final, which means it cannot be reassigned to a new array. Therefore, trying to assign a new int array to x will cause a compilation error.

Submit
4. Analyze the following code. int[] list = new int[5]; list = new int[6];  

Explanation

The correct answer is that the code can compile and run fine. The second line assigns a new array to list. This is because the variable "list" is declared as an array of integers and initially assigned a new array of size 5. However, in the second line, a new array of size 6 is assigned to the variable "list". This is allowed in Java, and the code will compile and run without any errors.

Submit
5.     Suppose int i = 5, which of the following can be used as an index for array double[] t = new double[100]?

Explanation

The index for an array should be an integer value. In this case, option I, (int)(Math.random() * 100), generates a random integer between 0 and 99, which can be used as an index for the array double[] t. Similarly, option i + 10 adds 10 to the value of i (which is 5), resulting in 15, which is also a valid index for the array. However, option Math.random() * 100 generates a random decimal number between 0 and 100, which is not a valid index for an array.

Submit
6. What would be the result of attempting to compile and run the following code? public class Test {   public static void main(String[] args) {     double[] x = new double[]{1, 2, 3};     System.out.println("Value is " + x[1]);   } } 

Explanation

The given code declares and initializes an array of doubles, x, with the values 1, 2, and 3. It then prints out the value at index 1 of the array, which is 2.0. Since there are no syntax errors or other issues with the code, it will compile and run successfully, resulting in the output "Value is 2.0".

Submit
7.  Assume int[] t = {1, 2, 3, 4}. What is t.length? 

Explanation

The correct answer is 4 because the length property of an array in Java returns the number of elements in the array, and in this case, the array "t" has 4 elements (1, 2, 3, and 4).

Submit
8. What is the output of the following code? double[] myList = {1, 5, 5, 5, 5, 1}; double max = myList[0]; int indexOfMax = 0; for (int i = 1; i < myList.length; i++) {   if (myList[i] > max) {     max = myList[i];     indexOfMax = i;   } } System.out.println(indexOfMax);  

Explanation

The code initializes an array called "myList" with the values 1, 5, 5, 5, 5, and 1. It then sets the variable "max" to the first element of the array (1) and "indexOfMax" to 0.

The for loop iterates through the elements of the array starting from the second element. If an element is greater than the current maximum value (max), it updates the max value and the index of the max value (indexOfMax).

In this case, the max value is 5, which is at index 1 in the array. Therefore, the output of the code is 1.

Submit
9.  Analyze the following code: public class Test {    public static void main(String[] args) {     int[] x = new int[5];     int i;     for (i = 0; i < x.length; i++)       x[i] = i;     System.out.println(x[i]);   } }

Explanation

The program has a runtime error because the last statement in the main method causes ArrayIndexOutOfBoundsException. This is because the variable "i" is incremented in the for loop until it reaches the length of the array "x". However, after the loop ends, the value of "i" is equal to "x.length", which is out of the bounds of the array. Therefore, when the program tries to access the element at index "i" in the array "x", it throws an ArrayIndexOutOfBoundsException.

Submit
10. What is the output of the following code? public class Test {   public static void main(String[] args) {     int[][][] data = {{{1, 2}, {3, 4}},       {{5, 6}, {7, 8}}};     System.out.print(ttt(data[0]));   }   public static int ttt(int[][] m) {     int v = m[0][0];          for (int i = 0; i < m.length; i++)       for (int j = 0; j < m[i].length; j++)         if (v < m[i][j])           v = m[i][j];         return v;   } }

Explanation

The code initializes a 3-dimensional array "data" with values. The main method calls the "ttt" method and passes the first element of "data" as an argument. The "ttt" method iterates through the elements of the passed array and finds the maximum value. In this case, the maximum value is 4. Therefore, the output of the code is 4.

Submit
11. What is the output of the following code?      int[] myList = {1, 2, 3, 4, 5, 6};      for (int i = myList.length - 2; i >= 0; i--) {        myList[i + 1] = myList[i];      }      for (int e: myList)        System.out.print(e + " ");

Explanation

The code starts by initializing an array called myList with values 1, 2, 3, 4, 5, and 6.

Then, it enters a for loop that iterates from the second-to-last element of the array (index length - 2) to the first element (index 0).

Inside the loop, it shifts each element one position to the right by assigning the value of the current element to the next element.

After the loop, another for loop is used to print each element of the modified myList array.

Therefore, the output is 1 1 2 3 4 5, which represents the modified array after shifting the elements.

Submit
12. What is the index variable for the element at the first row and first column in array a?

Explanation

The index variable for the element at the first row and first column in array a is a[0][0]. In programming, arrays are usually zero-indexed, which means that the first element is accessed using the index 0. Therefore, the element at the first row and first column in array a can be accessed using the index a[0][0].

Submit
13. What is the output of the following program? public class Test {   public static void main(String[] args) {     int[][] values = {{3, 4, 5, 1}, {33, 6, 1, 2}};     int v = values[0][0];     for (int row = 0; row < values.length; row++)       for (int column = 0; column < values[row].length; column++)         if (v < values[row][column])           v = values[row][column];     System.out.print(v);   } }  

Explanation

The program creates a 2D array called "values" with two rows and four columns. It then initializes the variable "v" with the value at the top left corner of the array (3).

The program then iterates through each element in the array using nested for loops. It compares each element with the current value of "v" and if the element is greater, it updates the value of "v" to that element.

After iterating through all the elements, the program prints the final value of "v", which is the largest element in the array. In this case, the largest element is 33, so the output of the program is 33.

Submit
14.
Suppose int[] list = {4, 5, 6, 2, 1, 0}, what is list.length?   

Explanation

The correct answer is 6. The length property of an array in Java returns the number of elements in the array. In this case, the array "list" has 6 elements, so the length is 6.

Submit
15.     What is the representation of the third element in an array called a?  

Explanation

The correct answer is a[2]. In programming, arrays are zero-indexed, which means that the first element is at index 0, the second element is at index 1, and so on. Therefore, the third element in the array called 'a' would be at index 2.

Submit
16.    If you declare an array double[] list = {3.4, 2.0, 3.5, 5.5}, list[1] is ________.  

Explanation

In the given array declaration, double[] list = {3.4, 2.0, 3.5, 5.5}, the index starts from 0. Therefore, list[1] refers to the element at the second position in the array, which is 2.0.

Submit
17. What is output of the following code: public class Test {    public static void main(String[] args) {     int list[] = {1, 2, 3, 4, 5, 6};     for (int i = 1; i < list.length; i++)       list[i] = list[i - 1];          for (int i = 0; i < list.length; i++)       System.out.print(list[i] + " ");   } }

Explanation

The output of the code is "1 1 1 1 1 1". This is because the code is using a for loop to iterate through the elements of the "list" array, starting from index 1. In each iteration, it assigns the value of the previous element (i - 1) to the current element (i). Since the loop starts from index 1, the first element (index 0) remains unchanged. Therefore, all the elements in the array end up having the value of the first element, which is 1.

Submit
18. What is the output of the following code? (look for the column) public class Test {   public static void main(String[] args) {     int[][] matrix =       {{1, 2, 3, 4},        {4, 5, 6, 7},        {8, 9, 10, 11},        {12, 13, 14, 15}};     for (int i = 0; i < 4; i++)       System.out.print(matrix[i][1] + " ");   } }

Explanation

The code creates a 2-dimensional array called "matrix" with 4 rows and 4 columns. In the for loop, it prints the value at index 1 of each row, followed by a space. Since the index starts from 0, the values printed are matrix[0][1], matrix[1][1], matrix[2][1], and matrix[3][1]. These values are 2, 5, 9, and 13 respectively. So the output of the code is "2 5 9 13".

Submit
19.     When you return an array from a method, the method returns __________.  

Explanation

When you return an array from a method, the method returns the reference of the array. This means that the method is returning the memory address where the array is stored, rather than creating a new copy of the array. This allows other parts of the program to access and manipulate the same array.

Submit
20.  Suppose a method p has the following heading: public static int[] p() What return statement may be used in p()?

Explanation

The correct answer is "return new int[]{1, 2, 3};" because the method p() is declared to return an int array. The syntax "new int[]{1, 2, 3}" creates a new int array and initializes it with the values 1, 2, and 3. Therefore, this return statement is valid and will return an int array containing the values 1, 2, and 3.

Submit
21. The reverse method is defined in the textbook. What is list1 after executing the following statements? int[] list1 = {1, 2, 3, 4, 5, 6}; list1 = reverse(list1);

Explanation

The given code snippet initializes an array called "list1" with the values 1, 2, 3, 4, 5, and 6. It then calls the "reverse" method on "list1" and assigns the returned value back to "list1". The "reverse" method likely reverses the order of the elements in the array. Therefore, after executing these statements, "list1" will contain the values in reverse order, which are 6, 5, 4, 3, 2, and 1.

Submit
22. Assume double[][][] x = new double[4][5][6], what are x.length, x[2].length, and x[0][0].length?

Explanation

In the given code, double[][][] x = new double[4][5][6], the statement x.length returns the length of the first dimension of the array, which is 4. The statement x[2].length returns the length of the second dimension of the array at index 2, which is 5. Lastly, the statement x[0][0].length returns the length of the third dimension of the array at index 0 and index 0, which is 6.

Submit
23. Suppose a method p has the following heading: public static int[][] p() What return statement may be used in p()?

Explanation

The correct answer is "return new int[][]{{1, 2, 3}, {2, 4, 5}};". This is because the method p() has a return type of int[][], which means it should return a 2-dimensional array of integers. The given return statement creates a new 2-dimensional array and initializes it with the values {{1, 2, 3}, {2, 4, 5}}. This matches the return type of the method, making it the correct answer.

Submit
24.     Which of the following statements are correct?  

Explanation

not-available-via-ai

Submit
25.     Which of the following is incorrect?  

Explanation

not-available-via-ai

Submit
26. Use the selectionSort method presented in this section to answer this question. What is list1 after executing the following statements? double[] list1 = {3.1, 3.1, 2.5, 6.4}; selectionSort(list1);

Explanation

The selectionSort method arranges the elements of the array in ascending order. In this case, the array list1 contains the elements 3.1, 3.1, 2.5, and 6.4. After executing the selectionSort method, the smallest element is moved to the first position, resulting in the array becoming 2.5, 3.1, 3.1, and 6.4. Therefore, the correct answer is "list1 is 2.5 3.1, 3.1, 6.4".

Submit
27. Assume int[] scores = {1, 20, 30, 40, 50}, what value does java.util.Arrays.binarySearch(scores, 30) return?  

Explanation

The correct answer is 2 because the binarySearch() method in the Arrays class searches for the specified element (30) in the given array (scores). It returns the index of the element if it is found in the array, otherwise it returns a negative value. In this case, since 30 is present in the array at index 2, the method returns 2.

Submit
28.  Assume int[] scores = {1, 20, 30, 40, 50}, what is the output of System.out.println(java.util.Arrays.toString(scores))?  

Explanation

The output of System.out.println(java.util.Arrays.toString(scores)) will be [1, 20, 30, 40, 50]. This is because the Arrays.toString() method converts the array elements into a string representation, and the output is enclosed in square brackets with each element separated by a comma and a space.

Submit
29. How can you get the word "abc" in the main method from the following call? java Test "+" 3 "abc" 2

Explanation

In the given code, the main method is called with three arguments: "3", "abc", and "2". The arguments are stored in the args array. The answer "args[2]" indicates that the word "abc" can be obtained from the main method by accessing the element at index 2 of the args array.

Submit
30.     For the binarySearch method in Section 7.10.2, what is low and high after the first iteration of the while loop when invoking binarySearch(new int[]{1, 4, 6, 8, 10, 15, 20}, 11)?

Explanation

not-available-via-ai

Submit
31.     How many elements are in array double[] list = new double[5]?  

Explanation

The correct answer is 5 because the given statement "double[] list = new double[5]" creates an array called "list" with a size of 5. This means that the array can hold 5 elements.

Submit
32.     What is the correct term for numbers[99]?  

Explanation

An indexed variable refers to a variable that is accessed or referenced using an index or position within an array or collection. In this case, the term "numbers[99]" indicates that the variable "numbers" is being accessed or referenced at the index or position 99. Therefore, the correct term for "numbers[99]" is an indexed variable.

Submit
33. When you create an array using the following statement, the element values are automatically initialized to 0. int[][] matrix = new int[5][5];

Explanation

When you create a two-dimensional array using the statement "int[][] matrix = new int[5][5];", the element values are automatically initialized to 0. This means that all the elements in the array will have a value of 0 by default.

Submit
34.     How many elements are array matrix (int[][] matrix = new int[5][5])?  

Explanation

The given array matrix is declared as int[5][5], which means it is a 2-dimensional array with 5 rows and 5 columns. To find the total number of elements in the array, we multiply the number of rows (5) by the number of columns (5), which gives us 25. Therefore, the correct answer is 25.

Submit
35.     Assume int[][] x = {{1, 2}, {3, 4}, {5, 6}}, what are x.length are x[0].length?  

Explanation

The given code initializes a 2D array x with 3 rows and 2 columns. The length of an array is the number of elements it contains. Therefore, x.length will give the number of rows in the array, which is 3. Similarly, x[0].length will give the number of columns in the array, which is 2.

Submit
36. Assume int[][] x = {{1, 2}, {3, 4, 5}, {5, 6, 5, 9}}, what are x[0].length, x[1].length, and x[2].length?

Explanation

The variable x is a 2-dimensional array with 3 rows. The length of x[0] is 2 because it represents the length of the first row which contains 2 elements. The length of x[1] is 3 because it represents the length of the second row which contains 3 elements. The length of x[2] is 4 because it represents the length of the third row which contains 4 elements.

Submit
37. When you create an array using the following statement, the element values are automatically initialized to 0. int[][] matrix = new int[5][5];

Explanation

When an array is created using the statement "int[][] matrix = new int[5][5];", the element values are automatically initialized to 0. This means that all the elements in the array will have the value 0 by default.

Submit
38. Suppose int[] list = {4, 5, 6, 2, 1, 0}, what is list[0]?

Explanation

The given code declares an integer array named "list" and initializes it with the values 4, 5, 6, 2, 1, and 0. The question asks for the value at index 0 of the array, which is the first element. In this case, the first element is 4.

Submit
39.     If you declare an array double[] list = {3.4, 2.0, 3.5, 5.5}, the highest index in array list is __________.  

Explanation

The highest index in the array list is 3. This is because in Java, arrays are zero-indexed, meaning that the first element in the array has an index of 0. Since the array has four elements, the highest index would be 3.

Submit
40. Which one do you like?

Explanation

The correct answers are "char[] charArray = {'a', 'b'};" and "char[] charArray = new char[]{'a', 'b'};". Both of these options initialize a character array with the values 'a' and 'b'. The first option uses the shorthand syntax to directly assign the values to the array. The second option explicitly creates a new character array and assigns the values to it. The other options either have syntax errors or do not correctly initialize the array with the given values.

Submit
41. Select the ones you like

Explanation

The correct answer is int[] i = {3, 4, 3, 2}; because it initializes an integer array "i" with the values 3, 4, 3, and 2.

The correct answer is double d[] = new double[30]; because it declares and initializes a double array "d" with a size of 30.

Submit
42. What is the output of the following code? public class Test {   public static void main(String[] args) {     int[][][] data = {{{1, 2}, {3, 4}},       {{5, 6}, {7, 8}}};     System.out.print(data[1][0][0]);   } }

Explanation

The code initializes a 3-dimensional array called "data" with values. The expression "data[1][0][0]" accesses the element at index 1 in the first dimension, index 0 in the second dimension, and index 0 in the third dimension. This corresponds to the value 5, which is then printed to the console.

Submit
43. Analyze the following code: public class Test {   public static void main(String[] args) {     double[] x = {2.5, 3, 4};     for (double value: x)       System.out.print(value + " ");   } }

Explanation

The given code declares an array of doubles named x and initializes it with the values 2.5, 3, and 4. It then uses a for-each loop to iterate over each element in the array and print it out. The System.out.print statement is used to print each value, followed by a space. Therefore, the program will display the values 2.5, 3.0, and 4.0, with each value separated by a space.

Submit
44. What is output of the following code: public class Test {    public static void main(String[] args) {     int[] x = {120, 200, 016};     for (int i = 0; i < x.length; i++)       System.out.print(x[i] + " ");   } }

Explanation

The code initializes an integer array named x with three values: 120, 200, and 016. The for loop iterates over the array and prints each value followed by a space. The output of the code is "120 200 14" because the value 016 is interpreted as an octal number and its decimal equivalent is 14.

Submit
45. What is the output of the following program? public class Test {   public static void main(String[] args) {     int[][] values = {{3, 4, 5, 1}, {33, 6, 1, 2}};     int v = values[0][0];     for (int[] list : values)       for (int element : list)         if (v > element)           v = element;     System.out.print(v);   } }

Explanation

The program initializes a 2D array called "values" with two rows and four columns. It then sets the variable "v" to the value at the first row and first column of the array (which is 3).

The program then iterates over each element in the array using nested for-each loops. It compares each element to the value of "v" and if the element is smaller, it updates the value of "v" to that element.

In this case, the smallest element in the array is 1, so the program will update the value of "v" to 1.

Finally, the program prints the value of "v", which is 1.

Submit
46. Analyze the following code: public class Test {   public static void main(String[] args) {     int[] a = new int[4];     a[1] = 1;     a = new int[2];     System.out.println("a[1] is " + a[1]);   } }  

Explanation

The program displays a[1] is 0 because when a new int array of size 2 is assigned to 'a', the previous array of size 4 is no longer accessible. Therefore, when the statement 'System.out.println("a[1] is " + a[1])' is executed, it accesses the new array which has not been initialized, resulting in a default value of 0 being displayed.

Submit
47. What is the output of the following code? (find row[r][]) public class Test5 {   public static void main(String[] args) {     int[][] matrix =       {{1, 2, 3, 4},        {4, 5, 6, 7},        {8, 9, 10, 11},        {12, 13, 14, 15}};     for (int i = 0; i < 4; i++)       System.out.print(matrix[1][i] + " ");   } }  

Explanation

The code initializes a 2D array called matrix with values. It then uses a for loop to iterate through the elements in the second row of the matrix (row index 1) and prints them out with a space in between. The output of the code is the elements in the second row of the matrix: 4 5 6 7.

Submit
48. Which of the following declarations are correct?

Explanation

The correct declarations are "public static void print(double... numbers)" and "public static void print(int n, double... numbers)". These declarations are correct because they use the varargs syntax, which allows the methods to accept a variable number of arguments of the specified type. The first declaration accepts any number of double values, while the second declaration accepts an int value followed by any number of double values.

Submit
49.     Which of the following statements are correct to invoke the printMax method in Listing 7.5 in the textbook?

Explanation

The correct answer is option 4, which includes all three statements: printMax(1, 2, 2, 1, 4), printMax(new double[]{1, 2, 3}), and printMax(1.0, 2.0, 2.0, 1.0, 4.0). These statements correctly invoke the printMax method in Listing 7.5 from the textbook.

Submit
50. For the binarySearch method in Section 7.10.2, what is low and high after the first iteration of the while loop when invoking binarySearch(new int[]{1, 4, 6, 8, 10, 15, 20}, 11)?

Explanation

not-available-via-ai

Submit
51. Use the selectionSort method presented in this section to answer this question. Assume list is {3.1, 3.1, 2.5, 6.4, 2.1}, what is the content of list after the first iteration of the outer loop in the method?

Explanation

After the first iteration of the outer loop in the selectionSort method, the smallest element in the list is moved to the beginning. In this case, the smallest element is 2.1. Therefore, the content of the list after the first iteration would be 2.1, 3.1, 2.5, 6.4, 3.1.

Submit
52. The __________ method sorts the array scores of the double[] type.  

Explanation

The correct answer is java.util.Arrays.sort(scores). This method is used to sort the array "scores" of the double[] type. The sort() method is a part of the Arrays class in the java.util package and it arranges the elements of the array in ascending order.

Submit
53. Ssume int[] scores = {1, 20, 30, 40, 50}, what value does java.util.Arrays.binarySearch(scores, 3) return?  

Explanation

The value returned by java.util.Arrays.binarySearch(scores, 3) is -2. This method searches for the specified element (in this case, 3) in the array (scores) using the binary search algorithm. Since 3 is not present in the array, the method returns the index of the next smaller element (-2) as a negative value.

Submit
54. Which code fragment would correctly identify the number of arguments passed via the command line to a Java application, excluding the name of the class that is being invoked?  

Explanation

The correct answer is "int count = args.length;" because the "args.length" returns the number of elements in the "args" array, which represents the number of arguments passed via the command line. By subtracting 1 from the length, it excludes the name of the class that is being invoked.

Submit
55. Which correctly creates an array of five empty Strings?  

Explanation

The correct answer is `String[] a = {"", "", "", "", ""};` because it creates an array of five empty strings by initializing each element with an empty string.

Submit
56.  Identify the problems in the following code. public class Test {   public static void main(String argv[]) {     System.out.println("argv.length is " + argv.length);   } } 

Explanation

The correct answer is that if you run this program without passing any arguments, the program would display argv.length is 0. This is because when no arguments are passed, the length of the argv array would be 0, indicating that no arguments were provided.

Submit
57. Public class Test {   public static void main(String[] args) {     int[] x = new int[3];     System.out.println("x[0] is " + x[0]);   } }  

Explanation

The program runs fine and displays x[0] is 0 because when an array of integers is created without specifying the values, the default value for each element is 0. In this case, the array "x" is initialized with a size of 3, and since no values are assigned to the elements, they all default to 0. Therefore, when printing the value of x[0], it will display 0.

Submit
58. What is the index variable for the element at the first row and first column in array a?  

Explanation

The index variable for the element at the first row and first column in array a is a[0][0]. This is because in a two-dimensional array, the first index represents the row number and the second index represents the column number. In this case, a[0][0] represents the element in the first row (row 0) and first column (column 0) of array a.

Submit
59. Analyze the following code: public class Test {   public static void main(String[] args) {     boolean[][] x = new boolean[3][];     x[0] = new boolean[1]; x[1] = new boolean[2];     x[2] = new boolean[3];       System.out.println("x[2][2] is " + x[2][2]);   } }

Explanation

The program runs and displays x[2][2] is false because the code initializes a 2D boolean array, x, with different sizes for each row. The first row has a size of 1, the second row has a size of 2, and the third row has a size of 3. When accessing x[2][2], it is accessing the third row (index 2) and the third element (index 2) of that row. Since the array is initialized with boolean values, and boolean default values are false, x[2][2] will be false.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 20, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • May 07, 2018
    Quiz Created by
    G
Cancel
  • All
    All (59)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
 What would be the result of attempting to compile and run the...
 In the following code, what is the output for list2? ...
Analyze the following code: ...
Analyze the following code. ...
    Suppose int i = 5, which of the following can be...
What would be the result of attempting to compile and run the...
 Assume int[] t = {1, 2, 3, 4}. What is t.length? 
What is the output of the following code? ...
 Analyze the following code: ...
What is the output of the following code? ...
What is the output of the following code? ...
What is the index variable for the element at the first row and first...
What is the output of the following program? ...
Suppose int[] list = {4, 5, 6, 2, 1, 0}, what is list.length?  ...
    What is the representation of the third element in...
   If you declare an array double[] list = {3.4, 2.0, 3.5,...
What is output of the following code: ...
What is the output of the following code? (look for the column) ...
    When you return an array from a method, the method...
 Suppose a method p has the following heading: ...
The reverse method is defined in the textbook. What is list1 after...
Assume double[][][] x = new double[4][5][6], what are x.length,...
Suppose a method p has the following heading: ...
    Which of the following statements are correct? ...
    Which of the following is incorrect?  
Use the selectionSort method presented in this section to answer this...
Assume int[] scores = {1, 20, 30, 40, 50}, what value does...
 Assume int[] scores = {1, 20, 30, 40, 50}, what is the output of...
How can you get the word "abc" in the main method from the...
    For the binarySearch method in Section 7.10.2, what...
    How many elements are in array double[] list = new...
    What is the correct term for numbers[99]?  
When you create an array using the following statement, the element...
    How many elements are array matrix (int[][] matrix...
    Assume int[][] x = {{1, 2}, {3, 4}, {5, 6}}, what...
Assume int[][] x = {{1, 2}, {3, 4, 5}, {5, 6, 5, 9}}, what are...
When you create an array using the following statement, the element...
Suppose int[] list = {4, 5, 6, 2, 1, 0}, what is list[0]?
    If you declare an array double[] list = {3.4, 2.0,...
Which one do you like?
Select the ones you like
What is the output of the following code? ...
Analyze the following code: ...
What is output of the following code: ...
What is the output of the following program? ...
Analyze the following code: ...
What is the output of the following code? (find row[r][]) ...
Which of the following declarations are correct?
    Which of the following statements are correct to...
For the binarySearch method in Section 7.10.2, what is low and high...
Use the selectionSort method presented in this section to answer this...
The __________ method sorts the array scores of the double[] type. ...
Ssume int[] scores = {1, 20, 30, 40, 50}, what value does...
Which code fragment would correctly identify the number of arguments...
Which correctly creates an array of five empty Strings?  
 Identify the problems in the following code. ...
Public class Test { ...
What is the index variable for the element at the first row and first...
Analyze the following code: ...
Alert!

Advertisement