Loading, please wait...

C# Multiple Choice Questions And Answers

Search here for MCQs

Are you preparing for the next job interviews? If yes, trust me this post will help you also we'll suggest you check out a big collection for Programming Full Forms that may help you in your interview:

List of Programming Full Forms 

16. Struct’s data members are ___ by default.

  • Protected
  • Public
  • Private
  • Default

17. The point at which an exception is thrown is called the _____.

  • Default point
  • Invoking point
  • Calling point
  • Throw point

18. Which of the following statements are correct for C# language?

  • Every derived class does not define its own version of the virtual method.
  • By default, the access mode for all methods in C# is virtual.
  • If a derived class, does not define its own version of the virtual method, then the one present in the base class gets used.
  • All of the above.

19. What will be the output of the following code snippet?

using System;

class sample
{
     public sample()
     {
         Console.WriteLine("constructor 1 called");
     }
     public sample(int x)
     {
         int p = 2;
         int u;
         u = p + x;
         Console.WriteLine("constructor 2 called");
     }
}
class Program
{
     static void Main(string[] args)
     {
         sample s = new sample(4);
         sample t = new sample();
         Console.ReadLine();
     }
}
  • constructor 1 called constructor 2 called
  • constructor 2 called constructor 1 called
  • constructor 2 called constructor 2 called
  • error

20. Which of the following keywords is used to refer base class constructor to subclass constructor?

  • this
  • static
  • base
  • extend