‹ Back to the paper
Consider the following code segment: class Car extends Vehicle implements Fourwheeler {.......}…
Consider the following code segment:
class Car extends Vehicle implements Fourwheeler
{.......}Which of the following statements are valid for the given code?
I. Vehicle is a super class and Fourwheeler is an interface.
II. Interface cannot have abstract methods.
III. Keyword extends applies to class and keyword implements applies to interface.- (a)Only I and II
- (b)Only II and III
- (c)Only I and III
- (d)Only II
Answer
Answer
AICorrect option: (c)
Answer: (c) Only I and III
I is true: Vehicle is the superclass and Fourwheeler is an interface. III is true: 'extends' is used for inheriting a class and 'implements' is used for implementing an interface. II is false: an interface CAN have abstract methods (by default all its methods are abstract, unless declared default/static).
From ISC 2025 Improvement Computer Science Paper 1, question 1(viii).