Section 1 QuestPond Udemy Flashcards

1
Q

What’s the difference between a .NET and C#?

A

.Net is a framework and C# is a programming Language.

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

What is an IL code?

Or What is JIT?

A

Intermediate language Code is the partailly compiled code. When a code has to run in a machine, it has to be compiled to a machine language. in .Net the code is first compiled to a IL language then JIT converts it to a machine language.

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

Who compiles the IL code and how does it work?

A

IL code is compiled by JIT (Just in time compiler).

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

Can we view the IL code?

A

we can view using ILDASM.exe

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

What .Net converts to IL code?

A

Answer on your own.

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

Does .Net supprots multiple languages?

A

Yes. It will get compiled to IL code.

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

What is CLR?

A

Common Language Runtime invokes JIT to compile to IL code. Cleans any unused objects by GC>

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

What is the difference between managed and unmanaged code?

A

Manages code runs under the control of CLR. Unmanaged code such as C++ dont use CLR.

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

What is Garbage Collector?

A

Garbage Collector is a background process which cleans unused Managed resources.

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

What is Garbage Collector?

A

Garbage Collector is a background process which cleans unused Managed resources.

for exmaple,

in a for loop create variable of object Customer..

for(i=0;i<=1000;i++)
{
 Customer x = new Customer();  
}

If we open in profiler, it we can see GC is cleaning those resources.

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

Garbage collector cleans managed code, how do we clean unmanaged code?

A

TBD

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

Explain the importance of CTS?

A

CTS (Common Type Syste,) ensures that data types defined in different languages gets compiled to a common data type.

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

What is CLS?

A

CLS is a set of rules or guidelines when nay .Net language adhers to these sets of guidelines it can be consumed by any other languages in .Net.

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

What is CLS?

A

CLS is a set of rules or guidelines when nay .Net language adhers to these sets of guidelines it can be consumed by any other languages in .Net.

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

What is heap and stack?

A

They are memory types in an application. Stack stores primitive data types such as int double. In heap strings and objects are stored.

In stack, both variable and value is stored.

In heap, the variable in stored nin stack and it refers to the object in Heap.

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

What are value types and reference types?

A

Value types contain actual data while reference typescontains pointer that point to the actual data.

Value types are stored in the satck and reference types are stored in the heap.

17
Q

What is boxing and unboxing?

A

Value to reference type is called bocing

int i = 10;

object j = i;

18
Q

How performance is affected due to boxing and unboxing?

A

TBD

19
Q

What is casting? Impliclit and explcit casting?

A

Casting is move from one DT to another DT.

Implcit casting: when we cast from lower datatype to higher dt is called implicit casting. ex:

int i =10;

double d = i;

double to int

expliit is opposit.

20
Q

What can happen in explicit casting?

A

we loose data. ex:

double 100.23;

int j - i. we lost .23…

21
Q

What are Array and Arraylist?

A

Array are fixed in size and they are strongly typed.

ArrayLists are not fixed.

Exampole,
int [] marr = { 1, 2, 3}

ArrayList myList = new ArrayList();
myList.Add(1);
myList.Add(“Shiv”);

22
Q

Which is better: Array or ArrayList?

A

ArrayList is bad becauyse it causes boxing and unboxing.

23
Q

WHat are Generic Collections?

A

Generic Collectios are strongly types and flexible. It has better performace as compared to ArrayList.

List li = new List();
li.add()
24
Q

What are threads in C#?

A

TBD

25
Q

how do you handle exceptions in C#?

A
use try
{
}
catch(exceptionex)
{
}
26
Q

What is finally block?

A

Finally block runs even when there is no exception. It runs irrespective of the exception. usually used to clean up.

27
Q

What is the use of Out keyword?

A

If we want to return multiple values from a function we will use out keyword.