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
What device connects your computer to a wireless network?
Darina [25.2K]

Answer:

a router

Explanation:

5 0
3 years ago
Read 2 more answers
A video game is begun by making selections from each of 3 menus. The first menu (number of players) has 4 selections, the second
lana [24]

Answer:

4 * 8 * 6 = 192

Explanation:

First menu = 4 selections

second menu = 8 selections

third menu = 6 selections

we need to find how many configuration can the game be played, we just here multiply all the selections and find the answer

4 * 8 * 6 = 192

3 0
3 years ago
// This pseudocode is intended to describe
tensa zangetsu [6.8K]

Applying information of a computational language in pseudocode, a code may be written to describe estimating the price of an item on sale for 10% off.

Writting the code:

<em>// This </em><em>pseudocode </em><em>is </em><em>intended </em><em>to desribe</em>

<em>// computing the price of an item on sale for 10% off</em>

<em>start</em>

<em>input origPrice</em>

<em>discount = price * 0.25</em>

<em>finalPrice = origPrice - discount</em>

<em>output finalPrice</em>

<em>stop</em>

<em />

<em>// This pseudocode is intended to </em><em>compute </em><em>the number</em>

<em>// of </em><em>miles per gallon </em><em>you get with your car.</em>

<em>start</em>

<em>input milesTraveled</em>

<em>input </em><em>gallonsOfGasUsed</em>

<em>milesPerGallon = milesTraveled / gallonsOfGasUsed</em>

<em>output milesPerGallon</em>

<em>stop</em>

<em />

<em>// This pseudocode is intended to compute the number</em>

<em>// computing the per dday </em><em>cost </em><em>of your rent</em>

<em>// in a 30-day month</em>

<em>start</em>

<em>input rent</em>

<em>costPerDay = rent / 30</em>

<em>output rent</em>

<em>stop</em>

Learn more about the pseudocode here :

brainly.com/question/13208346

#SPJ1

3 0
1 year ago
__________ is software that comes hidden in free downloadable software that tracks online movements, mines the information store
denis23 [38]

Answer:

Spyware

Explanation:

Spyware is the software which is used to track the online movements, it also track the user action on the computer they are also called sneakware  or stealthware

  • This software is used  in the business purpose which it may be used in the office to track the record of employee in the working hours .
  • Spyware  software is used to track the information without knowing the user.

 

7 0
3 years ago
Assume that x is a char variable that has been declared and already given a value. Write an expression whose value is true if an
Oksanka [162]

Answer:

The expression in python is: x.isdigit()

Explanation:

Given

Character variable x

Required

Expression that evaluates if x is decimal or not

The expression in python is: x.isdigit()

If x is digit 0 - 9, x.isdigit() will equal True

Otherwise, it will equal False

8 0
3 years ago
Other questions:
  • What are "open-loop" and "closed-loop" systems
    11·1 answer
  • A computer that no longer works after having minor repair work done to it may have been damaged by ____
    13·2 answers
  • What symbol do you use to choose a feature for your notes on Notion?
    8·1 answer
  • What is a software? 2 sentences please, I'll mark u as brailiest
    12·1 answer
  • What is the difference between a 13 column abacus and 5 column abacus?
    10·1 answer
  • Explain the four misconceptions about entrepreneurship.
    7·1 answer
  • All the network nodes are connected to each other
    8·1 answer
  • Why is it necessary to have usernames and passwords if one is working on a network?​
    12·1 answer
  • Does technology shape society or does society shape technology?
    14·1 answer
  • Network administrators use _____ technology when they need antivirus updates to be automatically downloaded on employees' workst
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!