Array in Java - Quiz

  • Aobjects
  • Bobject references
  • Cprimitive data type
  • DNone of the above
  • AThe program has a compile error because the size of the array wasn't specified when declaring the array.
  • BThe program has a runtime error because the array elements are not initialized.
  • C The program runs fine and displays x[0] is 0.
  • DThe program has a runtime error because the array element x[0] is not defined.
  • AThe code has compile errors because the variable arr cannot be changed once it is assigned.
  • BThe code has runtime errors because the variable arr cannot be changed once it is assigned.
  • CThe code can compile and run fine. The second line assigns a new array to arr.
  • DThe code has compile errors because we cannot assign a different size array to arr.
  • AA copy of the array.
  • BA copy of the first element.
  • CThe reference of the array.
  • DThe length of the array.
  • Aint [] myList = {};
  • Bint [] myList = (5, 8, 2);
  • Cint myList [] [] = {4,9,7,0};
  • Dint myList [] = {4, 3, 7};
  • AArrays can store only objects and not primitive types.
  • BArrays have a fixed size.
  • CArrays can be multidimensional.
  • D Elements of an array are accessed using an index.