Quiz di Java: Arrays

This Java arrays quiz checks the basics every beginner needs. You will predict default values, length, what printing an array shows, what happens when two variables share an array and how Arrays.toString(), Arrays.sort() and Arrays.equals() help.

Facile 10 domande ~5 minuti Superato con il 80% Java 17

Scegli una modalità

Stai giocando come ospite: accedi per salvare XP e serie.

Domanda di esempio

Domanda 1 di 10

What does this print?

public class Main {
    public static void main(String[] args) {
        int[] a = new int[3];
        System.out.println(a[1]);
    }
}
Mostra la risposta

A. 0 New arrays are filled with default values: 0 for numbers, false for boolean and null for objects. Only local variables, not array elements, must be assigned before use.

Cosa copre questo quiz

  • Declaring and initializing arrays, default values
  • length and out-of-bounds indexes
  • Array variables are references
  • Arrays.toString(), Arrays.sort(), Arrays.equals()
  • Two-dimensional arrays

Domande frequenti

Serve un account?

No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.

Posso rifarlo?

Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.