C# Interview Questions and Answers Part 9

1. Difference between an abstract method & virtual method?

Ans. An Abstract method does not provide an implementation and forces overriding to the deriving class (unless the

deriving class also an abstract class), where as the virtual method has an implementation and leaves an option to

override it in the deriving class.

2. Difference between Structure and Class?

Ans.

1. Structures are value type and Classes are reference type.

2. Structures cannot have contractors or destructors. Classes can have both contractors and destructors.

3. Structures do not support Inheritance, while Classes support Inheritance.

3. What are the different types of assemblies?

Ans. Assemblies can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files. You can also use the .NET Framework to create dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.

4. Difference between const and readonly?

Ans.

1. A const cannot be static, while readonly can be static.

2. A const need to be declared and initialized at declaration only, while a readonly can be initialized at

declaration or by the code in the constructor.

3. A const’s value is evaluated at design time, while a readonly’s value is evaluated at runtime.

5. Difference between inline and code behind?

Ans. Inline code written along with the html and design blocks in an. aspx page.

Code-behind is code written in a separate file (.cs or .vb) and referenced by the. aspx page.

6. Differences between dataset.clone and dataset.copy?

Ans. dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and

constraints.), however it doesn’t copy the data.On the other hand dataset.copy, copies both the dataset structure and the data.

7. What is the difference between early binding and late binding?

Ans. Calling a non-virtual method, decided at a compile time is known as early binding.Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

8. What is Difference between Namespace and Assembly?

Ans. Namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for

types at runtime.






Subscribe

Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker