technical Qs Flashcards

1
Q

What is an instance in object-oriented programming?

A

An instance is an object that is an instance of a class or type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

An instance is an object that is an instance of a class or type

A

Class / Static Method: ClassName.MethodName( )

Instance Method: instanceOfAClass.MethodName()

For example) repo.GetAllProducts(); 
An instance method applies to an instance of the class (i.e. an object) whereas a class method applies to the class itself. 
In C# a class method is marked static. Methods and properties not marked static are instance methods.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When should you add an index to a database column? What is the cost of a database index?

A

When you want to read from the database faster. The cost is that it takes more time to write information to the database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain REST / RESTful Services:

A

Representational State Transfer – is a language-independent architecture that provides interoperability between computer systems on the Internet. It utilizes a stateless protocol aiming for fast performance and reliability. POST, GET, PUT, DELETE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is fault tolerance?

A

enables a system to continue operating properly in the event of the failure of (or one or more faults within) some of its components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain what an ORM does?

A

Object Relational Mapper – is a software abstractor that is used to access a relational database from an object-oriented language.

We’ve used Dapper in this class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Difference between a Class and an Abstract Class?

A
An abstract class is intended to be a base class of other classes. It acts as a
template for its derived classes. 
Abstract classes have the following features: 
- An abstract class cannot be instantiated. 
- An abstract class may contain abstract methods and accessors. 
- A non-abstract class derived from an abstract class must include actual
implementations of all inherited abstract methods and accessors.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is C#?

A

C# is a strongly and statically typed object-oriented programming language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain what a Class is in C#:

A

A class is a user-defined blueprint or prototype from which objects are created

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the 4 pillars of object-oriented programming?

A

Inheritance - In OOP, inheritance is the concept that a child class or type can inherit functionality from its parent. You can think of inheritance as a parent/child relationship.

Polymorphism - In OOP, polymorphism is the concept that two or more different classes/types with differing implementations can be referenced or called in a similar fashion.

Encapsulation - In OOP, encapsulation is the concept that a class or type will only expose the functionality necessary to accomplish a given goal, hiding or encapsulating any remaining functionality.
A good real world example of encapsulation is a car. A car may have a great deal of moving parts, such as the engine, brakes, and the transmission, but all of that is hidden under the hood. What is exposed to the driver is the bare essentials for driving, such as a steering wheel, gas pedal, and brake pedal.

WE WANT TO BE ABLE TO SWAP PIECES OUT, MAKE TESTING EASIER, THIS IS WHY WE USE INTERFACES, AddTransient()

Abstraction - In OOP, abstraction is the concept that software should be built in abstract sections that can be combined together into a cohesive whole, as opposed to building code where everything is tightly coupled and difficult to break apart.
Think of a swiss army knife vs. a chisel
A swiss army knife can be used for a bunch of tasks, but its ability to perform is less than optimal for each one of those tasks.
A chisel does one thing; and it does it well.

Putting things that a computer will do into concepts that a human can understand – convey in naming! method names, etc. People reading your code can understand and intuit your code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a Delegate?

A

A delegate is a type that represents references to methods with a particular parameter list and return type. When you instantiate a delegate, you can associate its instance with any method with a compatible signature and return type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is .NET Core?

A

.NET Core is a free and open-source, managed computer software framework

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Difference between constant and readonly

A

Constant variables are declared and initialized at compile time. The value can’t be changed afterward. Read-only is used only when we want to assign the value at run time.

Constants
Constants are static by default
They must have a value at compilation-time (you can have e.g. 3.14 * 2, but cannot call methods)
Could be declared within functions
Are copied into every assembly that uses them (every assembly gets a local copy of values)
Can be used in attributes

Readonly instance fields
Must have set value, by the time constructor exits
Are evaluated when instance is created

Static readonly fields
Are evaluated when code execution hits class reference (when new instance is created or a static method is executed)
Must have an evaluated value by the time the static constructor is done
It's not recommended to put ThreadStaticAttribute on these (static constructors will be executed in one thread only and will set the value for its thread; all other threads will have this value uninitialized)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Example of polymorphism

A

think of a base class called Animal that has a method called animalSound(). Derived classes of Animals could be Pigs, Cats, Dogs, Birds - And they also have their own implementation of an animal sound (the pig oinks, and the cat meows, etc.):

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a Namespace?

A

Namespaces are used to provide a “named space” in which your application resides. They’re used especially to provide the C# compiler a context for all the named information in your program, such as variable names.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly