0% found this document useful (0 votes)
49 views

Code Debugging Questions

This document contains 10 multiple choice questions asking whether code compiles and what the output would be. The questions cover a range of Java concepts like strings, exceptions, try/catch/finally blocks, variable initialization, and boolean logic.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

Code Debugging Questions

This document contains 10 multiple choice questions asking whether code compiles and what the output would be. The questions cover a range of Java concepts like strings, exceptions, try/catch/finally blocks, variable initialization, and boolean logic.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1) Is the code compiles? If yes then what will be the output?

a) Yes, string b) yes, object c) Yes, String d) yes, Object

2) Is the code compiles? If yes then what will be the output?

a) yes, Integer b)yes, integer c) no, error at 21 line d) no, error at 23

3)Is the code compiles ? If yes then what will be the output ?
a) Yes, Exception b) yes, exception c) no, arithmeticexception
d) yes, ArithmeticException

4)Is the code compiles ? If yes then what will be the output ?

a) yes, Java Hungry Blogspot b) no c) error d) syntax error

5)Is the code compiles ? If yes then what will be the output ?
a) yes, Am I going to disappear? b) yes, I am born new c) no output
d) logical and syntax error

6) Is the code compiles ? If yes then what will be the output ?

-
a) No , Error at line 6 b)no, error at line 7 c) no, can not convert from
int to boolean d) both a and d
7) Is the code compiles ? If yes then what will be the output ?

a) yes, catch b) yes, finally c) Yes, catch finally d) no output

8)Is the code compiles ? If yes then what will be the output ?
a) Yes, try finally b) yes, catch finally c) no output d) error

9)Is the code compiles ? If yes then what will be the output ?

a) both b and d b) No , Error at line 12 c)no, error at line 10


d) Local variable x has not been initialized
10)Is the code compiles ? If yes then what will be the output ?

a) Yes, abcd abc false abcd abcd true b)yes c) abcd abc false
d) both b and c

You might also like