Prashnikaप्रश्निका
Code
About
‹ Back to the paper

Question 6

1 mark

Computer ScienceISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024)MCQArrays, Strings

Choose the correct option.

Assume int [ ] [ ] x = { {8,9} , {5,6,7},{1,2,3,4}}, what are x[0].length, x[1].length, and…

Assume int [ ] [ ] x = { {8,9} , {5,6,7},{1,2,3,4}}, what are x[0].length, x[1].length, and x[2].length?
  • (a)2, 3 and 3
  • (b)2, 3 and 4
  • (c)3, 3 and 3
  • (d)2, 2 and 2

Answer

Answer

Correct option: b

Answer: (b) 2, 3 and 4. x[0] = {8,9} has length 2, x[1] = {5,6,7} has length 3, and x[2] = {1,2,3,4} has length 4 - each row of this jagged array can have its own length.