Omni Flashcards
What is a Delegate?
A way of passing behavior as a parameter
What are Default Constructors?
Methods that don’t return anything or take any parameters
What are Static Members shared between?
Static Members are shared between Instances of a Class
What is a Model?
A Model is an abstraction of something
What does the “new” keyword do?
It allocates memory at run time
What is Inheritance?
If a Class B inherited from Class A then it contains all characteristics (information structure and behavior) of Class A
What is a naive way of writing code line by line?
Procedural Programming
What is Error Handling?
Error Handling is the term for all techniques involving Finding and Correcting Errors
What are the 3 categories that Operators can be divided into?
Unary, Binary, and Ternary
What is the term for a variable in a Struct?
a Data Member
In C#, what is a Field?
A Field is a Variable of any type that is declared directly in a Class or Struct. Fields are Members of their containing type.
What is the difference between a Function and a Method?
A Method is a special type of function with an Implicit Argument Passed (an instance of the class that the method is defined on). This is important, as a Function, in strict terms, should not use or modify anything not in its argument list
Where can you access Private Members from?
Only from Inside the Class
In a Switch statement, it is legal to execute more than one case?
Yes
Can you instantiate an Abstract class?
No
What is the “Diamond Problem”?
In multiple Inheritance, if intermediate classes inherit from same base class then the 3rd level of child class will have the same behavior from two classes
What is Association in OOP?
Object interaction with each other is called Association
What are the 2 main types of Association?
- Class association (inheritance)
- Object association (simple association, composition, aggregation)
What is the difference between “.” and “->” ?
The dot operator “.” accesses type through name
The arrow key operator “->” accesses type through a pointer
What is the purpose of the scope resolution operator?
If you declare a Function inside a Class and define it Outside the Class then you need to use the Scope Resolution Operator “::”
What is a Constructor?
A Constructor is used to Initialize the Objects of Class. The Constructor is automatically called when the Object is Created. It does not have return type.
What is a Destructor?
A Destructor is used to free the memory that is allocated through dynamic memory allocation. It destroys an object when it goes out of scope. Destructors use “~” as prefix
Can Destructors be overloaded?
Yes
How is a Destructor called?
In reverse order
What are Accessors?
Accessors are used to access data members that are defined as private.
Name four Integer Types
Byte, Short, Int, Long. All are also available in Signed and Unsigned versions.
Can Interfaces exist on their own?
No
What is an Interface?
A collection of Private instance Methods and Properties that are grouped together
What does the term Inheritance mean in OOP?
Inheritance is when one class inherits all the Members of another class
What is a Struct?
Data structures that are composed of several pieces of data, possibly of different types
In C#, all Classes are derived from what?
The Base Class Parent at the Root of the Class, and ultimately System
What are Non-default Constructors?
Non-default Constructors are Constructors that include Default Parameters
What does Polymorphism allow?
All Objects Instantiated from a Derived Class can be Treated as if they were Instances of a Parent Class
Are Protected Members accessible anywhere?
No, only from code that is either part of the Class or a Derived Class
Are Public Members accessible anywhere?
Yes
Within a Class definition, do all Members have the same accessibility levels?
No
Which Keyword makes Members Accessible only from code within the assembly (project) where they are defined?
Internal
What are the 4 Class Definition Modifiers for accessibility?
Public, Private, Internal, and Protected
Why would you use the Global keyword?
If you have a conflict between a Class Name and a Namespace, for example, you can use the Global keyword to access the Namespace
If Override is used, can sealed also be used to specify that no further modifications can be made to this method in derived classes?
Yes
Can Accessors be used to control the access level of the Property?
Yes
Accessors are defined using what keywords?
Get and Set
What does the Override modifier do?
The Override Modifier is required to extend or modify the Abstract or Virtual implementation of an Inherited Method, Property, Indexer, or Event
What is Inheritance in classes?
If a Class B inherited from Class A then it contains all the characteristics (information structure and behavior) of Class A
What is Generalization?
Generalization means multiple Classes can Inherit the same Attributes from the parent Class
A Generalization of Cats and Dogs could be?
A. Tabby
B. Mammals
C. Yellow Lab
D. Fur
Mammals
A Specialization of Fish could be?
A. Under Water
B. Animals
C. Whales
D. Tuna
Tuna
What is Containment?
When one class contains another
What is the base class in C#?
System
Abstract classes can possess what kind of members?
Abstract Members and Non-Abstract Members.
Can Abstract Classes contain Members that can be Inherited by a Derived Class?
Yes
Can Interfaces contain Members that can be Inherited by a Derived Class?
No
When you assign an object to a variable, are you actually assigning that variable with a pointer to the object to which it refers?
Yes
What does passing a parameter by reference mean?
The referenced variable will be used each time a function is run rather than using a constant number
A Full Copy is referred to as what?
A Deep Copy
What is the term for the .Net method of freeing up unused memory?
Garbage collection
Properties contain a Type Name, a Property Name, and one or both kind of Blocks?
Get and Set
Do you have to use an Accessor to make a Property useful?
Yes
Do Properties use the same keywords as Fields and Methods?
Yes
What does the keyword “value” refer to?
Equates to a value of the same type as the property
Is Refactoring usually done by hand, or with a tool?
A tool
What is Refactoring?
Code Refactoring is the process of Restructuring existing computer code, Without changing its external Behavior
What is an Object?
A collection of Variables and possibly Functions
Is the main limitation of Automatic Properties that they must include both a Get and Set Accessor?
Yes
When you inherit a Non-Abstract Member from a Base Class, do you also inherit an Implementation?
Yes
Why are Properties the preferred way to access the State of an Object?
They shield external code from the implementation of data storage within the object
With an Automatic Property, you declare what?
A Property with a simplified syntax
When a Base Implementation is hidden, how can you still access it?
By using the Base keyword
Can you define Types such as Classes in Namespaces?
Yes
Can you define Types inside other Classes?
Yes
Is the most useful function of the Base keyword the capability to pass a reference to the current Object instance to a method?
No
Like Base, this refers to an Object instance, although it is a Future Object instance
No
What does the “this” keyword refer to?
An Object Instance
How do Implicit and Explicit Conversions differ?
Implicit: conversion is possible in all circumstances, and the compiler can do it.
Explicit: conversion is possible only in certain circumstances
What is the keyword “this” used for in C#?
To pass a reference of the current object instance to a method
What type of language is C#?
a Strongly Typed, Block-Structured language
Are Interface Members have implementations (bodies)?
No
Can Interfaces can contain code bodies?
No
Why would you want to use the “new” keyword in defining Interface Members?
If you want to hide Members inherited from base Interfaces
A Class that implements an Interface Must Contain implementations for All Members of that Interface
Yes