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, 22.06.2019 15:00
Hyperactive media sales has 10 windows 7 laptop computers used by sales-people in the organization. each laptop computer has several customized applications that are used during the sales process as well as customer relationship management software. all of the applications on the laptops are difficult to configure and have large data files. if all of the laptops have current hardware, what is the easiest way to install windows 10 on them?
Answers: 1
question
Computers and Technology, 23.06.2019 10:50
Your friend kayla is starting her own business and asks you whether she should set it up as a p2p network or as a client-server network. list three questions you might ask to kayla decide which network to use and how her answers to those questions would affect your recommendation.
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
How are stop motion special effects in animated films created
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
3. what is the output of the following statements? temporary object1; temporary object2("rectangle", 8.5, 5); temporary object3("circle", 6, 0); temporary object4("cylinder", 6, 3.5); cout < < fixed < < showpoint < < setprecision(2); object1.print(); object2.print(); object3.print(); object4.print(); object1.set("sphere", 4.5, 0); object1.print();
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
Mathematics, 07.10.2019 12:20
question
Social Studies, 07.10.2019 12:20