T Interv.NEiew Flashcards
(83 cards)
What is composition?
The ability to build functions by using other functions is called composition
what is scaffolding?
Code that is used to assist with development and debugging. Unit test code is an example of scaffolding.
What is the difference between a block and a body?
A block is group of consecutive statements with the same indentation.
A body is a kind of block that is found after a method’s header.
What is an example of definite iteration?
a for loop
What is an example of indefinite iteration?
a while loop
What are collection classes used for?
maintaining lists of objects
What is IList used for?
IList Provides a list of items for a collection along with the capabilities for accessing these items, and some other basic capabilities related to lists of items
What is IDictionary used for?
IDictionary — Similar to IList, but provides a list of items accessible via a key value, rather than an index
Can an interface have a body?
No
An abstract class allows you to create functionality that subclasses _______
inherit (or override??)
Can you apply access modifiers to abstract classes or interfaces, which one?
Only abstract classes
Do you use abstract classes or interfaces to provide multiple inheritance in C#?
Interfaces only
What access modifier must interface members be implicitly implemented with?
public
What is the syntax for explicit implementation?
.
IFile.ReadFile()
Describe an interface
An interface is an empty shell. Only signatures, no bodies. An interface can’t do anything. It’s just a pattern.
Can you define behavior in an interface?
No. Interfaces can only have signatures.
Which constructor would be called first? A base class, or a sub class?
sub class
What is the essential difference between interfaces and abstract classes?
Where you want to define behavior
Is an abstract class an example of a “is-a” relationship, or a “has-a” relationship?
is-a
a Tank is a Vehicle
Are abstract classes or interfaces “implemented”, which one?
interfaces
Are interfaces or abstract methods more expensive to use?
abstract classes
If the proposed base class doesn’t provide default implementations for your methods, is this a reason to choose inheritance or an interface?
interface
If it makes sense to call a method even when no object has been constructed yet, how should that method be defined?
static
Can you override a static method?
no