πŸ“Š JAVA
Q. What is the value of y if x = 2?
  • (A) 2
  • (B) 3
  • (C) 7
  • (D) 9
πŸ’¬ Discuss
βœ… Correct Answer: (D) 9
πŸ“Š JAVA
Q. Two-way selection in Java is implemented using ________.
  • (A) if statements
  • (B) for loops
  • (C) if...else statements
  • (D) sequential statements
πŸ’¬ Discuss
βœ… Correct Answer: (C) if...else statements
πŸ“Š JAVA
Q. Which of the following will cause a semantic error, if you are trying to compare x to 5?
  • (A) if (x == 5)
  • (B) if (x = 5)
  • (C) if (x <= 5)
  • (D) if (x >= 5)
πŸ’¬ Discuss
βœ… Correct Answer: (B) if (x = 5)
πŸ“Š JAVA
Q. How many constructors does the class Exception have?
  • (A) 0
  • (B) 1
  • (C) 2
  • (D) 3
πŸ’¬ Discuss
βœ… Correct Answer: (C) 2
πŸ“Š JAVA
Q. If class Dog has a subclass Retriever, which of the following is true?
  • (A) Because of single inheritance, Dog can have no other subclasses.
  • (B) Because of single inheritance, Retriever can extend no other class except Dog.
  • (C) The relationship between these classes implies that Dog “is-a” Retriever.
  • (D) The relationship between these classes implies that Retriever “has-a” Dog.
πŸ’¬ Discuss
βœ… Correct Answer: (B) Because of single inheritance, Retriever can extend no other class except Dog.
πŸ“Š JAVA
Q. If there are three classes: Shape, Circle, and Square, what is the most likely relationship between them?
  • (A) Square is a superclass, and Shape and Circle are subclasses of Square.
  • (B) Shape is a superclass, and Circle and Square are subclasses of Shape.
  • (C) Shape, Circle, and Square are all sibling classes.
  • (D) These three classes cannot be related.
πŸ’¬ Discuss
βœ… Correct Answer: (B) Shape is a superclass, and Circle and Square are subclasses of Shape.
πŸ“Š JAVA
Q. What is byte code in the context of Java?
  • (A) The type of code generated by a Java compiler
  • (B) The type of code generated by a Java Virtual Machine
  • (C) It is another name for a Java source file
  • (D) It is the code written within the instance methods of a class.
πŸ’¬ Discuss
βœ… Correct Answer: (A) The type of code generated by a Java compiler
πŸ“Š JAVA
Q. What is garbage collection in the context of Java?
  • (A) The operating system periodically deletes all of the java files available on the system.
  • (B) Any package imported in a program and not used is automatically deleted.
  • (C) When all references to an object are gone, the memory used by the object is automatically reclaim
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (C) When all references to an object are gone, the memory used by the object is automatically reclaim
πŸ“Š JAVA
Q. What is different between a Java applet and a Java application?
  • (A) An application can in general be trusted whereas an applet can't.
  • (B) An applet must be executed in a browser environment.
  • (C) An applet is not able to access the files of the computer it runs on
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
πŸ“Š JAVA
Q. JAR stands for?
  • (A) Java Archive
  • (B) Java Archive Runner
  • (C) Java Application Runner
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) Java Archive