Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago