.Net Interview Questions & Answers – Best TOP 10 (Day – 1)

.Net framework is one of the most widely used application development, and therefore .net framework skills are important in most work roles. In this .Net Interview questions article, I will share with you some of the most frequently asked questions on .Net framework such as C#, ADO .NET, ASP.NET and ASP.Net MVC. This article is the perfect guide for you to learn all concepts related to .Net Framework.

What is C-Sharp (C#)?

C# is a type-safe, managed and object-oriented language, which is compiled by the .Net framework for generating intermediate language (IL).
It is also the best language for writing Microsoft .NET applications.
C# provides the rapid application development found in Visual Basic with the power of C++.
It meets 100% of the requirements of OOPs like the following:

  •     Abstraction
  •     Encapsulation
  •     Polymorphism
  •     Inheritance

What are the main reasons to use C# language or advantages of C#?

Below are some of the features supported in C# –

  •     Easy to learn
  •     General purpose and object oriented programming language
  •     Component oriented
  •     Structured language
  •     Can be compiled on variety of computer platforms
  •     Produces efficient programs
  •     Part of .net framework

What are IDE’s provided by Microsoft for C# development?

Below are the IDE’s used for C# development –

  •     Visual Studio Express (VCE)
  •     Visual Studio (VS)
  •     Visual Web Developer

What is an Object?

In C#, an Object is a real-world entity, for example like Car, Bike, mobile, etc.
In other words, the object is an entity that has a state and behavior. Here, state means data and behavior mean functionality. It is created at runtime. The object is an instance of a class. All the members of the class can be accessed through objects.
Let’s see an example to create an object using a new keyword.

Employee emp = new Employee(); //Create object

What is a Class ?

Class is a template, declaration, or blueprint that is used for classifying objects.
It encapsulates variable members, functions, structure, properties and many more components.
It is the basic building block of object-oriented programming. In order to create a class, the class keyword is used.

class Employee
	public void printName()
		Console.WriteLine("Hello http://www.infosyntax.com");

Give me one example of C# Object and Class ?

Let’s see an example of class and object.

using System;
namespace Test
class Employee
	public String name;//data member(also instance variable)
	public String website;//data member(also instance variable)
	public void eName(Employee e)//Member Function
static void Main(string[] args)
	Employee emp = new Employee();//creating an object of Employee
	emp.name = "Raj";
	emp.website = "http://www.infosyntax.com";


Restriction of Class name ?

The class name should be noun and meaningful.
Use either pascal case or camel case. In the camel case, the first letter is small. Ex. camelCase. In pascal’s case the first letter is capital. Ex. PascalCase. It is strictly recommended you use the pascal case for class name and the camel case for variable name.
Your class name should not contain any special character except underscore (_) or digit. Must start your class name with character.
Don’t use reserved keywords for class names.

What is Managed or Unmanaged Code?

Managed Code
“The code, which is developed in .NET framework is known as managed code. This code is directly executed by CLR with the help of managed code execution. Any language that is written in .NET Framework is managed code”.

Unmanaged Code
The code, which is developed outside the .NET framework is known as unmanaged code.
“Applications that do not run under the control of the CLR are said to be unmanaged, and certain languages such as C++ can be used to write such applications, which, for example, access low-level functions of the operating system. Background compatibility with the code of VB, ASP and COM are examples of unmanaged code”.
Unmanaged code can be unmanaged source code and unmanaged compile code. Unmanaged code is executed with the help of wrapper classes.
Wrapper classes are of two types:

  •     CCW (COM Callable Wrapper).
  •     RCW (Runtime Callable Wrapper).

What is CCW? or What is COM Callable Wrapper?

A runtime callable wrapper (RCW) is a wrapper object generated by common language runtime (CLR) to encapsulate a component object model (COM) object for exposing it as a .NET assembly.

An RCW acts as a primary interface for a .NET client that needs to interact with a COM component by marshaling the calls between them. It forms a metadata wrapper that exposes the COM components to the CLR. It helps existing ActiveX containers to host .NET controls and helps .NET Windows Forms applications to host ActiveX containers. RCW is also useful in business systems that have been built using COM

What is RCW? or What is Runtime Callable Wrapper?

The .NET client requests an instance of the COM component, and the runtime creates the RCW, which acts as a bridge between the managed and native worlds. The RCW has the interface that the .NET client requests. When the .NET client casts this interface reference to another interface reference corresponding to an interface that the COM component supports, the RCW will return a reference to that interface, too. The question arises: How does the runtime

C# in Microsoft

Leave a Comment

Your email address will not be published. Required fields are marked *