Search Header Logo

Exception Handling and CollectionQuiz

Authored by Ms. Asst.Prof

Computers

University

Used 3+ times

Exception Handling and CollectionQuiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which class acts as a root for all java classes?

String

Object

Throwable

None of the above

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not a kind of exception that is thrown by the JDBC method?

DataRounding

SQL Exception

DataTruncation

SQL Warning

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Predict the output of following Java program

class Main {

   public static void main(String args[]) {

      try {

         throw 10;

      }

      catch(int e) {

         System.out.println("Got the  Exception " + e);

      }

  }

}

Got the Exception 10

Got the Exception 0

Compiler Error

None

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output of following Java program?

class Main {

   public static void main(String args[]) {

      int x = 0;

      int y = 10;

      int z = y/x;

  }

}

Compiler Error

Compiles fine but throws ArrayIndexOutOfBoundsException

Compiles and runs fine

Compiles fine but throws ArithmeticException exception

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The closest common ancestor of RuntimeException, Error, IOException and ClassNotFoundException is:

Object

Exception

Throwable

Catchable

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements is true about Java's finally block?

The finally block is only executed if an exception is thrown in the try block

The finally block is only executed if an exception is thrown in the catch block

The finally block is only executed if an exception is not thrown in the try or catch block

The finally block is executed regardless of whether an exception is thrown in the try or catch block

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which interface provides key-value pair?

List

Set

Map

Collection

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?