Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

practice question #1 what will be displayed after this code segment is …

Question

practice question #1
what will be displayed after this code segment is run?
gems ←
uby\, \sapphire\, \garnet\
gems ← \opal\, \emerald\
display gems2
a. \opal\ b. \sapphire\ c. \garnet\
d. \emerald\

Explanation:

Step1: Overwrite initial list

The first line assigns gems = ["ruby", "sapphire", "garnet"], but the second line overwrites this variable with a new list: gems = ["opal", "emerald"].

Step2: Access 2nd list element

Most programming/block-based languages use 1-indexing for this style of display, so gems[2] refers to the second element in the final gems list.

Answer:

D. "emerald"