Question: Question 3 1 pts Consider the following instance variable and method private ArrayList wordList; public String mystery) 1 String s = ; for (int i

 Question 3 1 pts Consider the following instance variable and method

private ArrayList wordList; public String mystery) 1 String s = ""; for

(int i = wordlist.size() - 1; i >= 0; i--) { s

Question 3 1 pts Consider the following instance variable and method private ArrayList wordList; public String mystery) 1 String s = ""; for (int i = wordlist.size() - 1; i >= 0; i--) { s += wordList.get(i).substring(0,1); 3 return si 3 If wordList is initialized containing the values ivory", "summer", "watch","slam", "wolf" in that order, what String is returned by a call to the method mystery? O woslwasuiv wswsi O fmhry iswsw O yrovi Question 4 1 pts What is printed when the following code, using the edhesive.shapes.Rectangle class is executed? ArrayList shapeList = new ArrayList(); shapelist.add(new Rectangle(3, 7)); shapelist.add(new Rectangle(6, 2)); shapeList.add(new Rectangle(8, 3)); shapeList.add(new Rectangle(2, 8)); for (Rectangle r shapelist) { if (r.getArea() > 20) 1 System.out.print(r.getPerimeter() + " "); 3 3 0 22.0 20.0 0 20.0 22.0 0 21.0 24.0 0 20.0 16.0 22.0 20.0 0 21.0 12.0 24.0 16.0 1 pts Consider the following method: public static void mystery(ArrayList listi, ArrayList list2) { for (int i = 0; i list2.get(i)) { System.out.print(list1.get(i)); 3 else { System.out.print(list2.get(i)); } System.out.print(" "); ] } The following code appears in the main method of the same class. What is printed when this code is executed? ArrayList nums1 = new ArrayList(); nums1.add(7); nums1.add(4); nums1.add(5); nums1.add(12); ArrayList nums 2 = new ArrayList(); nums 2.add(5); nums 2.add(6); nums 2.add(2); nums 2.add(11); mystery (nums1, nums2); O 75 126 Nothing is printed, an IndexOutOfBoundsException is thrown. O 7512 O 76512 74512

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!