Prepare Interview

Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Microsoft .NET Interview Questions and Answers

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

Freshers / Beginner level questions & answers

Ques 1. Name 10 C# keywords.

abstract, event, new, struct, explicit, null, base, extern, object, this

Is it helpful? Add Comment View Comments
 

Ques 2. What is public accessibility?

There are no access restrictions. All can access the public instance from anywhere.

Is it helpful? Add Comment View Comments
 

Ques 3. What is private accessibility?

Access is restricted to within the containing class.

Is it helpful? Add Comment View Comments
 

Ques 4. Class methods to should be marked with what keyword?

Static.

Is it helpful? Add Comment View Comments
 

Ques 5. Does an object need to be made to run main?

No

Is it helpful? Add Comment View Comments
 

Ques 6. Write a hello world console application.

using System;
namespace Console1
{
class Class1
{
[STAThread] // No longer needed
static void Main(string[] args)
{
Console.WriteLine("Hello world");
}
}
}

Is it helpful? Add Comment View Comments
 

Ques 7. What is recursion?

Recursion is when a method calls itself.

Is it helpful? Add Comment View Comments
 

Ques 8. What is a constructor?

A constructor performs initialisation for an object (including the struct type) or class.

Is it helpful? Add Comment View Comments
 

Ques 9. What is a destructor?

A C# destuctor is not like a C++ destructor. It is actually an override for Finalize(). This
is called when the garbage collector discovers that the object is unreachable. Finalize()
is called before any memory is reclaimed.

Is it helpful? Add Comment View Comments
 

Ques 10. Name 5 built in types.

Bool, char, int, byte, double

Is it helpful? Add Comment View Comments
 

Ques 11. Is string Unicode, ASCII, or something else?

Unicode

Is it helpful? Add Comment View Comments
 

Ques 12. Strings are immutable, what does this mean?

Any changes to that string are in fact copies.

Is it helpful? Add Comment View Comments
 

Ques 13. Name a few string properties.

trim, tolower, toupper, concat, copy, insert, equals, compare.

Is it helpful? Add Comment View Comments
 

Ques 14. What is boxing and unboxing?

Converting a value type (stack->heap) to a reference type (heap->stack), and viseversa.

Is it helpful? Add Comment View Comments
 

Ques 15. Write some code to box and unbox a value type.

// Boxing
int i = 4;
object o = i;
// Unboxing
i = (int) o;

Is it helpful? Add Comment View Comments
 

Ques 16. What is a heap and a stack?

There are 2 kinds of heap – 1: a chunk of memory where data is stored and 2: a tree
based data structure. When we talk about the heap and the stack we mean the first kind
of heap. The stack is a LIFO data structure that stores variables and flow control
information. Typically each thread will have its own stack.

Is it helpful? Add Comment View Comments
 

Ques 17. What is a pointer?

A pointer is a reference to a memory address.

Is it helpful? Add Comment View Comments
 

Ques 18. What does new do in terms of objects?

Initializes an object.

Is it helpful? Add Comment View Comments
 

Ques 19. What is a struct?

Unlike in C++ a struct is not a class – it is a value type with certain restrictions. It is
usually best to use a struct to represent simple entities with a few variables. Like a Point
for example which contains variables x and y.

Is it helpful? Add Comment View Comments
 

Ques 20. Describe 5 numeric value types ranges.

sbyte -128 to 127, byte 0 – 255, short -32,768 to 32,767, int -2,147,483,648 to
2,147,483,647, ulong 0 to 18,446,744,073,709,551,615

Is it helpful? Add Comment View Comments
 

Ques 21. Write code for a case statement.

switch (n)
{
case 1:
x=1;
break;
case 2:
x=2;
break;
default:
goto case 1;
}

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

Related interview subjects

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