Exam 6: Arrays and Arraylists
Exam 1: Introduction to Computers and Java44 Questions
Exam 2: Introduction to Java Applications34 Questions
Exam 3: Control Statements39 Questions
Exam 4: Control Statements27 Questions
Exam 5: Methods36 Questions
Exam 6: Arrays and Arraylists48 Questions
Exam 7: Introduction to Classes and Objects27 Questions
Exam 8: Classes and Objects: a Deeper Look27 Questions
Exam 9: Object Oriented Programming: Inheritance22 Questions
Exam 10: Object-Oriented Programming: Polymorphism30 Questions
Exam 11: Exception Handling27 Questions
Exam 12: Gui Components78 Questions
Exam 13: Graphics and Java 2D19 Questions
Exam 14: Fundamentals of Characters and Strings26 Questions
Exam 15: Files, Streams and Object Serialization26 Questions
Exam 16: Generic Collections41 Questions
Exam 17: Lambdas60 Questions
Exam 18: Recursion15 Questions
Exam 19: Searching, Sorting and Big O21 Questions
Exam 20: Generic Classes and Methods15 Questions
Exam 21: Custom Generic Data Structures17 Questions
Exam 22: GUI26 Questions
Exam 23: Concurrency54 Questions
Exam 24: Accessing Databases With JDBC35 Questions
Exam 25: JavaFX26 Questions
Select questions type
Assume array items contains the integer values 0, 2, 4, 6 and 8. Which of the following uses the enhanced for loop to display each value in array items?
Free
(Multiple Choice)
4.9/5
(32)
Correct Answer:
C
Consider array items, which contains the values 0, 2, 4, 6 and 8. If method changeArray is called with the method call changeArray(items, items[2]), what values are stored in items after the method has finished executing?
Public static void changeArray(int[] passedArray, int value)
{
PassedArray[value] = 12;
Value = 5;
}
Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
D
Which method call converts the value in variable stringVariable to an integer?
Free
(Multiple Choice)
4.9/5
(32)
Correct Answer:
C
Which of the following statements about creating arrays and initializing their elements is false?
(Multiple Choice)
4.9/5
(33)
Which statement below initializes array items to contain 3 rows and 2 columns?
(Multiple Choice)
4.8/5
(33)
Consider the class below:
Public class Test
{
Public static void main(String[] args)
{
Int[] a = {99, 22, 11, 3, 11, 55, 44, 88, 2, -3};
Int result = 0;
For (int i = 0; i <
A.length; i++) {
If (a[i] > 30)
Result += a[i];
}
System.out.printf("Result is: %d%n", result);
}
}
The output of this Java program will be:
(Multiple Choice)
4.9/5
(36)
Which command below runs TestProgram, and passes in the values files.txt and 3?
(Multiple Choice)
4.9/5
(35)
The preferred way to traverse a two-dimensional array is to use .
(Multiple Choice)
4.9/5
(36)
Class Arrays methods sort, binarySearch, equals and fill are overloaded for primitive-type arrays and Object arrays. In addition, methods __________ and __________ are overloaded with generic versions.
(Multiple Choice)
4.8/5
(31)
Reference-type variables (called references) store ________ in memory.
(Multiple Choice)
4.9/5
(37)
Which of the following initializer lists would correctly set the elements of array n?
(Multiple Choice)
4.8/5
(36)
Types in Java are divided into two categories. The primitive types are boolean, byte, char, short, int, long, float and double. All other types are ________ types.
(Multiple Choice)
4.8/5
(35)
A(n) ________ indicates a problem that occurs while a program executes.
(Multiple Choice)
4.8/5
(46)
Consider the code segment below. Which of the following statements is false?
Int[] g;
G = new int[23];
(Multiple Choice)
5.0/5
(41)
For the array that was the correct answer in the previous question, what is the value returned by items[1][0]?
(Multiple Choice)
4.7/5
(40)
Which set of statements totals the items in each row of two-dimensional array items, and displays each row's total?
(Multiple Choice)
4.8/5
(32)
When you pass an array or an individual array element of a reference type to a method, the called method receives ________. When you pass an individual element of a primitive type, the called method receives ________.
(Multiple Choice)
4.9/5
(36)
Showing 1 - 20 of 48
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)