Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 When an ArrayList is created, the size of the list is (1 Point) -1 o 100 1 0 0 a 10 3 Which code
2 When an ArrayList is created, the size of the list is (1 Point) -1 o 100 1 0 0 a 10 3 Which code segment would access the last element of an ArrayList of booleans called values? (1 Point) values.get(values.size() - 1) 0 values.get(values.size()) values.get(0) 0 values[values.length] 0 values.get(last) 4 Which of the following would insert "Monday" into the first position of a String ArrayList called days? (Assume days already contains some elements, and no original elements should be removed.) (1 Point) days.add(0,"Monday"); days.set(0, "Monday"); days.add(1, "Monday"); O O days.set(1, "Monday"); days.add("Monday"); 5 Which for loop header would correctly traverse an ArrayList called list backwards? Ti (1 Point) for (int i = list.size(); i>=0; i--) for(int i = 0; i > list.size(); i++) for (int i = list.size(); i > 0; i --) C for(int i = list.size()-1; i >=0; i--) for (int i = list.size() - 1; i > 0; i--) 6 Tor F: An ArrayList can only be declared to store elements of a reference data type. (1 Point) True False 7 What best describes the purpose of the mystery method, seen here: 1) (1 Point) - public static int mystery(ArrayList list) { int why = 0; for (int i 0;i int = new int(); int nums = new ArrayList (); ArrayList nums = new ArrayList; ArrayList nums = new ArrayList (); 1 list.add(2); list.add(4); list.add(5); list.add(7); How would you remove the element 4 from the ArrayList called list, seen here? 15 (1 Point) O list.remove(4); list.remove(1); list.set(4, 0); remove(list.get(4)); remove(list.get(1))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started