Microsoft .NET Interview Questions and Answers
Test your skills through the online practice test: Microsoft .NET Quiz Online Practice Test
Ques 31. 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 32. What is an overloaded method?
An overloaded method has multiple signatures that are different.
Is it helpful?
Add Comment
View Comments
Ques 33. What is recursion?
Recursion is when a method calls itself.
Is it helpful?
Add Comment
View Comments
Ques 34. 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 35. If I have a constructor with a parameter, do I need to explicitly create a default constructor?
Yes
Is it helpful?
Add Comment
View Comments
Most helpful rated by users:
- .NET Stands for?
- Name 10 C# keywords.
- What is public accessibility?
- What is protected accessibility?
- What is protected internal accessibility?