Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

1. What is the difference between overriding and overloading a method?

Explain how both are


done.

Overloading
Overloading is when you have multiple methods in the same scope(class), with the same
name but different signatures.

Creating the method in a derived class with same name, same parameters and same return type as
in base class is called as method overriding.

//Overloading
public class test
{
public void getStuff(int id)
{}
public void getStuff(string name)
{}
}

Overriding
Overriding is a principle that allows you to change the functionality of a method in a child
class.

Creating a multiple methods in a class with same name but different parameters and types is called
as method overloading.method overloading is the example of Compile time polymorphism which
is done at compile time.

//Overriding
public class test
{
public virtual void getStuff(int id)
{
//Get stuff default location
}
}

public class test2 : test


{
public override void getStuff(int id)
{
//base.getStuff(id);
//or - Get stuff new location
}
}
2. What is the difference between compilation error and run time error?

Compile time error is any type of error that prevent a c# program compile like a
syntax error, a class not found, a bad file name for the defined class, a possible
loss of precision when you are mixing different java data types and so on. A runtime
error means an error which happens, while the program is running.

3. Does C# is a managed code or unmanage code?

Managed code, Managed code is computer program code that requires and will execute
only under the management of a Common Language Runtime virtual machine, typically
the .NET Framework, or Mono.

 Managed code is .NET code (VB.NET, C# etc.) that you write and compile to .NET CIL.
 Unmanaged code is code that is not under .NET that compiles to direct machine code.

4. What are REST and SOAP?

SOAP (Simple Object Access Protocol) and REST (Representation State


Transfer)
SOAP – XML , REST – json

5. What is the difference of asynchronous and synchronous call?


6. What is business logic?
7. What is the difference between localization and globalization?
8. What are the different validators in ASP.NET?
9. What is IIS?

You might also like