5. var name = (“Thomas”, “J”, “Edison”) - if all you want is last name, which of following work?

[CORRECT ANSWER] var last = name.2

[CORRECT ANSWER] var (_, _, last) = name

var last = name.last

var last = name[2]

Hint

Results

Congratulations! Correct Answer.

You Answered: None. If you took the test, your answer will show up here.

Correct Answer: var last = name.2; var (_, _, last) = name;

Explanation

You can obtain the last element of name tuple, by using name.2 (element 0 is first name, element 1 is middle name, and element 2 is the last name). You can assign it to another tuple, but chose to ignore the first two elements. Since name is not an array, name[2] doesn’t work. Since the parameters are not named in the tuple, name.last wouldn’t work.

Take the Test

Take the complete test on this topic. You will be able to review answers to questions and get a test score.