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