As a user of the ADT List, consider the method in Between, that receives a list...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
As a user of the ADT List, consider the method in Between, that receives a list 1 and two elements el and e2 and returns the number of elements between el and e2. Assume that both el and e2 exist in the list 1, e1 appears before e2 and there are no duplicates. Complete the code below by choosing the correct answer: 1. public int inBetween (List I, Te1, Te2) { Line 3: 2. int count = 0; 3. 4. while (...) { 5. 6. } 7. 8. while (...) { 9. 10. 11. J 12. return count; 13. } 1.findFirst(); if (!1.empty()) 1. findNext(); if (!1. full()) None Activate Windows Go to Settings to activate Windo QUESTION 11 As a user of the ADT List, consider the method inBetween, that receives a list 1 and two elements el and e2 and returns the number of elements between el and e2. Assume that both el and e2 exist in the list 1, el appears before e2 and there are no duplicates. Complete the code below by choosing the correct answer: 1. public int inBetween (List I, Te1, Te2) { Line 4: 2. int count = 0; 3. ... 4. while (...) { 5. 6. } 7. 8. while (...) { 9. 10. 11. } 12. 13.) return count; O O O O O о о !1.retrieve().equals (el) && !1.retrieve().equals (e2) !1. retrieve ().equals (el) || !1.retrieve ().equals (e2) !1.retrieve().equals (el) !1. retrieve ().equals (e2) None QUESTION 5 If we execute the following code on list L with elements: 5, 3, 1, 4, 6 L.findFirst(); while (!L.last()) { L.remove(); L. findNext(); } Then the elements of L will be: 5,1,6 3,4 L will be empty O 3,4,6 QUESTION 6 As a user of an ADT List, and with a list L, the result of calling the method "remove()": Removes the current element and sets the new current to be the first element if no successor of the deleted element exists. All of the above. Removes the current element and sets the new current to the existing successor of the deleted element. Removes the current element and sets it to be NULL if the resulting list is empty. QUESTION 7 As a user of List ADT, the result of calling the method "last()" Return whether the successor of Current is on the last element or not. Return the data of the last element. None Move Current to be on the last element. QUESTION 8 What will this method do to List L? public static <T> void f (List<T> 1) { if (1.empty()) { 1.findFirst(); int cpt 1; while (!1.last()) { } 1.insert(1.retrieve () ); cpt++; 1. findNext(); 1.insert(1.retrieve () ); 1.findFirst(); for (int i = 0; i < cpt; i++) { } 1.remove(); if (!1.last()) 1. findNext(); Duplicates all elements of L. None of the above. Infinite loop. Creates duplicates of all elements of L except the last one. As a user of the ADT List, consider the method in Between, that receives a list 1 and two elements el and e2 and returns the number of elements between el and e2. Assume that both el and e2 exist in the list 1, e1 appears before e2 and there are no duplicates. Complete the code below by choosing the correct answer: 1. public int inBetween (List I, Te1, Te2) { Line 3: 2. int count = 0; 3. 4. while (...) { 5. 6. } 7. 8. while (...) { 9. 10. 11. J 12. return count; 13. } 1.findFirst(); if (!1.empty()) 1. findNext(); if (!1. full()) None Activate Windows Go to Settings to activate Windo QUESTION 11 As a user of the ADT List, consider the method inBetween, that receives a list 1 and two elements el and e2 and returns the number of elements between el and e2. Assume that both el and e2 exist in the list 1, el appears before e2 and there are no duplicates. Complete the code below by choosing the correct answer: 1. public int inBetween (List I, Te1, Te2) { Line 4: 2. int count = 0; 3. ... 4. while (...) { 5. 6. } 7. 8. while (...) { 9. 10. 11. } 12. 13.) return count; O O O O O о о !1.retrieve().equals (el) && !1.retrieve().equals (e2) !1. retrieve ().equals (el) || !1.retrieve ().equals (e2) !1.retrieve().equals (el) !1. retrieve ().equals (e2) None QUESTION 5 If we execute the following code on list L with elements: 5, 3, 1, 4, 6 L.findFirst(); while (!L.last()) { L.remove(); L. findNext(); } Then the elements of L will be: 5,1,6 3,4 L will be empty O 3,4,6 QUESTION 6 As a user of an ADT List, and with a list L, the result of calling the method "remove()": Removes the current element and sets the new current to be the first element if no successor of the deleted element exists. All of the above. Removes the current element and sets the new current to the existing successor of the deleted element. Removes the current element and sets it to be NULL if the resulting list is empty. QUESTION 7 As a user of List ADT, the result of calling the method "last()" Return whether the successor of Current is on the last element or not. Return the data of the last element. None Move Current to be on the last element. QUESTION 8 What will this method do to List L? public static <T> void f (List<T> 1) { if (1.empty()) { 1.findFirst(); int cpt 1; while (!1.last()) { } 1.insert(1.retrieve () ); cpt++; 1. findNext(); 1.insert(1.retrieve () ); 1.findFirst(); for (int i = 0; i < cpt; i++) { } 1.remove(); if (!1.last()) 1. findNext(); Duplicates all elements of L. None of the above. Infinite loop. Creates duplicates of all elements of L except the last one.
Expert Answer:
Answer rating: 100% (QA)
Line 3 should be completed with java 1 findFirst This initializes the iterator to the beginning of t... View the full answer
Related Book For
Principles of Accounting
ISBN: 978-0618736614
10th edition
Authors: Belverd Needles, Marian Powers, Susan Crosson
Posted Date:
Students also viewed these programming questions
-
A corporate entity has both preferred and common classes of shares. How is the book value of common shares calculated in this case? What is meant by the liquidation value of preferred shares?
-
Brad Jackson works for a Bob's Burgers takeout for straight-time earnings of $10.50 per hour, with time and a half for hours in excess of 35 per week. Jackson's payroll deductions include income tax...
-
Find all points at which the mapping is not conformal. Give reason.
-
Plaintiff sought to enforce against the defendant estate a promise made by his now-deceased uncle to pay Plaintiff a sum of money if Plaintiff refrained from the use of alcohol and tobacco for a...
-
The Sanding Department of Quik Furniture Company has the following production and manufacturing cost data for March 2017, the first month of operation. Production: 7,000 units fnished and transferred...
-
Defend the following statement: Data and database administration are even more important in the decentralized IS environment than in the centralized one
-
In this exercise, you create an application that allows the user to enter the gender (either F or M) and GPA for any number of students. The application should calculate the average GPA for all...
-
Suppose a subsidy allows sellers to receive their product at the price of $8 with a quantity of 400 units. What is the dollar amount of the subsidy per unit of the good?
-
Imagine a team of researchers exploring a remote region with limited access to power resources. Theyhavestrategically placed sensors across the area to detect potential hazards and threats to their...
-
ANSWER ALL QUESTIONS 1. Story - "Liked for Myself," by Maya Angelou. Before Reading: 1. It is our human nature to make preconceived notions about people we encounter. Think about a time when you...
-
Your potential new landlord is with you and going through the Management Agency Authority or Exclusive Leasing and Management Authority. She tells you that since you did your appraisal she has...
-
Which level of communication is described as communication between one and a small number of people? Discuss
-
Technology provides us with more channels for communication. Do you think that some channels allow for more competent (effective and appropriate) communication than others? Are there circumstances in...
-
Two players participate in a contest where the winner gets R and the loser gets P-R, 0 R P. The two players have identical convex cost of effort functions C(e). The chance player i wins is...
-
Halley's comet travels in an ellipti- cal orbit with a = 17.95 and b = 4.44 and passes by Earth roughly every 76 years. Note that each unit represents one astronomical unit, or 93 million miles. The...
-
Presented below are incomplete inventory and income statement data for Trevor Corporation. Determine the missing amounts. Ending Beginning Finished Finished Cost of Goods Goods Inventory Inventory $...
-
Each of the following columns represents a Supplies account: 1. Determine the amounts indicated by the question marks? 2. Make the adjusting entry for column a, assuming supplies purchased are...
-
Wooster Company purchased a special-purpose machine from Konigsberg Company on credit for 50,000. At the date of purchase, the exchange rate was $1.00 per euro. On the date of the payment, which was...
-
Consider an open economy characterized by the following equations: The parameters \(m_{1}\) and \(x_{1}\) are the propensities to import and export. Assume that the real exchange rate is fixed at a...
-
Consider an open economy in which the real exchange rate is fixed and equal to one. Consumption, investment, government spending, and taxes are given by where \(Y^{*}\) denotes foreign output. a....
-
Label each of the following statements true, false, or uncertain. Explain briefly. a. The interest rate parity condition means that interest rates are equal across countries. b. Other things being...
Study smarter with the SolutionInn App