Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q71: What will the following code snippet output: System.out.println(new Employee().toString());?
- A: Employee class object
- B: Employee ID and name
- C: ID and name from Employee class
- D: Employee ID only
View Answer
C
Q72: How do you explicitly call a superclass method from a subclass in Java?
- A: Use super keyword
- B: Use this keyword
- C: Use extends keyword
- D: Use call keyword
View Answer
A
Q73: What is the default access level for members of a class in Java if no access modifier is specified?
- A: public
- B: private
- C: protected
- D: package-private
View Answer
D
Q74: What does polymorphism in Java allow?
- A: Multiple methods with the same name
- B: Different methods with different names
- C: The same method with the same name in multiple classes
- D: Multiple methods with different names
View Answer
A
Q75: Which keyword is used for up-casting in Java?
- A: (int)
- B: (double)
- C: explicit
- D: implicit
View Answer
D
Q76: What does down-casting require in Java?
- A: Implicit type conversion
- B: Explicit type conversion
- C: No type conversion needed
- D: Implicit type casting
View Answer
B
Q77: In Java, how do you handle the scenario where a class needs to be converted to a more specific type?
- A: Use up-casting
- B: Use down-casting
- C: Use casting without specifying type
- D: Use automatic type conversion
View Answer
B
Q78: What will the following code snippet output: System.out.println(new Teacher().toString());?
- A: Teacher object information
- B: Teacher qualification only
- C: ID and qualification from Teacher class
- D: Teacher name and ID only
View Answer
C
Q79: What is the difference between a constructor and a method in Java?
- A: Constructors do not return values while methods do
- B: Methods do not initialize objects while constructors do
- C: Constructors can be overridden while methods cannot
- D: Constructors are used for object creation while methods perform actions
View Answer
A
Q80: How does Java's garbage collector handle object finalization?
- A: By calling finalize() method
- B: By manually freeing memory
- C: By using delete keyword
- D: By automatically releasing memory
View Answer
A