Prepare Interview

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

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

No

Is it helpful? Add Comment View Comments
 

Ques 27. 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 28. What are the two return types for main?

void and int

Is it helpful? Add Comment View Comments
 

Ques 29. What is a reference parameter?

Reference parameters reference the original object whereas value parameters make a
local copy and do not affect the original. Some example code is shown:
using System;
namespace Console1
{
class Class1
{
static void Main(string[] args)
{
TestRef tr1 = new TestRef();
TestRef tr2 = new TestRef();
tr1.TestValue = "Original value";
tr2.TestValue = "Original value";
int tv1 = 1;
int tv2 = 1;
TestRefVal(ref tv1, tv2, ref tr1, tr2);
Console.WriteLine(tv1);
Console.WriteLine(tv2);
Console.WriteLine(tr1.TestValue);
Console.WriteLine(tr2.TestValue);
Console.ReadLine();
}
static public void TestRefVal(ref int tv1Parm,
int tv2Parm,
ref TestRef tr1Parm,
TestRef tr2Parm)
{
tv1Parm = 2;
tv2Parm = 2;
tr1Parm.TestValue = "New value";
tr2Parm.TestValue = "New value";
}
}
}
class TestRef
{
public string TestValue;
}
The output for this is:
2
1
New value
New value

Is it helpful? Add Comment View Comments
 

Ques 30. 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
 

Most helpful rated by users:

©2024 WithoutBook