Thursday, November 20, 2025

Java Arrays Quiz - Class 10 ICSE

  1. What is the correct way to declare an array of integers in Java?

    array arr[];
    int arr[];
    int arr;
    int arr{};
  2. Which index does a Java array start from?

    1
    0
    -1
    Any random number
  3. What will happen if you try to access an array element beyond its size?

    ArrayIndexOutOfBoundsException
    NullPointerException
    Compilation Error
    Program runs normally
  4. Which of the following is the correct way to initialize an array at the time of declaration?

    int arr[5] = {1, 2, 3, 4, 5};
    int arr[] = {1, 2, 3, 4, 5};
    int arr{} = {1, 2, 3, 4, 5};
    int arr = {1, 2, 3, 4, 5};
  5. What is the length of the array `int[] arr = new int[10];`?

    9
    10
    Depends on elements
    0

No comments:

Post a Comment