Prepare Interview

Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address
Check our LIVE MOCK INTERVIEWS

Microsoft .NET Interview Questions and Answers

Test your skills through the online practice test: Microsoft .NET Quiz Online Practice Test

Experienced / Expert level questions & answers

Ques 1. .NET Stands for?

About 10 years ago, I was part of the large team in Redmond working on the set of projects which became ".net". This was during the time the decisions were being made about what to name this work. I can tell you from first-hand experience that ".net" is not an acroynm.

Instead, the James Kovacs blog post that Jim W posted is accurate: ".net" was one of many names that the teams cycled through (and thankfully rejected) before settling on ".net". The name was chosen because it:

mirrored the domain suffix of (at the time) every ISP, so was intended to remind users that "web-enabling your software" was the core scenario being targetted by this work
was more approachable to business types and CIOs than geekier names like "Universal Runtime" or "COM+ 2.0"
had practical benefits like: being short, easy to spell, globalized well, could leverage already-owned domain names for every Microsoft product, etc.
actually passed legal/trademark review (surprisingly difficult!)
So it was intended to mean something, but more so by connotation rather than directly abbreviating or describing something. In other words, the name was only partly marketing nonsense! ;-)

More trivia

I don't remember the exact positioning (it's been 10 years!), but I believe that the name ".net" was supposed cover three basic things:

".net Framework" - a new framework for writing web-enabled apps
".net web services" - a way of accessing Microsoft (and others') software over the web programmatically using open standards and protocols (anyone remember "Hailstorm"?)
".net enterprise servers" - a set of products which made bulding web-enabled applications easier.
In practice, only the first meaning stuck with users. The others morphed into other names (e.g. "Windows Server System") or were genericized by the public (e.g. "web services", SOA, etc.). Anyway, that's why you don't see Microsoft products named "<product name here>.NET Server" any more-- Microsoft wisely decided to limit the ".net" name to the things that developers actually thought of as ".net"!

BTW, in addition to being short and easy to spell and say, ".net" as a name also helped with the web services strategy which Microsoft was persuing at the time, which revolved around (and still does) offering software which was also available in the cloud. The idea was that we'd have, for example, Office.com for a hosted UI version, and Office.net for the APIs. The name also was convenient since Microsoft already owned the .net domain-name variants for every microsoft product.

Is it helpful? Add Comment View Comments
 

Ques 2. What is the default accessibility for members of a struct?

Private

Is it helpful? Add Comment View Comments
 

Ques 3. Can the members of an interface be private?

No

Is it helpful? Add Comment View Comments
 

Ques 4. A class can have many mains, how does this work?

Only one of them is run, that is the one marked (public) static, e.g:
public static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
}
private void Main(string[] args, int i)
{
}

Is it helpful? Add Comment View Comments
 

Ques 5. What are the two return types for main?

void and int

Is it helpful? Add Comment View Comments
 

Ques 6. What is an out parameter?

An out parameter allows an instance of a parameter object to be made inside a method.
Reference parameters must be initialised but out gives a reference to an uninstanciated
object.

Is it helpful? Add Comment View Comments
 

Ques 7. Write code to show how a method can accept a varying number of parameters.

using System;
namespace Console1
{
class Class1
{
static void Main(string[] args)
{
ParamsMethod(1,"example");
ParamsMethod(1,2,3,4);
Console.ReadLine();
}
static void ParamsMethod(params object[] list)
{
foreach (object o in list)
{
Console.WriteLine(o.ToString());
}
}
}
}

Is it helpful? Add Comment View Comments
 

Ques 8. Can you use access modifiers with destructors?

No

Is it helpful? Add Comment View Comments
 

Ques 9. What is a delegate useful for?

The main reason we use delegates is for use in event driven programming.

Is it helpful? Add Comment View Comments
 

Ques 10. Are events synchronous of asynchronous?

Asynchronous

Is it helpful? Add Comment View Comments
 

Ques 11. Events use a publisher/subscriber model. What is that?

Objects publish events to which other applications subscribe. When the publisher raises
an event all subscribers to that event are notified.

Is it helpful? Add Comment View Comments
 

Ques 12. Can a subscriber subscribe to more than one publisher?

Yes, also - here's some code for a publisher with multiple subscribers.
using System;
namespace Console1
{
class Class1
{
delegate void myDelegate(int parameter1);
static event myDelegate myEvent;
static void AStaticMethod(int param1)
{
Console.WriteLine(param1);
}
static void Main(string[] args)
{
MyClass myInstance = new MyClass();
myEvent += new myDelegate(myInstance.AMethod);
myEvent += new myDelegate(AStaticMethod);
myEvent(1); //both functions will be run.
Console.ReadLine();
}
}
class MyClass
{
public void AMethod(int param1)
{
Console.WriteLine(param1);
}
}
}
Another example:
using System;
using System.Threading;
namespace EventExample
{
public class Clock
{
public delegate void TwoSecondsPassedHandler(object clockInstance,
TimeEventArgs time);
//The clock publishes an event that others subscribe to
public event TwoSecondsPassedHandler TwoSecondsPassed;
public void Start()
{
while(true)
{
Thread.Sleep(2000);
//Raise event
TwoSecondsPassed(this, new TimeEventArgs(1));
}
}
}
public class TimeEventArgs : EventArgs
{
public TimeEventArgs(int second)
{
seconds += second;
instanceSeconds = seconds;
}
private static int seconds;
public int instanceSeconds;
}
public class MainClass
{
static void Main(string[] args)
{
Clock cl = new Clock();
// add some subscribers
cl.TwoSecondsPassed += new
Clock.TwoSecondsPassedHandler(Subscriber1);
cl.TwoSecondsPassed += new
Clock.TwoSecondsPassedHandler(Subscriber2);
cl.Start();
Console.ReadLine();
}
public static void Subscriber1(object clockInstance, TimeEventArgs time)
{
Console.WriteLine("Subscriber1:" + time.instanceSeconds);
}
public static void Subscriber2(object clockInstance, TimeEventArgs time)
{
Console.WriteLine("Subscriber2:" + time.instanceSeconds);
}
}
}

Is it helpful? Add Comment View Comments
 

Ques 13. Is a struct stored on the heap or stack?

Stack

Is it helpful? Add Comment View Comments
 

Ques 14. Can C# have global overflow checking?

Yes

Is it helpful? Add Comment View Comments
 

Ques 15. What is explicit vs. implicit conversion?

When converting from a smaller numeric type into a larger one the cast is implicit. An
example of when an explicit cast is needed is when a value may be truncated.

Is it helpful? Add Comment View Comments
 

Ques 16. What doe the stackalloc operator do?

Allocate a block of memory on the stack (used in unsafe mode).

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

Related interview subjects

ASP .NET interview questions and answers - Total 31 questions
Microsoft .NET interview questions and answers - Total 60 questions
C# interview questions and answers - Total 41 questions
©2023 WithoutBook