Evaluate Code Segments that Iterate Over One-dimensional Array
Need Help? Check out these resources!
Evaluating Expressions
|
Grab a Piece of Paper! |
Evaluate each expression. Verify your answer by running the code in the Java Playground. |
Practice 1: Step Tracker
- Trace the provide code segment and predict the output.
- Verify your prediction is correct by running the code in the Java Playground.
- Modify the code segment to compute the average number of steps. Run the code to test.
- Modify the code to count the number of days at least 8000 steps were recorded. Run the code to test.
Practice 2: Gift List
- Trace the provide code segment and predict the output.
- Verify your prediction is correct by running the code in the Java Playground.
Practice 3: Light Bulb Lifespans
- Trace the provide code segment and predict the output.
- Verify your prediction is correct by running the code in the Java Playground.
- Modify the code to determine the minimum lifespan in the list. Run your code to test.
Practice 4: Library Book IDs
- Trace the provide code segment and predict the output.
- Verify your prediction is correct by running the code in the Java Playground.
- Modify the code so that the index where the book is found is printed instead of the id. Run your code to test.
Practice 5: Test Scores
- Trace the provide code segment and predict the output.
- Verify your prediction is correct by running the code in the Java Playground.
- Modify the code so that no score will exceed 100 after they are increased.