.NET and C# Flashcards

1
Q

What is .NET?

A

.NET is a platform created by Microsoft which can be used to create various applications for example mobile, web or desktop applications in multiple languages such as C#, F# and VB.

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

What is .NET Framework?

A

.NET Framework is a framework for building desktop and web applications. It does not support cross-platform and will only run on windows.

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

What is .NET Core / .NET 5/6?

A

.NET Core (Now called .NET 5/6) is an open source cross platform framework for building applications and it can run on any platform such as Windows, Mac or Linux.

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

What is .NET standard?

A

.NET Standard is used to create libraries that can be shared and accessed by both .NET Framework and .NET Core projects.

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

What is a value type?

What is a reference type?

A

Data types are categorised based on how they store their value in memory.

Value Type - Variables of value Type directly contain their data. When a value type is created a single space in stack memory is allocated to store the value. Value types include, int, float, decimal, double, bool, enum.

Reference Type - Variables of reference type store a reference (address) to their data. A reference type is stored in heap memory and the reference address is stored in the stack. Reference types include strings, classes, arrays, lists.

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

Explain the public access modifier

A

Public - code can be accessed from anywhere

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

Explain the private access modifier

A

Private - can only be accessed from within the class

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

Explain the Protected access modifier

A

Protected - can be accessed by code in the same class or within a class that is derived from it

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

Explain Internal access modifier

A

Internal - can be accessed by code in the same class or in a derived class in the same assembly(project)

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

Explain protected internal access modifier

A

Protected Internal - can be accessed by code in the same class, another class in the assembly(project) or by a derived class in another assembly

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

Explain private protected access modifier

A

Private Protected - can be accessed by code from within the class or from a derived class in the same assembly.

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

What is boxing and unboxing in C#?

A

Boxing and Unboxing in C# allows for the conversion of data types from value types to reference types and visa versa.

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

Explain Boxing

A

Boxing is the conversion of a value type to a reference type. This is done by creating an object instance in the heap and copying over the value to the object instance.

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

Explain unboxing

A

Unboxing is the conversion of a reference type to a value type. First the object is checked to make sure the boxed value is the right value type then the value is copied from the instance into the value-type variable.

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

Deferred Execution vs Immediate Execution in LINQ

A

Deferred execution means that the query is not executed when it is declared, it is only executed when the query object is iterated over a loop. It returns a group of values. Examples of deferred (or lazy) operators include .Where and .Select

Immediate execution is when the query is executed when it is declared and returns a single value. Examples of immediate (or greedy) operators include .Count, .ToList, .ToArray and .First

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

What is Overloading?

A

Overloading is having multiple methods in the same class each with different parameters. Each of these methods have different implementations depending on what parameters are passed.

17
Q

What is Overriding?

A

Overriding is where a method inherited from a parent class is given a new implementation in the child class. The name and parameters stay the same but the method changes. This is done using the virtual key work on the parent class method and the override key word on the child class method.

18
Q

What is the difference between an Interface and an Abstract class?

A

An interface is a contract and an abstract class is an incomplete implementation.

A class can only inherit from one abstract class but it can inherit from multiple interfaces.

You can partially implement an abstract class but you have to fully implement an interface.

Abstract classes can contain fields and interfaces can not

19
Q

What is IEnumerable?

A

An interface

Allows to enumerate through a collection