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

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 06:30
Martha is designing a single-player game. her manager suggests that she plan the design to incorporate future modifications. which principle of game design relates to planning for future modifications?
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
What is the primary difference between the header section of a document and the body? a. the body is displayed on the webpage and the header is not. b. the header is displayed on the webpage and the body is not. c. the tag for the body is self-closing, but the tags for the headers must be closed. d. the tag for the header is self closing, but the tag for the body must be closed.
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut off on an hev are both colored orange
Answers: 1
You know the right answer?
Computer Science A Section 1 Questions 38-39 refer to the following information. Consider the follow...
Questions
question
Biology, 05.05.2020 11:45
question
Mathematics, 05.05.2020 11:45
question
Chemistry, 05.05.2020 11:45
question
World Languages, 05.05.2020 11:45
Questions on the website: 13722367