| Can you write a class without specifying namespace? Which namespace does it belong to by default? |
| Yes, you can, and then the class belongs to global namespace which has no name. For commercial products, naturally, you would not want global namespace. |
|
|
|
|
|
| Can you override private virtual methods? |
| No. Private methods are not accessible outside the class. |
|
|
|
|
|
| How many .Net languages can a single .Net DLL contain? |
| One. |
|
|
|
|
|
| What is metadata? |
| Metadata is machine-readable information about a resource or "data about data”. Such information might include details on content, format, size, or other characteristics of a data source. In .Net, metadata includes type definitions, version information, external assembly references, and other standardized information. |
|
|
|
|
|
| What is the difference between string and String? |
| No difference. |
|
|
|
|
|
| What are JIT compilers? How many are available in CLR? |
| Just-In-Time compiler- it converts the language that you write in .Net into machine language that a computer can understand. There are two types of JITs one is memory optimized & other is performance optimized. |
|
|
|
|
|
| Is it possible to use multiple inheritance in .Net? |
| Multiple Inheritance is an ability to inherit from more than one base class i.e. ability of a class to have more than one super class, by inheriting from different sources and thus combine separately-defined behaviours in a single class. There are two types of multiple inheritance: multiple type/interface inheritance and multiple implementation inheritance. C# & VB.NET supports only multiple type/interface inheritance, i.e. you can derive a class/interface from multiple interfaces. There is no support for multiple implementation inheritance in .Net. That means a class can only derived from one class. |
|
|
|
|
|
| What are Resource Files? How are they used in .Net? |
| Resource files are the files containing data that is logically deployed with an application. These files can contain data in a number of formats including strings, images and persisted objects. It has the main advantage of if we store data in these files then we do not need to compile these if the data get changed. In .Net we basically require them storing culture specific information by localizing applications resources. You can deploy your resources using satellite assemblies. |
|
|
|
|
|
| When do you use virtual keyword? |
| When we need to override a method of the base class in the sub class, then we give the virtual keyword in the base class method. This makes the method in the base class to be overridable. Methods, properties, and indexers can be virtual, which means that their implementation can be overridden in derived classes. |
|
|
|
|
|
| What are JIT compilers? How many are available in CLR? |
| Just-In-Time compiler- it converts the language that you write in .Net into machine language that a computer can understand. There are two types of JITs one is memory optimized & other is performance optimized. |
|
|
|
|
|
| What is encapsulation? |
| Encapsulation is the ability to hide the internal workings of an objects behaviour and its data. For instance, lets say you have a object named Bike and this object has a method named start(). When you create an instance of a Bike object and call its start() method you are not worried about what happens to accomplish this, you just want to make sure the state of the bike is changed to running afterwards. This kind of behaviour hiding is encapsulation and it makes programming much easier. |
|
|
|
|
|
| What is GUID and why we need to use it and in what condition? How this is created? |
| A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated. Visual Studio .NET IDE has a utility under the tools menu to generate GUIDs. |
|
|
|
|
|
| How do assemblies find each other? |
| By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the applications directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache. |
|
|
|
|
|
| Why strings are called Immutable data Type? |
| The memory representation of string is an Array of Characters, So on re-assigning the new array of Char is formed & the start address is changed. Thus keeping the old string in memory for garbage collector to be disposed. |
|
|
|
|
|
| Are private class-level variables inherited? |
| Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are. |
|
|
|
|
|