Java Test 3 – Easy–Medium Level Welcome to your Java Test 3 – Easy–Medium Level1. Which of the following is a correct method definition in Java? A) function sum(int a, int b) => a + b; B) int sum(a, b) return a + b; C) int sum(int a, int b) { return a + b; } sum(int a, int b): int { return a + b; } None 2. What will the following code print?int x = 10;if (x > 5) { System.out.println("Greater than 5");} A) Error B) Greater than 5 C) 5 D) x > 5 None 3. Which value does this expression return?Math.max(4, 9); A) 4 B) 9 C) 13 D) Error None 4. What is the correct way to declare a class named Person? A) object Person {} B) class Person {} C) Person = class {} D)def Person() {} None 5. What does this return?String s = "Hello";System.out.println(s.charAt(1)); A) H B) e C) l D) Error None 6. Which of the following is true about for loops in Java? A) They can only increment by 1 B) They cannot be used with arrays C) They include an initialization, condition, and update D) They only work with integers None 7. What will this code print?String a = "Hi";String b = "Hi";System.out.println(a == b); A) false B) true C) Error D) Hi None 8. How do you convert an int to a String in Java? A) toString(int) B) String.valueOf(int) C) String(int) D) parseString(int) None 9. What does this print?int[] arr = {1, 2, 3};System.out.println(arr.length); A) 2 B) 3 C) 4 D) Error None 10. What will this return?String text = "Java";System.out.println(text.toUpperCase()); A) Java B) JAVA C) java D) Error None Time's upDid you like it? Don’t keep it to yourself — share it like juicy gossip! 😏