C#.NET Multiple choices


Total available count: 28
Subject - Microsoft Technologies
Subsubject - C#.NET

Creating a static class is the same as creating _______


 

 

 

 



C


Solution:-

In C#, static means something which cannot be instantiated. You cannot access static members and cannot create an object of a static class using an object. C# classes, methods, properties, operators, variables, events, and constructors can be defined as static and creating a class using the static modifier keyword.

Creating a static class is therefore basically the same as creating a class that contains only static members and a private constructor. A private constructor prevents the class from being instantiated.




Next 5 multiple choice(s)

1

By default interface methods are?

2

What will be the output of the below?

class BaseClass
{
  public void Slightbook()
  {
     Console.WriteLine("SlightBook questions");
  }
}
class DerivedClass:BaseClass
{
  public void Slightbook()
  {
     Console.WriteLine("SlightBook choices");
  }
}
class program
{
  static void Main(string[] args)
  {
     BaseClass bd = new DerivedClass();
     bd.Slightbook();
  }
}

 

3

Which of the following is correct about the below declaration?

public class A
{
     public virtual void Slightbook(){}
}
public class B:A
{
     public sealed override void Slightbook(){}
}

 

4

Which of the following field cannot be virtual?

5

What is the use of a new keyword in polymorphism?

Comments