1. How do you comment a single-line in Java?
Explanation: In Java, single-line comments are created using //.
Report for correction2. What does the public keyword indicate in a Java class?
Explanation: The public keyword in Java indicates that the class is accessible from any package.
Report for correction3. What is Java?
Explanation: Java is a high-level, object-oriented programming language.
Report for correction4. What is the correct way to create an instance of a class in Java?
Explanation: To create an instance of a class in Java, you use the new keyword followed by the class name and parentheses.
Report for correction5. What is the default value for an uninitialized int variable in Java?
Explanation: Uninitialized int variables in Java have a default value of 0.
Report for correction6. What is the entry point of a Java program?
Explanation: The main() method is the entry point of a Java program.
Report for correction7. What is the Java keyword for defining a subclass of a class?
Explanation: The extends keyword is used to define a subclass of a class in Java.
Report for correction8. What is the Java operator for addition?
Explanation: The + operator is used for addition in Java.
Report for correction9. What is the purpose of the static keyword in Java?
Explanation: The static keyword in Java is used to define methods or variables that are associated with the class rather than with instances of the class.
Report for correction10. What is the purpose of the super keyword in Java?
Explanation: The super keyword in Java is used to call a method or access a member from the superclass.
Report for correction11. What is the purpose of the this keyword in Java?
Explanation: The this keyword in Java is used to refer to the current instance of the class.
Report for correction12. What is the result of "Hello" + "World" in Java?
Explanation: In Java, the + operator is used for concatenating strings.
Report for correction13. What is the result of 9 % 4 in Java?
Explanation: The % operator in Java calculates the remainder, so 9 % 4 results in 1.
Report for correction14. What is the result of the expression true && false in Java?
Explanation: The && operator in Java represents the logical AND operation, and the result is false if any of the operands is false.
Report for correction15. What is the role of the default case in a switch statement?
Explanation: The default case in a switch statement is executed when none of the other cases match the provided value.
Report for correction16. Which Java access modifier allows a member to be accessed only within its own class?
Explanation: The private access modifier restricts access to members only within the same class.
Report for correction17. Which Java keyword is used for method overriding?
Explanation: The @Override annotation is used in Java to indicate that a method is intended to override a method from its superclass.
Report for correction18. Which Java loop is used when you want to execute a block of code at least once?
Explanation: The do-while loop in Java is used when you want to execute a block of code at least once, as the condition is checked after the loop body.
Report for correction19. Which Java package contains classes for input and output operations?
Explanation: The java.io package in Java contains classes for input and output operations, such as reading and writing files.
Report for correction20. Which Java statement is used to exit a loop prematurely?
Explanation: The break statement is used to exit a loop prematurely in Java.
Report for correction21. Which of the following is a valid Java array declaration?
Explanation: In Java, you declare an array using the new keyword and specify the size in square brackets.
Report for correction22. Which of the following is a valid way to declare a constant in Java?
Explanation: In Java, constants are declared using the final keyword before the data type.
Report for correction23. Which of the following is not a valid Java data type?
Explanation: char@ is not a valid Java data type. The correct data type is char.
Report for correction24. Which of the following is not a valid Java keyword?
Explanation: While main is commonly used as the entry point method, it is not a reserved keyword in Java.
Report for correction25. Which of the following is used to declare a variable in Java?
Explanation: In Java, you use a data type (e.g., int) to declare a variable.
Report for correction