- types of programming
- declarative: what to execute
- imperative: how to execute
- procedural/structured: defines each step of the program
- functional: avoids state and mutable data
- four OOP principles
- encapsulation: each instance of an object has its own protected data
- abstraction: you don't have to know how the class works, just what you can do with it
- inheritance: classes can inherit other classes in order not to duplicate methods/properties across multiple classes
- polymorphism: use the same logic for multiple types, e.g. generics
- OOP explained with a car analogy
- the objects: Vehicle made up of NumberOfWheels, MPG, etc.
- the methods: Drive(), Refuel()
- child classes inherit from Vehicle and define specific vehicle types (Truck, Car, Motorcycle, etc.)
- each child class has additional fields, including CarType enum for cars, TowingCapacity for trucks, etc.
- the constructor for each child class defines a default NumberOfWheels
- what is CLR?
- it manages running the code and does garbage collection, etc.
- managed vs. unmanaged code
- managed code, like C#, is code that is managed by the CLR during runtime
- unmanaged code, like C, is not (duh)
- abstract vs. interface
- an abstract can have defined methods that can be overridden by the inheriting class
- interfaces don't implement methods, they have to be each implemented in the inheriting classes
- neither can be instantiated
- struct vs. class
- used to define your own value type
- they're technically objects, but they act like value types
- ref vs. out
- ref designates an argument as a reference value, so the object doesn't have to be returned, it's changed in the function
- out takes a variable (that doesn't have to be instantiated) and assigns whatever the return value is to that variable
- what are extension methods?
- you can define static methods to add to an existing class
- what are generics?
- list the accessibility modifiers
- public
- private
- protected: only classes that inherit can use them
- what is a virtual method?
- mark a method as allowed to be overridden
- value vs. reference types
- reference types live in memory and variables point to the objects
- value types live in the stack
- does C# support multiple inheritance? if not, what's a work-around for that?
- no
- you can use multiple interfaces
- you can chain classes to inherit from each other
- what is boxing and unboxing?
- boxing: value -> reference type
- unboxing: reference -> value with explicit conversion
- what are partial classes?
- what are sealed classes?
- late vs. early binding
- what are indexers?
- == vs. Equals()
- with reference objects, == checks if the addresses are the same, if the variables point to the same object
- Equals() checks if the values of the objects are the same
- is vs. as operators
- is checks compatibility
- as forces the object to be another class
- what are different ways a method can be overloaded?
- what is reflection?
- const vs. readonly
- String vs. StringBuilder
- IEnumerable vs. IQueryable
- what is LINQ?
- what are accessors?
- what are indexers?
- dispose vs. finalize
- what are delegates?
- what is a multicast delegate?
- what is constructor chaining?
- Array.CopyTo() vs. Array.Clone()
- throw exception vs. throw clause
- what is an object pool in .NET?
- what is serialization?
- describe the singleton design pattern
- describe the MVC pattern
- describe the design pattern we use at work