Skip Top Navigation Bar

Evaluate Code Segments with One-dimensional Array Creation and Access

Evaluating Expressions

Grab a Piece of Paper!

Evaluate each expression.

Verify your answer by running the code in the Java Playground.

Practice 1: Price List

  • 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 access the price 1.99 and print it to the screen. Run the code to test.

Practice 2: Temperatures

  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.

Practice 3: Book Sales

  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.

Practice 4: Gift Giving

  • 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 add the gift "Pen" to the last element of the array. Add this line before the output statement.

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.