Java Exception Kuiz

Java Exception mövzusuna aid 10 sualdan ibarət kuiz. Uğurlar!

29 Avqust 2024 - 16:16
 0  96

1. Hansı exception "Unchecked Exception"-dır?

IOException
SQLException
NullPointerException
ClassNotFoundException

2. Bütün exception-ların ana sinifi hansıdır?

RuntimeException
Error
Exception
Throwable

3. Hansi blok, exception-nın baş verib-vermədiyinə baxmayaraq icra olunur?

finally
throws
try
catch

4. Hansi exception "checked exception"-lara aiddir?

ArrayIndexOutOfBoundsException
FileNotFoundException
NullPointerException
ArithmeticException

5. Hansı exception-ı tutmaq (catch) məcburidir?

ArithmeticException
NullPointerException
IOException
ArrayIndexOutOfBoundsException

6. Hansı metod Throwable sinfinin metodlarından biri deyil?

getMessage()
toString()
notify()
printStackTrace()

7. Hansı metod exception fırladır?

finalize()
static()
new()
throw()

8. Exception-ların tutulması üçün hansı növ "try" istifadə olunur?

Nested try
Single try
Multi-catch try
Yuxarıda göstərilənlərin hamısı

9. Aşağıdakı kod bloku hansı exception-ı atacaq?

public class Main {
    public static void main(String[] args) {
        int[] numbers = {1, 2, 3};
        System.out.println(numbers[3]);
    }
}

IndexOutOfBoundsException
ArithmeticException
NumberFormatException
ArrayIndexOutOfBoundsException

10. Aşağıdakı kod bloğunda hansı xəta baş verəcək?

public class Main {
    public static void main(String[] args) {
        String text = null;
        System.out.println(text.length());
    }
}

StringIndexOutOfBoundsException
IllegalArgumentException
ClassCastException
NullPointerException