What is suppressed exception in Java (introduced in Java 7)?
Q.102Hard
What will be printed for this code?
public class ExceptionOrder {
public static void main(String[] args) {
try {
try {
throw new RuntimeException("Inner");
} catch (Exception e) {
throw new IOException("Outer");
}
} catch (IOException e) {
System.out.println("Caught IOException");
} catch (RuntimeException e) {
System.out.println("Caught RuntimeException");
}
}
}
Q.103Hard
Which of the following scenarios will NOT trigger a StackOverflowError?
Q.104Hard
What happens when System.exit() is called inside try block?
Q.105Hard
Which exception is the parent class of all checked exceptions in Java (excluding RuntimeException)?
Advertisement
Q.106Hard
Consider a scenario where multiple catch blocks are written. What is the correct order?
I. catch(FileNotFoundException e)
II. catch(IOException e)
III. catch(Exception e)
Q.107Hard
What will this code output?
int result = 0;
try {
result = 010;
} catch(Exception e) {
result = 20;
return result;
} finally {
result = 30;
}
System.out.println(result);
Q.108Hard
Which of the following custom exceptions would be inappropriate to extend from RuntimeException in a banking application?
Q.109Hard
In exception chaining, what is the primary benefit?
Q.110Hard
If a finally block contains a return statement, what happens to an exception thrown in the try block?
Q.111Hard
In Java 7+, exception handling introduced 'multi-catch' feature using the pipe (|) operator. What's a limitation of multi-catch blocks?
Q.112Hard
Which scenario would cause a StackOverflowError in Java exception handling?
Q.113Hard
In Java NIO, which class replaces traditional Stream-based I/O for better performance?
Q.114Hard
What happens if you call close() multiple times on a stream?
Q.115Hard
Which of the following is true about serialization in Java?
Q.116Hard
In a multi-threaded environment, which stream class provides thread-safe read/write operations without external synchronization?
Q.117Hard
A developer uses PipedInputStream and PipedOutputStream in the same thread. What will happen?
Q.118Hard
A program reads a 1 GB binary file and needs to modify specific bytes at random positions. Which class is most suitable?
Q.119Hard
In Java NIO, what is the primary advantage of FileChannel over traditional streams?
Q.120Hard
For a real-time log file monitoring application, which approach is most suitable?