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
Maru [420]
3 years ago
8

The following method is intended to remove all values from the ArrayList a that have the same value as val; however, this method

does not work correctly.public void removeValue(ArrayList a, int val) {int i;for (i = 0; i < a.size(); i++) {if (a.get(i) == val) {a.remove(i);}}}If the a contains 2 3 4 3 3 4 4 5 4 3 2 1 and val is equal to 4, then a should contain 2 3 3 3 5 3 2 1 after removeValue is invoked. What does a actually contain after removeValue is invoked? (2 points)1) 2 3 3 4 4 5 4 3 2 12) 2 3 3 3 4 5 3 2 13) 2 4 3 4 5 4 2 14) 2 3 3 3 5 3 2 15) 2 4 3 4 4 5 3 2 1
Computers and Technology
1 answer:
Alona [7]3 years ago
6 0

Answer:

ArrayList a contains [2, 3, 3, 3, 4, 5, 3, 2, 1]

Explanation:

Given

The removeValue method

Required

The content of ArrayList a, after the method is called

From the question, we understand that arraylist a is:

a= [2, 3, 4, 3, 3, 4, 4, 5, 4, 3, 2, 1]

val =4

The function fails when the value to be removed appear consecutively in the list.

4 appears in index 5 and 6 of the list. Only one of the 4's will be removed

So, the updated list will be: [2, 3, 3, 3, 4, 5, 3, 2, 1]

You might be interested in
Why do you think Jacinda believed what people told her about her own beauty? Even if you understand that what you see on social
liubo4ka [24]

Answer:

Well it's human behavior to be accepted amonst your own kind and the need to gain reputation as the body rewards you with stimuli for more of the "Like Button", this is a psycological nightmare knowing you are chained to your phone as you are afraid on missing out as your community or generation goes by as theres a whole lot of story behind jacinda, the image brought to me is enough to frame my own story about her.

8 0
3 years ago
HELP WITH COMPURER SCIENCE 50!!!!!!!!!!!!!!!!!!!!!!!!!!!! POINTS PLEASE I HAVE A TEST RIGHT NOW
storchak [24]

Answer:

what is learning about

Explanation:

6 0
3 years ago
What type of attack involves using every possible combination of letters, numbers, and characters to create candidate digests th
MatroZZZ [7]
The answer is Brute Force.  The <span>attack that involves using every possible combination of letters, numbers, and characters to create candidate digests that are then matched against those in a stolen digest file is Brute Force. 
</span>It is also known as brute force<span> cracking.  It is a trial and error method used to decode passwords or Data Encryption Standard (DES) keys, through comprehensive effort (</span><span>brute force).</span>
4 0
3 years ago
This isn't a question
LiRa [457]

Where is the question?

5 0
3 years ago
Which era marked a switch from agricultural practices to industrial practices?
sashaice [31]

The Industrial Revolution is the era that is marked a switch from agricultural practices to industrial practices.

<h3>What was the Inductrial revolution?</h3>

The Industrial revolution is the transition period between 1820 to 1840. The era was the development of new industries and manufacturing of products and goods in Great Britain.

Thus, the Industrial Revolution is the era that is marked a switch from agricultural practices to industrial practices.

Learn more about Inductrial revolution

brainly.com/question/1617908

#SPJ1

7 0
2 years ago
Other questions:
  • The ______________ steps through the source code, converting each source code instruction into appropriate machine language foll
    7·1 answer
  • Which of the following best describes why Earth’s atmosphere can support life on Earth?
    14·1 answer
  • Is using abbreviations and symbols in social media a problem? Why or why not?
    11·1 answer
  • You are using the grep command, but it is only searching through files in your immediate home directory. What option enables you
    7·1 answer
  • Is it important for a writer to include voice and point of view in writing because... Plz help
    15·1 answer
  • Write a function stats that takes an array and the number of elements in the array. Then, it computes and prints the minimum val
    8·1 answer
  • Knowledge management software helps companies preserve the knowledge gained through the use of information so that future users
    15·2 answers
  • How can you make a search phrase more effective?
    8·1 answer
  • To add a picture file to a PowerPoint slide, a usor should first go to the
    11·1 answer
  • What is property in educational technology
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!