Module 5 Quiz :Java for Android (Android App Development Specialization) Answers 2025
1. Correct syntax for boolean array of 24 elements
✔️ boolean[] arr = new boolean[24];
❌ boolean arr = new boolean[24];
❌ boolean arr[24];
❌ boolean[24] arr = new boolean[24];
❌ boolean arr[] = new boolean;
2. Last index = size − 1 = 23
✔️ 23
❌ 25
❌ 22
❌ 24
3. arr.fill(true) is NOT valid for arrays
✔️ FALSE
❌ TRUE
4. Arrays of class type need 2-phase initialization
✔️ TRUE
❌ FALSE
5. Arrays use arr.length, NOT arr.length()
✔️ FALSE
❌ TRUE
6. Arrays can be sized dynamically but CANNOT be resized
✔️ An array can be sized dynamically, but it cannot be resized without allocating a new array.
❌ An array can be sized dynamically & resized
❌ An array cannot be sized dynamically
7. Sum from index 1 to end: 23+34+45+56 = 158
✔️ 158
❌ 170
❌ 114
❌ 0
8. Collection with no duplicates
✔️ Set
❌ Queue
❌ List
❌ Map
9. Replace “charlie” with “foxtrot”
✔️ list.set(list.indexOf(“charlie”), “foxtrot”);
❌ list.add(“foxtrot”, index)
❌ list.set(“foxtrot”,”charlie”)
❌ list.set(“charlie”,”foxtrot”)
❌ list[2] = “foxtrot”
10. Remove last element (“echo”)
✔️ list.remove(list.size()-1);
❌ list.clear(“echo”)
❌ list.empty(“echo”)
❌ list.remove(list.size())
❌ list.remove(5)
11. Enhanced for-loop that prints all elements
✔️ String list name
❌ int String name
❌ String iterator next
❌ iterator hasNext next
❌ String list next
12. HashMap can map ANY type to ANY type
✔️ TRUE
❌ FALSE
13. HashMaps do NOT keep keys sorted
✔️ HashMaps keep their keys in sorted order. (Not a feature)
❌ use any object as key
❌ fast insert
❌ fast lookup
📌 Summary Table
| Q# | Final Answer |
|---|---|
| 1 | boolean[] arr = new boolean[24]; |
| 2 | 23 |
| 3 | FALSE |
| 4 | TRUE |
| 5 | FALSE |
| 6 | sized dynamically but not resized |
| 7 | 158 |
| 8 | Set |
| 9 | list.set(list.indexOf(“charlie”),”foxtrot”) |
| 10 | list.remove(list.size()-1) |
| 11 | String list name |
| 12 | TRUE |
| 13 | HashMaps keep keys sorted (not true) |