subject

Computer Science A Section 1 Questions 38-39 refer to the following information. Consider the following data field and method. The method removeDups is intended to remove all adjacent duplicate numbers from myData, but does not work as intended. private ArrayList myData; public void removeDups() int k = 1; while (k < myData. size()) if (myData. get(k).equals(myData. get (k 1))) ( myData. remove(k): ) k++; ) ) For example, if myData has the values 3 3 4 4 4 8 7 7 7. after calling removeDups, myData should have the values 3 4 8 7. 39.
Which of the following best describes how to fix the error so that removeDups works as intended?
(A) k should be initialized to 0 at the beginning of the method.
(B) The while condition should be (k < myData. size() - 1).
(C) The if test should be (myData. get(k).equals(myData. get (k + 1))).
(D) The body of the if statement should be myData. remove (k - 1);
(E) There should be an else before the statement k++;

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:00, jgrable5175
Designing a mobile web page is a little different from designing a regular web page. name at least three features that should be considered when designing a website that is mobile phone-friendly, and briefly explain why they are important.
Answers: 1
image
Computers and Technology, 22.06.2019 11:40, malibu777
Design a pos circuit that displays the letters a through j on a seven-segment indicator. the circuit has four inputs w, x, y, and z which represent the last 4 bits of the uppercase ascii code for the letter to be displayed. thus, if wxyz = 0001 then "a" will be displayed. (any answer with 22 or fewer gates and inverters, not counting any for the inputs, is acceptable)
Answers: 2
image
Computers and Technology, 23.06.2019 13:30, Gearyjames8
Anetwork security application that prevents access between a private and trusted network and other untrusted networks
Answers: 1
image
Computers and Technology, 24.06.2019 06:30, chloeholt123
For which utilities, if any, does the landlord pay?
Answers: 2
You know the right answer?
Computer Science A Section 1 Questions 38-39 refer to the following information. Consider the follow...

Questions in other subjects:

Konu
Mathematics, 20.05.2020 15:57
Konu
Mathematics, 20.05.2020 15:57
Konu
English, 20.05.2020 15:57
Konu
Mathematics, 20.05.2020 15:58