Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

JAVA QUESTIONS : PART 23

What is the output of this program?
    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                System.out.print("Hello" + " " + 1 / 0);
            }
            catch(ArithmeticException e) 
            {
            System.out.print("World");            
            }
        }
    }

Hello

World

HelloWorld

Hello World

SHOW ANSWER

What is the output of this program?
    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
           {
                int a, b;
                b = 0;
                a = 5 / b;
                System.out.print("A");
            }
            catch(ArithmeticException e) 
            {
            System.out.print("B");            
            }
        }
    }

A

B

Compilation Error

Runtime Error

SHOW ANSWER

What is the output of this program?
   class exception_handling{
        public static void main(String args[]) {
            try 
            {
                int a, b;
                b = 0;
                a = 5 / b;
                System.out.print("A");
            }
            catch(ArithmeticException e) 
            {
            System.out.print("B");            
            }
            finally 
            {
                System.out.print("C");
            }
        }
    }

A

B

AC

BC

SHOW ANSWER

What is the output of this program?
class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                int i, sum;
                sum = 10;
                for (i = -1; i < 3 ;++i)
                    sum = (sum / i);
            }
            catch(ArithmeticException e) 
            {
            System.out.print("0");            
            } 
            System.out.print(sum);
        }
}
 

0

05

Compilation Error

Runtime Error

SHOW ANSWER

Which of the following keywords is used for throwing exception manually?

finally

try

throw

catch

SHOW ANSWER

Which of the following classes can catch all exceptions which cannot be caught?

RuntimeException

Error

Exception

ParentException

SHOW ANSWER

Which of the following is a super class of all exception type classes?

Catchable

RuntimeExceptions

String

Throwable

SHOW ANSWER

Which of the following operators is used to generate instance of an exception which can be thrown using throw?

thrown

alloc

new

malloc

SHOW ANSWER

Which of the following keyword is used by calling function to handle exception thrown by called function?

throws

throw

try

catch

SHOW ANSWER

Which part of code gets executed whether exception is caught or not?

finally

try

catch

throw

SHOW ANSWER

An expression involving byte, int, and literal numbers is promoted to which of these?

int

long

byte

float

SHOW ANSWER

Which data type value is returned by all transcendental math functions?

int

float

double

long

SHOW ANSWER

What is the output of this program?
class increment {
        public static void main(String args[]) 
        {        
             int g = 3;
             System.out.print(++g * 8);
        } 
    }

25

24

32

33

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in