Tes
Tinjau jawaban, umpan balik, dan skor pertanyaan Anda di bawah ini. Tanda
bintang (*) menunjukkan jawaban yang benar.
Section 8 Quiz
(Jawab semua pertanyaan di bagian ini)
1. Which two cannot be stored in an ArrayList? (Choose two)
(Pilih semua jawaban yang benar)
float (*)
Integer
int (*)
String
Correct
(1/1) Point
2. You can access elements in an ArrayList by their index. True or False?
benar (*)
Palsu
Correct
(1/1) Point
3. The size of an ArrayList can grow as needed. True or False?
benar (*)
Palsu
Correct
(1/1) Point
4. Which exception is thrown when an application attempts to use null when an
object is required?
NullPointerException (*)
FileNotFoundException
ArithmeticException
ArrayIndexOutOfBoundsException
Correct
(1/1) Point
5. If the try block succeeds then no exception has occurred. True or False?
benar (*)
Palsu
Correct
(1/1) Point
Halaman 1 dari 3 Berikutnya
Tes
Tinjau jawaban, umpan balik, dan skor pertanyaan Anda di bawah ini. Tanda
bintang (*) menunjukkan jawaban yang benar.
Section 8 Quiz
(Jawab semua pertanyaan di bagian ini)
6. Each catch block is an exception handler that handles the type of exception
indicated by its argument. True or False?
benar (*)
Palsu
Correct
(1/1) Point
7. What is the output?
int[] arr = new int[5];
for(int i=0; i<arr.length; i++){
arr[i] = i;
}
for(int i=0; i<arr.length; i++) {
System.out.print(arr[i]);
}
01234 (*)
123
012345
12345
Correct
(1/1) Point
8. What is the starting index of an array?
0 (*)
You can start with anything
1
It depends on the type of the array.
Correct
(1/1) Point
9. The Java compiler does not check for an ArrayIndexOutOfBoundsException
during the compilation of a program containing arrays. True or False?
benar (*)
Palsu
Correct
(1/1) Point
10. Given:
int x[];
What is the value of x?
1
null (*)
0
Some random number.
Correct
(1/1) Point
Sebelumnya Halaman 2 dari 3 Berikutnya
Tes
Tinjau jawaban, umpan balik, dan skor pertanyaan Anda di bawah ini. Tanda
bintang (*) menunjukkan jawaban yang benar.
Section 8 Quiz
(Jawab semua pertanyaan di bagian ini)
11. You can access the size of any array by using the array’s “length”
property. True or False?
benar (*)
Palsu
Correct
(1/1) Point
12. What is an array?
An array is an indexed container that holds a set of values of a single type. (*)
An array is an indexed container that holds a set of values of a multiple types.
An array is a way to create multiple copies of a single value.
An array is a Java primitive type.
Correct
(1/1) Point
13. What are two disadvantages of adding print statements for
debugging? (Choose two)
(Pilih semua jawaban yang benar)
Too many print statements lead to information overload. (*)
Print statements cannot print the values of an object’s fields.
It’s tedious to remove print statements. (*)
Print statements cannot print the values of variables.
Correct
(1/1) Point
14. Which is not a compilation error?
x = ( 3 + 5;
y = 3 + * 5;
int y;
y++; (*)
int x=2
Incorrect. Refer to Section 8 Lesson 4.
(0/1) Point
15. Runtime errors can be caught by Java’s exception handling mechanism. True
or False?
benar (*)
Palsu
Correct
(1/1) Point
Sebelumnya Halaman 3 dari 3