Which of the following is the correct syntax of accessing the second element of a pair p?

a) p.first
b) p.second
c) p[0]
d) p[1]

1 thought on “Which of the following is the correct syntax of accessing the second element of a pair p?”

  1. b
    Explanation: To access the second element of a pair we use second. for example, if p = (1,2) is a pair then we will use p.second to access the second element of the pair.

Leave a Comment