Title | Module 5 Chapter 7 Arrays- Examen and Quiz |
---|---|
Course | Java Programming |
Institution | Miami Dade College |
Pages | 13 |
File Size | 162.4 KB |
File Type | |
Total Downloads | 40 |
Total Views | 139 |
Module 5 Chapter 7 Arrays- Examen and Quiz...
Question 1
5 out of 5 points
A sorting algorithm is a technique for scanning through an array and rearranging its contents in some specific order. Selected Answer:
Tru e
Question 2
5 out of 5 points
To determine if two arrays are equal you must compare each of the elements of the two arrays. Selected Answer:
Tru e
Question 3
5 out of 5 points
Objects in an array are accessed with subscripts, just like any other data type in an array. Selected Answer:
Tru e
Question 4
5 out of 5 points
Any items typed on the command-line, separated by space, after the name of the class, are considered to be one or more arguments that are to be passed into the main method. Selected Answer:
Tru e
Question 5
5 out of 5 points
The String[] args parameter in the main method header allows the program to receive arguments from the operating system command-line. Selected Answer:
Tru e
Question 6
5 out of 5 points
When an array of objects is declared but not initialized, the array values are set to 0. Selected Answer:
Fals e
Question 7
5 out of 5 points
An ArrayList object automatically expands in size to accommodate the items stored in it. Selected Answer:
Tru e
Question 8 5 out of 5 points
A sorting algorithm is used to locate a specific item in a larger collection of data. Selected Answer:
Fals e
Question 9
5 out of 5 points
Java does not limit the number of dimensions an array may have. Selected Answer:
Tru e
Question 10
5 out of 5 points
The Java compiler will display an error message when it processes a statement that uses an invalid subscript. Selected Answer:
Fals e
Question 11
5 out of 5 points
For the following code, what would be the value of str[2]? String[] str = {“abc”, “def”, “ghi”, “jkl”}; Selected Answer: mal Correcta es :
“ghi”
A reference to the String
"ghi" Question 12
5 out of 5 points
Given the following two-dimensional array declaration, which statement is true? int[][] numbers = new int[6][9]; Selected Answer:
The numbers array has 6 rows and 9 columns. Question 13
5 out of 5 points
The binary search algorithm Selected Answer:
will cut the portion of the array being searched in half each time it fails to locate the search value. Question 14
5 out of 5 points
In order to do a binary search on an array Selected Answer:
the array must first be sorted. Question 15
5 out of 5 points
The ________ method removes an item from an ArrayList at a specific index. Selected Answer:
remove
Question 16
5 out of 5 points
A search algorithm Selected Answer:
is used to locate a specific item in a collection of data. Question 17
5 out of 5 points
To return an array of long values from a method, which return type should be used for the method? Selected Answer:
long[]
Question 18
5 out of 5 points
What would be the result of executing the following code? int[] x = {0, 1, 2, 3, 4, 5}; Selected Answer:
An array of 6 values, ranging from 0 through 5 and referenced by the variable x will be created. Question 19
5 out of 5 points
A partially filled array is normally used Selected Answer:
with an accompanying integer value that holds the number of items stored in the array. Question 20
5 out of 5 points
What is the value of scores[2][3] in the following array?
Selected Answer:
94
Question 1 5 out of 5 points
To return an array of long values from a method, which return type
should be used for the method? Selected Answer:
long[]
Question 2
5 out of 5 points
Java provides a mechanism known as a ________ which makes it possible to write a method that takes a variable number of arguments. Selected Answer:
variable-length argument list Question 3
5 out of 5 points
Selected Answer:
It specifies that only String objects may be stored in the ArrayList object. Question 4
5 out of 5 points
If numbers is a two-dimensional array, which of the following would give the number of columns in row r? Selected Answer:
numbers[r].length
Question 5
5 out of 5 points
A search algorithm Selected Answer:
is used to locate a specific item in a collection of data. Question 6
5 out of 5 points
When an array is passed to a method Selected Answer:
All of these are true. Question 7
5 out of 5 points
Given the following two-dimensional array declaration, which statement is true? int[][] numbers = new int[6][9]; Selected Answer:
The numbers array has 6 rows and 9 columns. Question 8
0 out of 5 points
Which method is used to determine the number of items stored in an ArrayList object? Selected Answer:
items
CREO K ES SIZE
Question 9
5 out of 5 points
What would be the result after the following code is executed? Int [ ] numbers = {40, 3, 5, 7, 12, 10}; int value = numbers[0]; for (int I = 1; I < numbers.length; i++) { if (numbers[i] < value) value = numbers [i];}
Selected Answer:
The value variable will contain the lowest value in the numbers array. Question 10
5 out of 5 points
Which of the following statements is(are) true about this code? final int ARRAY_SIZE = 10; long[] array1 = new long[ARRAY_SIZE]; Selected Answer:
All of these are true. Question 11
5 out of 5 points
Objects in an array are accessed with subscripts, just like any other data type in an array. Selected Answer:
Tru e
Question 12
5 out of 5 points
Any items typed on the command-line, separated by space, after the name of the class, are considered to be one or more arguments that are to be passed into the main method. Selected Answer:
Tru e
Question 13 5 out of 5 points
When an array of objects is declared but not initialized, the array values are set to 0. Selected Answer:
Fals e
Question 14
5 out of 5 points
The String[] args parameter in the main method header allows the program to receive arguments from the operating system command-line. Selected Answer:
Tru e
Question 15
5 out of 5 points
Java does not limit the number of dimensions an array may have. Selected Answer:
Tru e
Question 16
5 out of 5 points
A sorting algorithm is used to locate a specific item in a larger collection of data. Selected Answer:
Fals e
Question 17
5 out of 5 points
A sorting algorithm is a technique for scanning through an array and rearranging its contents in some specific order. Selected Answer:
Tru e
Question 18
5 out of 5 points
The Java compiler will display an error message when it processes a statement that uses an invalid subscript. Selected Answer:
Fals e
Question 19
5 out of 5 points
An ArrayList object automatically expands in size to accommodate the items stored in it. Selected Answer:
Tru e
Question 20 5 out of 5 points
To determine if two arrays are equal you must compare each of the elements of the two arrays. Selected Answer:
Tru
e
Question 1 5 out of 5 points
Java does not limit the number of dimensions an array may have. Selected Answer:
Tru e
Question 2 5 out of 5 points
An ArrayList object automatically expands in size to accommodate the items stored in it. Selected Answer:
Tru e
Question 3 5 out of 5 points
A sorting algorithm is a technique for scanning through an array and rearranging its contents in some specific order. Selected Answer:
Tru e
Question 4 5 out of 5 points
The String[] args parameter in the main method header allows the program to receive arguments from the operating system command-line. Selected Answer:
Tru e
Question 5 5 out of 5 points
The Java compiler will display an error message when it processes a statement that uses an invalid subscript. Selected Answer:
Fals e
Question 6 5 out of 5 points
A sorting algorithm is used to locate a specific item in a larger collection of data. Selected Answer:
Fals e
Question 7 5 out of 5 points
When an array of objects is declared but not initialized, the array values are set to 0. Selected
Fals
Answer:
e
Question 8 5 out of 5 points
Any items typed on the command-line, separated by space, after the name of the class, are considered to be one or more arguments that are to be passed into the main method. Selected Answer:
Tru e
Question 9 5 out of 5 points
Objects in an array are accessed with subscripts, just like any other data type in an array. Selected Answer:
Tru e
Question 10 5 out of 5 points
To determine if two arrays are equal you must compare each of the elements of the two arrays. Selected Answer:
Tru e
Question 11 5 out of 5 points
What would be the result after the following code is executed? Int [ ] numbers = {50, 10, 15, 20, 25, 100, 30}; int value = 0; for (int I = 1; I < numbers.length; i++); value += numbers [i];
Selected Answer:
The value variable will contain the sum of all the values in the numbers array.
Question 12 5 out of 5 points
Which of the following is a correct method header for receiving a two-dimensional array as an argument? Selected Answer:
public static void passMyArray(int[][] myArray)
Question 13 5 out of 5 points
A(n) ________ is used as an index to pinpoint a specific element within an array.
Selected Answer:
subscri pt
Question 14 5 out of 5 points
The ________ method removes an item from an ArrayList at a specific index. Selected Answer:
remove
Question 15 5 out of 5 points
If numbers is a two-dimensional array, which of the following would give the number of columns in row r? Selected Answer:
numbers[r].length
Question 16 5 out of 5 points
A ragged array is Selected Answer:
a two-dimensional array where the rows have different numbers of columns.
Question 17 5 out of 5 points
Which of the following is a valid declaration for a ragged array with five rows but no columns? Selected Answer:
int[][] ragged = new int[5][];
Question 18 5 out of 5 points
A partially filled array is normally used Selected Answer:
with an accompanying integer value that holds the number of items stored in the array.
Question 19 5 out of 5 points
What would be the result after the following code is executed?
Selected Answer:
The value variable will contain the lowest value in the numbers array.
Question 20 5 out of 5 points
Java provides a mechanism known as a ________ which makes it possible to write a method that takes a variable number of arguments. Selected Answer:
variablelength argumen t list
EXAMEN Question 1 5 out of 5 points
Java provides a mechanism known as a ________ which makes it possible to write a method that takes a variable number of arguments. Selected Answer:
variable-length argument list
Question 2 5 out of 5 points
Which of the following import statements is required in order to use the ArrayList class? Selected Answer:
import java.util.ArrayList;
Question 3 5 out of 5 points
What would be the result after the following code is executed?
Selected Answer:
The value variable will contain the sum of all the values in the numbers array.
Question 4 5 out of 5 points
Objects in an array are accessed with subscripts, just like any other data type in an array.
Selected Answer:
Tru e
Question 5 5 out of 5 points
A partially filled array is normally used Selected Answer:
with an accompanying integer value that holds the number of items stored in the array.
Question 6 5 out of 5 points
Which of the following methods returns a string representing all of the items stored in an ArrayList object? Selected Answer:
toString
Question 7 5 out of 5 points
What will be the result after the following code is executed?
Selected Answer:
The code contains a syntax error and will not compile.
Question 8 5 out of 5 points
Which of the following statements is(are) true about this code? final int ARRAY_SIZE = 10; long[] array1 = new long[ARRAY_SIZE]; Selected Answer:
All of these are true.
Question 9 5 out of 5 points
Given the following two-dimensional array declaration, which statement is true? int[][] numbers = new int[6][9]; Selected Answer:
The numbers array has 6 rows and 9 columns.
Question 10 5 out of 5 points
What would be the result of executing the following code? int[] x = {0, 1, 2, 3, 4, 5}; Selected Answer:
An array of 6 values, ranging from 0 through 5 and referenced by the variable x will be created.
Question 11 5 out of 5 points
The Java compiler will display an error message when it processes a statement that uses an invalid subscript. Selected Answer:
Fals e
Question 12 5 out of 5 points
To return an array of long values from a method, which return type should be used for the method? Selected Answer:
long[]
Question 13 5 out of 5 points
An array of String objects Selected Answer:
consists of an array of references to String objects.
Question 14 5 out of 5 points
Which method is used to determine the number of items stored in an ArrayList object? Selected Answer:
size
Question 15 5 out of 5 points
To determine if two arrays are equal you must compare each of the elements of the two arrays. Selected Answer:
Tru e
Question 16 5 out of 5 points
A sorting algorithm is a technique for scanning
through an array and rearranging its contents in some specific order. Selected Answer:
Tru e
Question 17 5 out of 5 points
A ragged array is Selected Answer:
a two-dimensional array where the rows have different numbers of columns.
Question 18 5 out of 5 points
The ________ method removes an item from an ArrayList at a specific index. Selected Answer:
remove
Question 19 5 out of 5 points
A(n) ________ is used as an index to pinpoint a specific element within an array. Selected Answer:
subscri pt
Question 20 5 out of 5 points
In order to do a binary search on an array Selected Answer:
the array must first be sorted....