Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q151: Which of the following statements about interfaces is true?
- A: A class can implement multiple interfaces
- B: Interfaces can have method implementations
- C: Interfaces can be instantiated
- D: Interfaces can contain instance variables
View Answer
A
Q152: What does the Speaker interface require its implementing classes to provide?
- A: A speak() method with a default implementation
- B: A print() method
- C: A speak() method with implementation
- D: A calculateArea() method
View Answer
C
Q153: What is the purpose of using interface-based polymorphism in Java?
- A: To restrict the class hierarchy
- B: To allow multiple inheritance
- C: To prevent class instantiation
- D: To achieve method overloading
View Answer
B
Q154: What is the output of the Test class in the Speaker interface example when sp points to Politician?
- A: Web Design and Development Talks
- B: Politics Talks
- C: Sports Talks
- D: Name: address
View Answer
B
Q155: In the code Shape s = new Circle();, what type is s?
- A: Circle
- B: Shape
- C: Object
- D: Test
View Answer
B
Q156: What type of method must a class provide when implementing an interface method?
- A: Static method
- B: Abstract method
- C: Concrete method
- D: Final method
View Answer
C
Q157: Which Java class cannot be instantiated directly?
- A: Circle
- B: Shape
- C: Test
- D: Student
View Answer
B
Q158: What will happen if a class does not implement all methods of an interface?
- A: It will compile with a warning
- B: It must be declared abstract
- C: It will compile but with errors
- D: It will execute with runtime exceptions
View Answer
B
Q159: What does the AWT stand for in Java?
- A: Abstract Windowing Toolkit
- B: Advanced Window Toolkit
- C: Automatic Window Toolkit
- D: Advanced Widget Toolkit
View Answer
A
Q160: An abstract class --------------- instantiated.
- A: Can’t be
- B: Can be
- C: Must
- D: None of these
View Answer
A