Deck 12: Object-Oriented Programming: Polymorphism

ملء الشاشة (f)
exit full mode
سؤال
Unfortunately,polymorphic programs make it difficult to add new capabilities to a system.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Polymorphism allows the addition of classes providing they were at least considered during program development.
سؤال
Polymorphism enables you to:

A) program in the general.
B) program in the specific.
C) absorb attributes and behavior from previous classes.
D) hide information from the user.
سؤال
Concrete classes provide implementations for every method and property they define.
سؤال
Abstract classes may not be:

A) inherited
B) accessed by derived-classes
C) instantiated
D) None of the above.
سؤال
Polymorphism allows classes to be added with little or no modifications to the generic portion of a program.
سؤال
Polymorphism helps promote software extensibility.
سؤال
Which statement best describes the relationship between base class and derived class types

A)A derived class reference cannot be assigned to a base class variable and a base class
Reference cannot be assigned to a derived class variable.
B)A derived class reference can be assigned to a base class variable and a base class
Reference can be assigned to a derived class variable.
C)A base class reference can be assigned to a derived class variable,but a derived class
Reference cannot be assigned to a base class variable.
D)A derived class reference can be assigned to a base class variable,but a base class
Reference cannot be assigned to a derived class variable.
سؤال
Which of the following is false about interfaces

A) An interface describes a set of methods that can be called on an object, providing a default implementation for the methods.
B) An interface describes a set of methods that can be called on an object, without providing concrete implementation for the methods.
C) Interfaces are useful when attempting to assign common functionality to possibly unrelated classes.
D) Once a class implements an interface, all objects of that class have an is-a relationship with the interface type.
سؤال
When a request is made to use a derived-class-object method through a base-class reference,C# polymorphically chooses the correct overridden method in the appro
priate derived class that's associated with the object.
سؤال
Polymorphism allows for specifics to be dealt with during:

A)execution
B)compilation
C)programming
D)debugging
سؤال
The abstract methods and properties of a class do not provide an implementation.
سؤال
If a derived class reference is assigned to a base class variable,the variable must be cast back to the derived class before any derived class methods can be called with it.
سؤال
Polymorphism allows you to command a wide variety of objects even if you do not know the objects' types.
سؤال
Polymorphism enables objects of different classes that are related by a class hierarchy to be processed generically.
سؤال
If an app needs to perform a derived-class-specific operation on a derived class object reference by a base class variable,the app must first cast the base class reference to a derived class reference through a technique known as _________.

A) downcasting
D) increasecasting
سؤال
Polymorphism specifically enables the creation of programs that handle:

A) classes that are containers for other classes
B) large amounts of data with efficiency
C) a wide variety of classes in a general manner
D) None of the above
سؤال
When used correctly,polymorphism will never require changes to be made to any part of the program.
سؤال
The major drawback to polymorphically designed programs is that they do not take into account the future addition or deletion of classes.
سؤال
Polymorphism involves:

A) the same message sent to a variety of objects, which each interpret their own way
B) a specific message sent to each specific object
C) different messages sent to one object
D) None of the above.
سؤال
An abstract class cannot have instance data and non-abstract methods.
سؤال
Assigning a derived class reference to a base class variable is safe:

A)because the derived class has an object of its base class.
B)because the derived class is an object of its base class.
C)only when the base class is abstract.
D)only when the base class is concrete.
سؤال
You may define implementations for abstract methods to act as default implementations.
سؤال
Consider the abstract class below:
Public abstract class Foo
{
Private int a;
Public int b;
Public Foo(int aVal,int bVal)
{
A = aVal;
B = bVal;
}
Public abstract int calculate();
}
Any concrete subclass that extends class Foo:

A) Must implement a method called calculate.
B) Will not be able to access the instance variable a.
C) Will not be able to instantiate an object of class Foo.
D) All of the above.
سؤال
Operator is returns true if two matching types are being compared.
سؤال
The keyword sealed is applied to methods and classes to:

A) prevent overriding and inheritance
B) guarantee an implementation exists
C) specify a class is concrete
D) None of the above.
سؤال
Classes and methods are declared sealed for all of the following reasons,except:

A) sealed methods allow inlining the code.
B) sealed methods and classes prevent further inheritance.
C) sealed methods are static.
D) sealed methods can improve performance.
سؤال
An abstract base class can be used to declare references.
سؤال
An abstract class may be derived from another abstract class.
سؤال
Which of the following statements about abstract base classes is true

A) abstract base classes may contain data.
B) abstract base classes may not contain implementations of methods.
C) abstract base classes must declare all methods as abstract.
D) abstract base classes must declare all data members not given values as abstract.
سؤال
A convention of the UML is to denote the name of an abstract class in:

A) bold
B) italics
C) a diamond
D) there is no convention of the UML to denote abstract classes-they are listed just as any other class
سؤال
If the base class contains only abstract method declarations,the base class is used for:

A) implementation inheritance.
B) interface inheritance.
C) Both.
D) Neither.
سؤال
All methods in an abstract class are inherently abstract.
سؤال
________ code is the process by which the compiler replaces method calls with the code of a method to improve performance.

A) Debugging
B) Inlining
C) Compiling
D) None of the above.
سؤال
If a method needs to be called polymorphically,what type of reference should be used to point to the object that the method is being called with

A) a reference of the base class that defines the behavior of the object
B) a reference of the same type as the object
C) an object reference to the actual object
D) None of the above.
سؤال
Attempting to instantiate an object of an abstract class is a logic error.
سؤال
Which declaration declares abstract method method1 in abstract class Class1 (method1 returns an int and takes no arguments)

A) public int method1();
B) public int abstract method1();
C) public abstract int method1();
D) public int nonfinal method1();
سؤال
Objects of abstract base classes can be instantiated.
سؤال
Every object in C# knows its own class and can access this information through method

A) GetType()
B) GetInformation()
C) ObjectClass()
D) ObjectInformation()
سؤال
The abstract keyword has the same effect as the virtual keyword.
سؤال
Sealing methods allows the compiler to optimize the program by "inlining code."
سؤال
Declaring a method sealed means:

A) it will prepare the object for garbage collection
B) it cannot be accessed from outside its class
C) it cannot be overloaded
D) it cannot be overridden
سؤال
Which of the following characteristics could be used to create an interface for a file,a cat and a house

A) door
B) tail
C) age
D) None of the above.
سؤال
A(n)________ is best used for providing services that bring together objects of otherwise unrelated classes.

A) abstract class
B) concrete class
C) interface
D) None of the above.
سؤال
A concrete class that implements an interface must define all methods and properties of that interface.
سؤال
Abstract classes can provide data and services for objects.
سؤال
Interfaces can have methods.

A) 0
B) 1
C) 2
D) any number of
سؤال
By convention,the name for a Car interface is:

A) InterfaceCar
B) ICar
C) CarI
D) None of the above.
سؤال
Constants declared in an interface are implicitly _______.

A)private.
B)static.
C)abstract.
D)All of the above.
سؤال
Which of the following does not complete the sentence correctly
An interface.

A) forces classes that implement it to declare all the interface methods.
B) is used in place of an abstract class when there is no default implementation to inherit.
C) cannot be instantiated.
D) can be instantiated.
سؤال
All methods in a sealed class must be explicitly declared sealed.
سؤال
A class that implements an interface but does not declare all of the interface's methods must be declared:

A) public
B) interface
C) abstract
D) final
سؤال
All static and private methods are implicitly sealed.
سؤال
An interface is typically used in place of an abstract class when there is no default implementation to inherit.
سؤال
Declaring an interface protected allows for extra security precautions.
سؤال
The purpose of an interface is to:

A) provide similar objects with the same functionality, even though each will imple
B) provide different types of objects with the comparable functionality, even though each will imple
C) provide default implementations of methods and properties
D) None of the above.
سؤال
Which is used to specify that a class will be implementing an interface

A) using
B) :
C) implements
D) extends
سؤال
If a class leaves one method in an interface undeclared,the class is implicitly declared by C# as an abstract class.
سؤال
An interface can not provide properties with get and set accessors.
سؤال
All of the following methods are implicitly sealed except:

A) a method in an abstract class.
B) a private method.
C) a method declared in a sealed class.
D) static method.
سؤال
A class that implements an interface may not act as a base class for other classes.
سؤال
An interface reference may invoke only the methods that the interface declares.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/62
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 12: Object-Oriented Programming: Polymorphism
1
Unfortunately,polymorphic programs make it difficult to add new capabilities to a system.
False
Polymorphic programs make it easy to add new capabilities to a system.
2
Polymorphism allows the addition of classes providing they were at least considered during program development.
False
Polymorphism can be used to include classes that were not even envisioned during program development.
3
Polymorphism enables you to:

A) program in the general.
B) program in the specific.
C) absorb attributes and behavior from previous classes.
D) hide information from the user.
A
4
Concrete classes provide implementations for every method and property they define.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
5
Abstract classes may not be:

A) inherited
B) accessed by derived-classes
C) instantiated
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
6
Polymorphism allows classes to be added with little or no modifications to the generic portion of a program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
7
Polymorphism helps promote software extensibility.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
8
Which statement best describes the relationship between base class and derived class types

A)A derived class reference cannot be assigned to a base class variable and a base class
Reference cannot be assigned to a derived class variable.
B)A derived class reference can be assigned to a base class variable and a base class
Reference can be assigned to a derived class variable.
C)A base class reference can be assigned to a derived class variable,but a derived class
Reference cannot be assigned to a base class variable.
D)A derived class reference can be assigned to a base class variable,but a base class
Reference cannot be assigned to a derived class variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following is false about interfaces

A) An interface describes a set of methods that can be called on an object, providing a default implementation for the methods.
B) An interface describes a set of methods that can be called on an object, without providing concrete implementation for the methods.
C) Interfaces are useful when attempting to assign common functionality to possibly unrelated classes.
D) Once a class implements an interface, all objects of that class have an is-a relationship with the interface type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
10
When a request is made to use a derived-class-object method through a base-class reference,C# polymorphically chooses the correct overridden method in the appro
priate derived class that's associated with the object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
11
Polymorphism allows for specifics to be dealt with during:

A)execution
B)compilation
C)programming
D)debugging
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
12
The abstract methods and properties of a class do not provide an implementation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
13
If a derived class reference is assigned to a base class variable,the variable must be cast back to the derived class before any derived class methods can be called with it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
14
Polymorphism allows you to command a wide variety of objects even if you do not know the objects' types.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
15
Polymorphism enables objects of different classes that are related by a class hierarchy to be processed generically.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
16
If an app needs to perform a derived-class-specific operation on a derived class object reference by a base class variable,the app must first cast the base class reference to a derived class reference through a technique known as _________.

A) downcasting
D) increasecasting
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
17
Polymorphism specifically enables the creation of programs that handle:

A) classes that are containers for other classes
B) large amounts of data with efficiency
C) a wide variety of classes in a general manner
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
18
When used correctly,polymorphism will never require changes to be made to any part of the program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
19
The major drawback to polymorphically designed programs is that they do not take into account the future addition or deletion of classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
20
Polymorphism involves:

A) the same message sent to a variety of objects, which each interpret their own way
B) a specific message sent to each specific object
C) different messages sent to one object
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
21
An abstract class cannot have instance data and non-abstract methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
22
Assigning a derived class reference to a base class variable is safe:

A)because the derived class has an object of its base class.
B)because the derived class is an object of its base class.
C)only when the base class is abstract.
D)only when the base class is concrete.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
23
You may define implementations for abstract methods to act as default implementations.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
24
Consider the abstract class below:
Public abstract class Foo
{
Private int a;
Public int b;
Public Foo(int aVal,int bVal)
{
A = aVal;
B = bVal;
}
Public abstract int calculate();
}
Any concrete subclass that extends class Foo:

A) Must implement a method called calculate.
B) Will not be able to access the instance variable a.
C) Will not be able to instantiate an object of class Foo.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
25
Operator is returns true if two matching types are being compared.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
26
The keyword sealed is applied to methods and classes to:

A) prevent overriding and inheritance
B) guarantee an implementation exists
C) specify a class is concrete
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
27
Classes and methods are declared sealed for all of the following reasons,except:

A) sealed methods allow inlining the code.
B) sealed methods and classes prevent further inheritance.
C) sealed methods are static.
D) sealed methods can improve performance.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
28
An abstract base class can be used to declare references.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
29
An abstract class may be derived from another abstract class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
30
Which of the following statements about abstract base classes is true

A) abstract base classes may contain data.
B) abstract base classes may not contain implementations of methods.
C) abstract base classes must declare all methods as abstract.
D) abstract base classes must declare all data members not given values as abstract.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
31
A convention of the UML is to denote the name of an abstract class in:

A) bold
B) italics
C) a diamond
D) there is no convention of the UML to denote abstract classes-they are listed just as any other class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
32
If the base class contains only abstract method declarations,the base class is used for:

A) implementation inheritance.
B) interface inheritance.
C) Both.
D) Neither.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
33
All methods in an abstract class are inherently abstract.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
34
________ code is the process by which the compiler replaces method calls with the code of a method to improve performance.

A) Debugging
B) Inlining
C) Compiling
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
35
If a method needs to be called polymorphically,what type of reference should be used to point to the object that the method is being called with

A) a reference of the base class that defines the behavior of the object
B) a reference of the same type as the object
C) an object reference to the actual object
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
36
Attempting to instantiate an object of an abstract class is a logic error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
37
Which declaration declares abstract method method1 in abstract class Class1 (method1 returns an int and takes no arguments)

A) public int method1();
B) public int abstract method1();
C) public abstract int method1();
D) public int nonfinal method1();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
38
Objects of abstract base classes can be instantiated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
39
Every object in C# knows its own class and can access this information through method

A) GetType()
B) GetInformation()
C) ObjectClass()
D) ObjectInformation()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
40
The abstract keyword has the same effect as the virtual keyword.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
41
Sealing methods allows the compiler to optimize the program by "inlining code."
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
42
Declaring a method sealed means:

A) it will prepare the object for garbage collection
B) it cannot be accessed from outside its class
C) it cannot be overloaded
D) it cannot be overridden
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
43
Which of the following characteristics could be used to create an interface for a file,a cat and a house

A) door
B) tail
C) age
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
44
A(n)________ is best used for providing services that bring together objects of otherwise unrelated classes.

A) abstract class
B) concrete class
C) interface
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
45
A concrete class that implements an interface must define all methods and properties of that interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
46
Abstract classes can provide data and services for objects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
47
Interfaces can have methods.

A) 0
B) 1
C) 2
D) any number of
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
48
By convention,the name for a Car interface is:

A) InterfaceCar
B) ICar
C) CarI
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
49
Constants declared in an interface are implicitly _______.

A)private.
B)static.
C)abstract.
D)All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
50
Which of the following does not complete the sentence correctly
An interface.

A) forces classes that implement it to declare all the interface methods.
B) is used in place of an abstract class when there is no default implementation to inherit.
C) cannot be instantiated.
D) can be instantiated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
51
All methods in a sealed class must be explicitly declared sealed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
52
A class that implements an interface but does not declare all of the interface's methods must be declared:

A) public
B) interface
C) abstract
D) final
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
53
All static and private methods are implicitly sealed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
54
An interface is typically used in place of an abstract class when there is no default implementation to inherit.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
55
Declaring an interface protected allows for extra security precautions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
56
The purpose of an interface is to:

A) provide similar objects with the same functionality, even though each will imple
B) provide different types of objects with the comparable functionality, even though each will imple
C) provide default implementations of methods and properties
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
57
Which is used to specify that a class will be implementing an interface

A) using
B) :
C) implements
D) extends
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
58
If a class leaves one method in an interface undeclared,the class is implicitly declared by C# as an abstract class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
59
An interface can not provide properties with get and set accessors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
60
All of the following methods are implicitly sealed except:

A) a method in an abstract class.
B) a private method.
C) a method declared in a sealed class.
D) static method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
61
A class that implements an interface may not act as a base class for other classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
62
An interface reference may invoke only the methods that the interface declares.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.