Java Quizz Test your Java knowledge! 🚀 Take our tech quiz to sharpen your skills, challenge your understanding, and compete with others. Start quizzing today! 1 / 14 1. Which of the following is a checked exception? ArithmeticException IOException ArrayIndexOutOfBoundsException NullPointerException 2 / 14 2. What is the default priority of a thread in Java? 1 10 0 5 3 / 14 3. Which of the following is correct about setFetchSize(int)? setFetchSize(int) affects how the database returns the ResultSet data. setFetchSize(int) defines the number of rows that will be read from the database when the ResultSet needs more rows. Both of the above. None of the above. 4 / 14 4. Which of the following methods can be used to make a thread pause execution for a specific amount of time? sleep() yield() wait() pause() 5 / 14 5. Which method is used to transform each element of a Stream using a provided function? flatMap map filter reduce 6 / 14 6. Which of the following is correct about PreparedStatement? None of the above. PreparedStatement allows mapping different requests with same prepared statement but different arguments to execute the same execution plan. Prepared statements are more secure because they use bind variables, which can prevent SQL injection attack. Both of the above. 7 / 14 7. What is the main purpose of the Stream.sorted method? To reverse the order of elements in the stream To remove duplicate elements from the stream To randomly shuffle the elements of the stream To sort the elements of the stream in their natural order or by a provided comparator 8 / 14 8. In which of the following type of ResultSet, the cursor can only move forward in the result set? ResultSet.TYPE_SCROLL_SENSITIVE ResultSet.TYPE_FORWARD_ONLY ResultSet.TYPE_SCROLL_INSENSITIVE None of the above. 9 / 14 9. What is the output of the following code? try { int a = 10 / 0; } catch (ArithmeticException e) { System.out.println("Exception caught"); } finally { System.out.println("Finally block"); } Exception caught Finally block Exception caught Finally block 10 / 14 10. Which of the following is a valid lambda expression? x -> x*x (x, y) -> return x + y; All of the above (int x, int y) -> x + y 11 / 14 11. Select all the classes that extend the String class StringBuilder None StringWriter StringBuffer 12 / 14 12. What will be the output of the below statements? public class Test { public static void main(String[] args) { String s1 = "abc"; StringBuffer s2 = new StringBuffer(s1); System.out.println(s1.equals(s2)); } } false Compile-time error true ClassCastException at runtime 13 / 14 13. Which method is used to start a thread in Java? start() execute() run() init() 14 / 14 14. What is the result of applying the Stream.reduce operation? A boolean indicating if any stream elements match a given predicate A list of elements that were reduced A new stream with elements reduced according to a provided accumulator function An Optional describing the reduced value, if any Your score is 0%