Quiz 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.

Dễ 10 câu hỏi ~5 phút Đạt từ 80% Java 17

Chọn chế độ

Bạn đang chơi với tư cách khách: đăng nhập để lưu XP và streak.

Câu hỏi mẫu

Câu 1/10

What does this print?

public class Main {
    public static void main(String[] args) {
        int[] a = new int[3];
        System.out.println(a[1]);
    }
}
Xem đáp án

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.

Quiz này có gì

  • 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

Câu hỏi thường gặp

Có cần tài khoản không?

Không. Ai cũng chơi được. Đăng nhập để lưu XP, streak, badge và lịch sử.

Có làm lại được không?

Được. Điểm cao nhất của bạn được giữ lại, câu hỏi và đáp án được xáo trộn mỗi lần.