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
A developer working on a time management application wants to make total hours for each timecard available to application users.
Llana [10]

Answer:

The correct option to the following question is A.) .

Explanation:

A Timecard is an application which is used for recording the times the user is working and it is an application for record the time upon logging in to the Web Timesheet, a user punches out and into the mark time they stop and start the works, along with the any comment they choose to enter.

3 0
3 years ago
A company with a large number of hosts creates three subdomains under a main domain. For easier management of the host records,
REY [17]

Answer:

4

Explanation:

For easier management of the host records of the company 4 zones should be used because

subdomain is part of a larger domain and the main domain which is the primary domain is the name which the company have decide to use which will represent the company website address and in a situation where the company

have different domain names in which they had registered, they will need to choose one among the domain which will inturn be their main domain.

Therefore for easier , efficient and effective management of the host records 4 zones will be the best zones to be used.

Example of sub domain is north.example.com

4 0
3 years ago
ven int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 5
monitta

Answer:

Following are statement is given below

int  k=1,total=0; // variable declaration

while(k<50) // iterating the while loop

{

   total=total+k*k;//  calculating the square

   k=k+1; // increments the value of k by 1    

}

Explanation:

Following are the description of Statement.

  • Declared a variable "total" and "k" of the "integer " type initialized the total to 0 and "k" to 1.
  • Iterating the while loop for less then 50 .In this loop, we calculating the sum of square of first 50 number in the "total" variable .
  • After that increment the value of "k" variable by 1 to execute the loop less then 50 .

3 0
3 years ago
Photographs that are too dark or too light can be difficult to fix with photo-editing software.
Nana76 [90]
The answer is true :)
6 0
2 years ago
Read 2 more answers
Write a computer program to tell if the number is even or odd please
vovikov84 [41]
There you go :) Written in C# you can add using tags yourself I believe

3 0
3 years ago
Other questions:
  • A(n) ____________________ stores copies of data or programs that are located on the hard drive and that might be needed soon in
    9·1 answer
  • Why did latex replace wax?
    7·1 answer
  • Swiping and pinching are graphical user interface (gui) _____________.
    7·2 answers
  • which of the following types of software is for organizing analyzing and storing data in a table A spreadsheet software B databa
    11·1 answer
  • Identify three best -selling tablet on the market, and decide on the one that you would like to buy? justify your respone
    9·1 answer
  • Which of the following is not part of the four ways you can avoid problems with email communication?
    12·1 answer
  • Why might a business choose a server-based network over a peer-to-peer network?
    15·1 answer
  • HELP AASAP BRAINLIEST JUST HELP
    13·1 answer
  • WILL GIVE BRAINLIEST ANSWER!!!<br><br> How do you manage your screen time?
    8·2 answers
  • We can improve our knowledge and skills on animals and fish raising with the use of internet​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!