Depends if you know how many elements are in the array.
If you know the value of n, then you are correct. If you have to count then it will be O(n). Since most containers generally store a size counter of the number of elements inside, then your answer should be sufficient to please the person who will be marking your assignment.