Soru
1)What is the purpose of association in object-oriented programming? A. To define a common interface for unrelated classes B. To enforce strict inheritance rules between classes C. To ensure that all classes are tightly coupled D. To create "knows about" relationships between classes 2)What must a class do if it chooses to implement an interface? A. A class can choose to ignore methods declared in the interface B. A class must define all methods declared in the interface C. A class must define only some methods declared in the interface D. A class must provide default implementations for all methods declared in the interface 3)What is the significance of the (2)Override annotation in a class implementing an interface? A. It allows the method to be private and not visible outside the class B. It indicates that the method is a static method and cannot be overridden C. It provides documentation for the method, improving code readability D. It enforces that the method matches the interface declaration 4)What is the primary purpose of an interface in programming? A. To define a contract for classes to follow B. To encapsulate data and behavior in a single unit C. To define the implementation details of methods D. To provide a blueprint for class instantiation 5)How does a class indicate that it implements an interface? A. A class indicates it implements an interface by using the "extends"keyword in its declaration. B. A class indicates it implements an interface by using the "implements"keyword in its declaration. C. A class indicates it implements an interface by defining the methods without any specific keywor D. A class indicates it implements an interface by using the "interface"keyword in its declaration. 6)Can a class implement multiple interfaces? If so what does this imply? A. A class can implement multiple interfaces, but it must define only one method from each. B. A class can implement multiple interfaces, but it can choose to ignore some methods. C. A class can implement multiple interfaces, defining all methods from each. D. A class can only implement one interface.
Çözüm
4.2294 Voting
Burak
Profesyonel · 6 yıl öğretmeniUzman doğrulaması
Cevap
1) D. To create "knows about" relationships between classes<br />2) B. A class must define all methods declared in the interface<br />3) D. It enforces that the method matches the interface declaration<br />4) A. To define a contract for classes to follow<br />5) B. A class indicates it implements an interface by using the "implements" keyword in its declaration.<br />6) C. A class can implement multiple interfaces, defining all methods from each.
Derecelendirmek için tıklayın: