Machine-translated by Google. Questions are authored in English.
Top

Discussion

Consider the array definition

int num [10] =  {3, 3, 3};

Pick the Correct answers

  • A.num [9] is the last element of the array num
  • B.The value of num [ 8] is 3
  • C.The value of num [ 3 ] is 3 
  • D.None of the above

Answer: A

Correct answer: num [9] is the last element of the array num

The array has 10 cells, so the last is num[9]. The initialiser supplies only three values, and when an array is partly initialised the remaining elements are set to zero. So num[0], num[1] and num[2] are 3, while num[3] and num[8] are both 0 - which is why the other two statements are false.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.