A

Admin • 828.03K Points
Coach

Q. In Ruby, Array index -1 represent ______.

  • (A) First Element
  • (B) Last element
  • (C) Middle element
  • (D) Reverse the array
  • Correct Answer - Option(B)
  • Views: 10
  • Filed under category Ruby
  • Hashtags:

Explanation by: Admin
A negative index is assumed relative to the end of the array --- that is, an index of -1 indicates the last element of the array, -2 is the next to last element in the array, and so on.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.