Which of the following is the correct syntax of accessing the first 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 first element of a pair p?”

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

Leave a Comment