Deck 11: Advanced Object-Oriented Programming Features
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/75
Play
Full screen (f)
Deck 11: Advanced Object-Oriented Programming Features
1
An overloaded method must have exactly the same signature as the method it is overriding.
False
2
Partial classes enable a class to be split into two or more files and combined when the application is compiled and ran.
True
3
When you have a method that has the same name in both the base and derived classes, use the keyword super to refer to the method in the base class.
False
4
Encapsulation enables multiple implementations of the same behaviors so that the appropriate implementation can be executed based on the situation.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
5
Adding an abstract modifier to a class prohibits other classes from deriving from that class.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
6
When a class implements an interface, the body of each of the interface's methods has to be written in the new class.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
7
The reserved word base, placed in the constructor heading before the opening curly brace, is used to indicate the base class constructor should be called.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
8
When you override a method, the signatures of the methods must match.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
9
Once a DLL is available, any application can add a reference to the DLL. The referenced file with the .dll extension becomes part of the application's private assembly.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
10
Protected access enables derived classes to have access to change data in the base class.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
11
It is not necessary to add a reference to a .dll file if the file is stored in the same project subdirectory.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
12
Class library components should be compiled using a Build option instead of Running the application.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
13
Components that can be referenced from any number of applications are created as class library files with a dynamic link library (DLL) extension.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
14
Generics enable you to identify where data will change in the code segment by putting a placeholder in the code for the type parameters.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
15
You cannot spread the definition of your classes over multiple files using the partial keyword. Partial classes are reserved for use by the IDE.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
16
Constructors, which use the same identifier as their class, are normally defined with protected access.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
17
For classes of animal and dog, animal would be considered the derived class.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
18
Access to members that have been defined with the public access modifier is restricted to members of the current class.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
19
Today applications are normally designed to be single, self-contained, monolithic programs.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
20
All .NET languages support multiple inheritance.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
21
Classes can have a "has a" relationship. This is a concept called ____ or aggregation.
A) "is a"
B) inheritance
C) polymorphism
D) containment
A) "is a"
B) inheritance
C) polymorphism
D) containment
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
22
Components are implemented in C# through ____.
A) classes
B) encapsulation
C) namespaces
D) packages
A) classes
B) encapsulation
C) namespaces
D) packages
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
23
By defining data members as private, you protect the data and enable access only through the object's methods and properties. This describes the ____ feature.
A) abstraction
B) encapsulation
C) polymorphism
D) inheritance
A) abstraction
B) encapsulation
C) polymorphism
D) inheritance
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
24
Software components often take the form of classes or collections of methods.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
25
Enabling multiple implementations of the same behaviors so that the appropriate implementation can be executed based on the situation describes ____ as it relates to object oriented development.
A) abstraction
B) encapsulation
C) polymorphism
D) inheritance
A) abstraction
B) encapsulation
C) polymorphism
D) inheritance
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
26
In addition to creating the console and Windows applications you've already created, you can create class library files with a dynamic link library (.EXE) extension that can be reused.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
27
The ____ keyword can be used to spread the definition of your classes over multiple files.
A) base
B) partial
C) class
D) interface
A) base
B) partial
C) class
D) interface
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
28
The Unified Modeling Language (UML) notation for the interfaces specifies that the name of the Interface methods should appear in italics.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
29
Multiple classes can implement the same interface, but a class can implement only one interface.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
30
Through defining the methods of a class as private, you protect the class.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
31
Object-oriented development focuses on designing classes that can be reused. One way to ensure this reuse is through designing and building components that can be stored in a library and called on when needed.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
32
Abstraction provides a way to simplify complex problems by generalizing and then representing only essential features appropriate to the problem.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
33
You have experienced the use of polymorphism in programs through the use of the Main( ) method.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
34
Packaging data attributes and behaviors into a single unit so that implementation details can be hidden describes ____ as it relates to object oriented development.
A) abstraction
B) encapsulation
C) polymorphism
D) inheritance
A) abstraction
B) encapsulation
C) polymorphism
D) inheritance
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
35
Which access modifier should be used to give derived classes direct access to change the parent member data. This access modifier does not allow classes that instantiate objects of the class to have access to change member data?
A) private
B) public
C) protected
D) internal
A) private
B) public
C) protected
D) internal
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
36
Enabling reuse of code through extending the functionality of classes describes ____ as it relates to object oriented development.
A) abstraction
B) encapsulation
C) polymorphism
D) inheritance
A) abstraction
B) encapsulation
C) polymorphism
D) inheritance
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
37
Class library files end with a(n) ____ extension.
A) .class
B) .dll
C) .exe
D) .cs
A) .class
B) .dll
C) .exe
D) .cs
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
38
Constructors are defined with ____ access modifiers.
A) private
B) public
C) protected
D) internal
A) private
B) public
C) protected
D) internal
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
39
To override a method, the base method may include any of the following keywords, EXCEPT ____.
A) virtual
B) abstract
C) interface
D) override
A) virtual
B) abstract
C) interface
D) override
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
40
Replacing a method defined at a higher level creates a(n) ____.
A) overloaded method
B) overridden method
C) virtual method
D) abstract method
A) overloaded method
B) overridden method
C) virtual method
D) abstract method
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
41
public class A : B, C
Which of the following statements is TRUE regarding the above declaration?
A) A is the base class.
B) B is the derived class.
C) C is an interface.
D) All of the above are correct.
Which of the following statements is TRUE regarding the above declaration?
A) A is the base class.
B) B is the derived class.
C) C is an interface.
D) All of the above are correct.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
42
To add dynamic link library components, add a reference to the components in your program and include a using directive. The reason for adding the using directive is to ____.
A) enable the program to use class members
B) avoid fully qualifying references to class members
C) eliminate the syntax errors
D) enable an executable to be created
A) enable the program to use class members
B) avoid fully qualifying references to class members
C) eliminate the syntax errors
D) enable an executable to be created
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
43
A generic class is defined ____ on the class definition line.
A) by inserting an identifier between left and right parentheses
B) by inserting the word generic
C) by removing the type
D) by inserting an identifier between left and right brackets
A) by inserting an identifier between left and right parentheses
B) by inserting the word generic
C) by removing the type
D) by inserting an identifier between left and right brackets
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
44
Which keyword instructs the compiler to infer the type of the variable from the expression on the right side of the initialization statement?
A) dynamic
B) type
C) infer
D) var
A) dynamic
B) type
C) infer
D) var
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
45
Use the ____ keyword to mark a class so that it can be used only as the base class from which other classes can be derived.
A) base
B) interface
C) virtual
D) abstract
A) base
B) interface
C) virtual
D) abstract
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
46
If you do not want subclasses to be able to provide new implementation details, you can add the keyword ____ to methods. Doing so keeps derived classes from being able to override the method.
A) partial
B) abstract
C) virtual
D) sealed
A) partial
B) abstract
C) virtual
D) sealed
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
47
Determining which method to call at runtime based on which object invokes the method describes ____.
A) abstraction
B) virtual method calls
C) dynamic binding
D) encapsulation
A) abstraction
B) virtual method calls
C) dynamic binding
D) encapsulation
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
48
____ classes cannot be instantiated. ____ classes cannot be inherited.
A) Abstract, Sealed
B) Sealed. Abstract
C) Abstract, Abstract
D) Sealed, Sealed
A) Abstract, Sealed
B) Sealed. Abstract
C) Abstract, Abstract
D) Sealed, Sealed
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
49
In order to inherit from a user-defined base class, you must ____.
A) store both files in the same directory
B) add the base class following a colon
C) add a reference to the base class
D) store both files using the same extension
A) store both files in the same directory
B) add the base class following a colon
C) add a reference to the base class
D) store both files using the same extension
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
50
Variables declared as dynamic ____.
A) require boxing or casting to identify the actual data type
B) can hold any type of value
C) stores data as strings
D) must have an associated data type added as part of the declaration
A) require boxing or casting to identify the actual data type
B) can hold any type of value
C) stores data as strings
D) must have an associated data type added as part of the declaration
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
51
Calls to the ToString( ) method emphasize the use of ____.
A) encapsulation
B) inheritance
C) abstraction
D) polymorphism
A) encapsulation
B) inheritance
C) abstraction
D) polymorphism
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
52
Multiple inheritance is not possible in C#; ____ provides the closest work around to this because a class can implement multiple ____.
A) interfaces
B) abstract classes
C) virtual classes
D) components
A) interfaces
B) abstract classes
C) virtual classes
D) components
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
53
public static void ExchangeContents (ref T value1, ref T value2) {
T temp;
Temp = value1;
Value1 = value2;
Value2 = temp;
}
Which of the following is TRUE regarding the above segment of code?
A) The segment of code is defining a generic method.
B) T is a placeholder for the data type.
C) Data in the memory locations value1 and value2 are swapped.
D) All of the above
T temp;
Temp = value1;
Value1 = value2;
Value2 = temp;
}
Which of the following is TRUE regarding the above segment of code?
A) The segment of code is defining a generic method.
B) T is a placeholder for the data type.
C) Data in the memory locations value1 and value2 are swapped.
D) All of the above
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
54
____ contain no implementation details for any of their methods. Instead all their members are considered abstract.
A) Abstract classes
B) Interfaces
C) Virtual classes
D) Base classes
A) Abstract classes
B) Interfaces
C) Virtual classes
D) Base classes
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
55
When you add the virtual keyword to a method heading, it ____.
A) overrides a method from a base class.
B) tags the method as capable of being overridden.
C) converts the class to an abstract class.
D) forces all classes derived from that class to include implementation details for the method.
A) overrides a method from a base class.
B) tags the method as capable of being overridden.
C) converts the class to an abstract class.
D) forces all classes derived from that class to include implementation details for the method.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
56
The distinguishing characteristic of an abstract method is ____.
A) no implementation details are included
B) they cannot be included in abstract classes
C) no parameters are found in the heading for the method
D) methods may not include a return type
A) no implementation details are included
B) they cannot be included in abstract classes
C) no parameters are found in the heading for the method
D) methods may not include a return type
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
57
One way to write reusable code is to use the object data type for instance data members. Doing so then requires ____.
A) moving the data type into a predefined type
B) using a stack to store the items
C) casting and unboxing the data type
D) creating generic classes
A) moving the data type into a predefined type
B) using a stack to store the items
C) casting and unboxing the data type
D) creating generic classes
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
58
The base default constructor is called by ____.
A) adding base( ): between the constructor heading and the opening curly brace
B) typing base( ): as the first executable statement in the derived constructor
C) adding className( ): between the constructor heading and the opening curly brace
D) typing base( ): as the first executable statement in the Main( ) method
A) adding base( ): between the constructor heading and the opening curly brace
B) typing base( ): as the first executable statement in the derived constructor
C) adding className( ): between the constructor heading and the opening curly brace
D) typing base( ): as the first executable statement in the Main( ) method
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
59
Prior to the introduction of generics, one way to write reusable code was to use the ____ data type for instance data members.
A) interface
B) object
C) var
D) string
A) interface
B) object
C) var
D) string
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
60
Abstract classes can include ____.
A) regular data field and method members
B) only virtual methods
C) only abstract methods
D) properties and virtual methods
A) regular data field and method members
B) only virtual methods
C) only abstract methods
D) properties and virtual methods
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
61
Instead of running or executing a dynamic link library file (DLL), you use the ____________ option to create the .DLL component.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
62
A stack represents a simple ____________ collection.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
63
Polymorphic programming is associated with the ____________. You do not have to know how the method goes about doing its work. All you have to know is what arguments to send, if any, and what you expect to be accomplished when the object finishes its work.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
64
To keep subclasses from overriding a method, add the keyword ____________ to the method's heading.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
65
Classes that inherit from a base class are called ____________ classes.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
66
If a class implements more than one ____________, they all appear on the class definition line separated by commas.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
67
____________ is an object oriented feature that packages data attributes and behaviors into a single unit, thus hiding implementation details.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
68
____________ allows you to create a general class and then define specialized classes that have access to the members of the general class.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
69
A(n) ____________ method uses the same identifier as other method, but has a different number and/or type of parameter from the other one.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
70
You can think of an interface as a class that is totally ____________.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
71
With C#, you have single inheritance, but a class can ____________ multiple interfaces.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
72
Through ____________ the CLR determines which method to call at run time based on which object calls the method.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
73
One of the major advantages of strongly typed languages versus dynamic languages is extensive compile type error checking occurs so that bugs can be found early. With dynamic typing this is delayed until ____________.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
74
____________ enables algorithms to be written where a number of details, including the data
type can be specified-later.
type can be specified-later.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
75
Both var and ____________ enables developers to not associate a specific data type to the actual data when the memory declaration for the variable is written.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck