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