A

Admin • 670.22K Points
Coach

Q. What is the output of this code?

Code:
let array = [1, 2, 3, 4]
print(array[2])
  • (A) 2
  • (B) 3
  • (C) 4
  • (D) 1
  • Correct Answer - Option(B)
  • Views: 1
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin
Array indexing starts at 0, so `array[2]` is the third element, which is 3.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.