Last Updated : 10 Apr, 2024

Given below are some ways to declare and initialize pair. Choose the correct alternative way to do so:

a) pair  p1;
b) pair  p2;
c) pair  p3;
d) pair  p4;

(A) a) and b)
(B) c) and d)
(C) a) and d)
(D) All of them


Answer: (D)

Explanation: Pair is used to combine together two values which may be different in type. Pair provides a way to store two heterogeneous objects as a single unit.


Share your thoughts in the comments