Docsity

Software Development Fundamentals: Lesson 2 - Object-Oriented Programming Concepts, Exams of Biology

Toggle sidebar
bg1
Software
Development
Fundamentals
Lesson 2
constructor - answer A special class method that is
executed when a new instance of a class is
created. It is used to initialize the data members of
the object.
A. constructor
B. accessors
C. delegate
D. inheritance
event - answer A way for a class to notify other
classes or objects when something of interest
happens. The class that sends the notification is
called a publisher of the event. The class that
pf3
pf4
pf5

Partial preview of the text

Download Software Development Fundamentals: Lesson 2 - Object-Oriented Programming Concepts and more Exams Biology in PDF only on Docsity!

Software

Development

Fundamentals

Lesson 2

constructor - answer A special class method that is executed when a new instance of a class is created. It is used to initialize the data members of the object. A. constructor B. accessors C. delegate D. inheritance event - answer A way for a class to notify other classes or objects when something of interest happens. The class that sends the notification is called a publisher of the event. The class that

receives the notification is called the subscriber of the event. A. abstract class B. event C. delegate D. interface inheritance - answer A feature of object-oriented programming that allows you to develop a class once and then reuse that code over and over as the basis of new classes. A. encapsulation B. abstract class C. inheritance D. interface interface - answer Used to establish a contract through which objects can interact with each other without knowing the implementation details. A. polymorphism B. interface C. encapsulation

virtual - answer You created a class named GeoShape. You defined a method called Area in the GeoShape class. This method calculates the area of a geometric shape. You want the derived classes of GeoShape to supersede this functionality to support the area calculation of additional geometric shapes. When the method Area is invoked on a GeoShape object, the area should be calculated based on the runtime type of the GeoShape object. Which keyword should you use with the definition of the Area method in the GeoShape class? A. abstract B. virtual C. new D. overrides sealed - answer Suppose that you defined a class Scenario that defines functionality for running customized pivot transform on large data sets. You do not want the functionality of this class to be inherited into derived classes. What keyword should you use to define the Scenario class? A. sealed B. abstract

C. private D. internal Create a common interface that all classes implement. - answer You need to provide printing functionality to several of your classes. Each class's algorithm for printing will likely be different. Also, not all the classes have an "is-a" relationship with each other. How should you support this functionality? A. Add the print functionality to a base class with the public access modifier. B. Have all classes inherit from an abstract base class and override the base-class method to provide their own print functionality. C. Have all the classes inherit from a base class that provides the print functionality. D. Create a common interface that all classes implement. method - answer You are writing code for a class named Book. You should be able to get a list of all books sorted by the author's last name. You need to write code to define this behavior of a class. Which of the following class elements should you use?