Assume that the countIt and sumIt methods in the questions below receive a param
ID: 3832700 • Letter: A
Question
Assume that the countIt and sumIt methods in the questions below receive a parameter Node temp, which references the first Node in a linked list where Node is a class that consists of data instances int info and Node next and further assume that the int variables count and sum are initialized to 0.
Which of the following methods could be used to sum all of the items in the linked list?
Question 42 options:
1) 2) 3) 4) 5) public intsumult (Node temp) while (temp null) sum temp info: temp temp next return sumExplanation / Answer
Answer: Option 1
Option1 is the right way of coding to sum the elements in linked list.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.