Exam 8: Arrays
Exam 1: Creating Java Programs68 Questions
Exam 2: Using Data74 Questions
Exam 3: Using Methods, Classes, and Objects68 Questions
Exam 4: More Object Concepts67 Questions
Exam 5: Making Decisions70 Questions
Exam 6: Looping72 Questions
Exam 7: Characters, Strings, and the Stringbuilder73 Questions
Exam 8: Arrays74 Questions
Exam 9: Advanced Array Concepts74 Questions
Exam 10: Introduction to Inheritance70 Questions
Exam 11: Advanced Inheritance Concepts70 Questions
Exam 12: Exception Handling65 Questions
Exam 13: File Input and Output74 Questions
Exam 14: Introduction to Swing Components74 Questions
Exam 15: Advanced Gui Topics69 Questions
Exam 16: Graphics74 Questions
Exam 17: Applets, Images, and Sound72 Questions
Select questions type
public static int[] sampleArray()
{
int studentScores = {72, 91, 83};
____
}
Using the above code, write the statement that will return the array name.
(Short Answer)
4.9/5
(85)
Providing values for all the elements in an array is called ____ the array.
(Multiple Choice)
4.9/5
(80)
Write the statement to declare an array variable named studentScores with type double. Write a second statement to create an array of 10 objects.
(Essay)
4.9/5
(66)
What does an array's name represent and what value does it hold when declared?
(Essay)
4.8/5
(71)
When you declare int[] someNums = new int[10];, each element of someNums has a value of ____________________ because someNums is a numeric array.
(Short Answer)
4.9/5
(93)
Individual array elements are ____ by value when a copy of the value is made and used within the receiving method.
(Multiple Choice)
4.9/5
(84)
When populating an array with an initialization list, you do not need to use the new keyword or provide an array size. Explain why this is the case.
(Essay)
4.9/5
(83)
Using just one statement, declare and create an array that will reserve memory locations for 10 scores values that are type double.
(Essay)
4.8/5
(83)
String[] countyNames = {"Clark", "Delaware", "Madison"};
What will be the value of countyNames[0].length(), countyNames[1].length(), and countyNames[2].length()?
(Essay)
4.8/5
(74)
Which of the following statements correctly declares and creates an array to hold five double scores values?
(Multiple Choice)
4.7/5
(81)
A(n) ____ loop allows you to cycle through an array without specifying the starting and ending points for the loop control variable.
(Multiple Choice)
4.9/5
(86)
double[] studentScores = new double[3];
studentScores[0] = 93;
studentScores[1] = 77;
studentScores[2] = 85;
Write a println statement to display the last element of the studentScores array.
(Short Answer)
4.9/5
(87)
How would you use a method that belongs to an object that is part of the array? Use an example and demonstrate with Java code.
(Essay)
4.7/5
(80)
A(n) ____________________ is a named list of data items that all have the same type.
(Short Answer)
4.9/5
(79)
int[] sixNumbers = {1, 2, 3, 4};
The above code creates an array named sixNumbers. Describe how array sizes are determined when using an initialization list and how memory is assigned.
(Essay)
4.9/5
(84)
Match each term with the correct statement below.
-Declared in the same way you declare any simple variable
(Multiple Choice)
4.9/5
(89)
When using parallel arrays, if one array has many possible matches, it is most efficient to place the less common items first so that they are matched right away.
(True/False)
4.9/5
(74)
The following statement declares an array:
int[] increaseValues = new int[5]
final int PLUSTWO = 2;
Create a loop that will add 2 to every array element. Use a symbolic constant named PLUSTWO and use the length field in the loop that will contain the number of elements in the array.
(Essay)
4.8/5
(83)
Why is the length field a good option when writing a loop that manipulates an array? What programming error is common when attempting to use length as an array method?
(Essay)
4.8/5
(70)
Showing 21 - 40 of 74
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)