1.

Which of the following(s) can be used to access the first element of a vector v?(a) v.begin()(b) v.cbegin()(c) v[0](d) all of the mentionedI got this question in a job interview.Query is from seq_con Vector Class in portion Class Hierarchies, Library & Containers of C++

Answer»

Correct option is (d) all of the mentioned

The best explanation: To ACCESS the first element of a VECTOR we can USE the following THINGS:

i) v.begin()

ii) v.cbegin()

iii) v[0]

iv) v.at(0)



Discussion

No Comment Found

Related InterviewSolutions