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 security administrator has replaced the firewall and notices a number of dropped connections. After looking at the data the se
Nata [24]

Answer:

The correct answer is Option(A) i.e., An SQL injection attack is being

attempted.

Explanation:

In this given question some information is missing and is not the complete question. The missing is given as :

SELECT * FROM and ‘1’ = ‘1’

Which of the following can the security administrator determine from this?

A. The SQL injection attacked is being attempted.

B. An Legitimated connections is being dropped.

C. The network scan are being done by the system.

D. An attack of XSS is being attempted.

Now, coming to the answer "The security administration sees that an SQL injection is attempted while it notices a lot of connection dropped and has replaced with the firewall and will be the possible issue flagged on it, SQL injection is a type of injection that possibly executes harmful or malicious statements and effects any website or web application".

Hence the correct answer is Option A.

5 0
3 years ago
Which of the following is Tynker an example of?
dangina [55]

Answer:

binary code

Explanation:

correct me if i’m wrong :)

6 0
3 years ago
Read 2 more answers
Why did they removed the watch video button to view answers?​
MA_775_DIABLO [31]

Answer:

Umm I’m not sure

Explanation:

7 0
3 years ago
Which of the following is NOT a good way to reduce pollutants in paint shops?
Citrus2011 [14]

Automobile repair shops produce many types of waste -- some hazardous, some not necessarily hazardous but still potentially damaging to the environment if not handled properly, and all requiring proper treatment and/or disposal at significant cost to the business. A list of the types of waste that the shop owner or manager must contend with would include:

solvents (paints and paint thinners)

antifreeze

scrap metal

batteries and other auto parts

oils and oil filters

fuels of various types

acids and alkalis (contaminated rags and towels)

Whatever the nature and characteristics of the waste may be, it all has one thing in common: All waste represents loss of resources and loss of money.

4 0
3 years ago
The process used to obtain the information system resources needed to provide the services necessary to meet a specific set of _
Olenka [21]

System Acquisiton: The process used to get the information system resources needed to provide services that are necessary to meet a specific set of needs.

- 2 fundamental strategies for system acquisition:

1) buy off-the-shelf software

2) build a custom application.

4 0
3 years ago
Other questions:
  • Which destination ip address is used when an ipv6 host sends a dhcpv6 solicit message to locate a dhcpv6 server?
    15·1 answer
  • What is an implicit benefit to Monetary Policy?
    6·1 answer
  • Free response: Spot and Fix the Bug Respond to the following questions about your investigation into the bug with the counting g
    14·1 answer
  • Imagine a switch with three configured VLANs. How many IP subnets are required, assuming that all hosts in all VLANs want to use
    14·1 answer
  • Refer to the image of the Cornell method, then use the drop-down menus to complete each statement. Number 1 should be . Number 2
    8·2 answers
  • Write a program to have the computer guess at a number between 1 and 20. This program has you, the user choose a number between
    9·1 answer
  • Choose all items that are true about the two example of HTML shown on the right.
    5·2 answers
  • Write a program to
    5·1 answer
  • Give one of user responsibility of the internet you should follow in cyberethics.
    5·2 answers
  • Variables that can take only 2 variables are referred to as which one of the following?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!