ITEC 120
L07b: Array trace

Objectives

After successfully completing this lab you will be able to to trace through method calls and trace through code that uses arrays.

Assignment

Consider the method foo:

Walk through the five method calls below. On a sheet of paper, show the parameter values passed to the method and show the state of the method as you trace the code. When you are done tracing the code, write a short description of what the method foo does (in language your grandmother could understand) and describe any constraints that must be true for the method to work correctly.

int[] scores = {3, 7, 19, 20, 24, 30, 31, 38, 42, 45, 47};

    1. foo(scores, 30)
    2. foo(scores, 21)
    3. foo(scores, 49)
    4. foo(scores, 3)
    5. foo(scores, 31)

Submit Your Assignment

Submit your trace, on paper at the end of lab. Make sure your name is on the paper.