1. Origin of Java Q: Who developed the Java programming language? A) Dennis Ritchie B) James Gosling C) Guido van Rossum D) Bjarne Stroustrup Answer: B 2. Features of Java Q: Which of the following is NOT a feature of Java? A) Platform independence B) Garbage collection C) Low-level memory manipulation D) Object-oriented Answer: C 3. Java Elements Q: Which of the following is a valid identifier in Java? A) 1variable B) @variable C) variable1 D) int Answer: C 4. Primitive Data Types Q: Which data type is used to store true or false values in Java? A) int B) char C) boolean D) float Answer: C 5. Control Statements - if-else Q: What will be the output of the following code? int num = 10; if (num > 5) { System.out.println("Greater"); } else { System.out.println("Smaller"); } A) Smaller B) Greater C) Compiler Error D) None of the above Answer: B 6. Conditional Operator Q: What does the following e...
Posts
Showing posts from February, 2025