1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vlada-n [284]
3 years ago
15

Consider the following method, inCommon, which takes two Integer ArrayList parameters. The method returns true if the same integ

er value appears in both lists at least one time, and false otherwise.
public static boolean inCommon(ArrayList a, ArrayList b)
{
for (int i = 0; i < a.size(); i++)
{
for (int j = 0; j < b.size(); j++) // Line 5
{
if (a.get(i).equals(b.get(j)))
{
return true;
}
}
}
return false;
}
Which of the following best explains the impact to the inCommon method when line 5 is replaced by for (int j = b.size() - 1; j > 0; j--) ?
A. The change has no impact on the behavior of the method.
B. After the change, the method will never check the first element in list b.
C. After the change, the method will never check the last element in list b.
D. After the change, the method will never check the first and the last elements in list b.
E. The change will cause the method to throw an IndexOutOfBounds exception.
Computers and Technology
1 answer:
sp2606 [1]3 years ago
6 0

Answer:

The answer is "Option b".

Explanation:

In the given code, a static method "inCommon" is declared, that accepts two array lists in its parameter, and inside the method two for loop is used, in which a conditional statement used, that checks element of array list a is equal to the element of array list b. If the condition is true it will return the value true, and if the condition is not true, it will return a false value. In this, the second loop is not used because j>0 so will never check the element of the first element.

You might be interested in
Shawn thought that the screen of the block-based program he was using was
Alja [10]

Answer:

Interface

Explanation:

Definition- "The interface of a particular piece of computer software is its presentation on the screen and how easy it is to operate. <em>...the development of better user interfaces.</em>"

7 0
2 years ago
Many inventions have enabled us to use digital cameras. The biggest difference between traditional and digital cameras is that d
Andreyy89

1 Film Roll Vs SD card.

2 No LCD Display Vs LCD Display

3 No mega Pixels Vs Mega Pixels

4 Zero Optical zoom Vs Optical Zoom

5 No Picture Modes Vs Different Picture Modes

6 Limited Number of Pics per roll Vs unlimited number of pictures depending upon the size of a Card

7 Hassle of developing pictures Vs no hassle, simply transfer them to the pc/laptop

8 Limited features Vs multiple features

hope this helps

8 0
3 years ago
Which part of a computer is responsible for executing the software programs?
mamaluj [8]

Answer:

c. CPU

Explanation:

7 0
3 years ago
What is the generic term for a device that stores images for long periods of time?
Artemon [7]
I would say 1. Backup drive.
7 0
2 years ago
Read 2 more answers
Blank are what make up the World Wide Web.
andreyandreev [35.5K]
Web pages make this up.
3 0
2 years ago
Other questions:
  • What are the desirable qualities of a Product Vision?
    11·1 answer
  • True or false
    7·1 answer
  • Cryptolocker is an example of what type of malware?
    11·1 answer
  • A network administrator is required to upgrade wireless access to end users in a building. To provide data rates up to 1.3 Gb/s
    12·1 answer
  • Question 10 of 10
    6·1 answer
  • Assume:
    14·1 answer
  • 100 tickets are sold in a raffle with one prize. John has 8 tickets, Jamie has 10 tickets, find the probability that John wins
    11·2 answers
  • Creation of ____________will help you to study the behavior of the real system
    11·1 answer
  • Which function would you use to make sure all names are prepared for a mailing label? TODAY UPPER PROPER LOWER
    11·1 answer
  • I have a problem with my Nintendo DS lite does anyone know how to fix it?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!