Java Quiz Day 9

Last Updated :
Discuss
Comments

Question 1

How do you declare an integer array in Java?


  • int arr[];

  • int[] arr;

  • Both a and b


  • array<int> arr;

Question 2

Which of the following creates an array of 5 integers?

  • int arr[] = new int[5];

  • int arr[5];

  • int arr() = 5;

  • int[5] arr;


Question 3

How do you access the third element of an array arr?


  • arr(3)

  • arr[3]

  • arr[2]

  • arr{3}

Question 4

How many rows and columns are in a 2D array int[][] arr = new int[3][4];?


  • 3 rows, 4 columns

  • 4 rows, 3 columns


  • 3 elements

  • 7 elements

Question 5

Which of these best defines a multidimensional array in Java?


  • int arr[][]


  • int[] arr[]


  • Both a and b

  • int arr(2)(3)

There are 5 questions to complete.

Take a part in the ongoing discussion