Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following function. public static void int getMaxInlist(ArrayList list) { int max = 0; for(int i=0;i max) max = list.get(i); } return max; }
Consider the following function. public static void int getMaxInlist(ArrayList list) { int max = 0; for(int i=0;i max) max = list.get(i); } return max; } Unit testing focuses on objects and functions such as this one. We can use this function if we want to find the maximum value in a list, however, there are cases where this function could fail. Give one case where it could fail. Write the list that is sent to the function as parameter "list," the value the function should have returned, what this function returns, and explain how the code could be improved to make it more robust
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started