Basics Flashcards

1
Q

(++, – ) What are these operators called?

A

Unary

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

How do you use a goto?

A

Make a label of any name, e.g. “label:”, then use goto label.

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

How would you pass a reference type in a method argument?

A

ref <property> <property></property></property>

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

When is a constructor invoked?

A

At the time of object creation.

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

How would you create a Destructor?

A

~ClassName() { }

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

What is static?

A

A keyword or modifier that belongs to the type and not instance. Instance is not required to access static members.

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

What are the benefits of using static?

A

Memory efficient as we don’t need to create instances to access their members.

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

What is inheritance?

A

The process in which one object acquires all the properties and behaviours of its parent object automatically

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

What is the advantage of inheritance?

A

Code reusability: Now you can reuse the members of your parent class. So, there is no need to define the member again. So less code is required in the class.

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

What are the two types of polymorphism?

A

Compile time polymorphism and runtime polymorphism

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

How is compile time polymorphism achieved?

A

Compile time polymorphism is achieved by method overloading and operator overloading in C#

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

How is runtime polymorphism achieved?

A

Having a derived class defining the same method as defined in its base class.

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

What is method overloading?

A

Having two methods of the same name with different params or different param types.

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

What is method overriding?

A

If derived class defines same method as defined in its base class, it is known as method overriding in C#

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

What is polymorphism?

A

Having a single entity have multiple implementations.

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

How do you achieve method overriding?

A

You use the virtual keyword with base class method and override keyword with derived class method

17
Q
A