The answer is A. The program prints:
plum
This answer was checked by running the program for real.
Why?
Python counts list positions from 0, so position 5 is the sixth item.
Trace table
A trace table follows the program step by step. Here’s this one:
| position | negative position | item |
|---|---|---|
| 0 | -6 | carrot |
| 1 | -5 | mango |
| 2 | -4 | grape |
| 3 | -3 | pear |
| 4 | -2 | melon |
| 5 | -1 | plum |
The code again
basket = ["carrot", "mango", "grape", "pear", "melon", "plum"]
print(basket[5])
Try it: change one number in the program and predict the new output before you run it.