C#.NET Multiple choices


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

By default interface methods are?


 

 

 

 



B


Solution:-

Interfaces declared directly within a namespace can be public or internal and, just like classes and structs, interfaces default to internal access. Interface members are public by default because the purpose of an interface is to enable other types to access a class or struct.

// interface
interface SlightBook
{
 void SlightBookCourse(); // interface method (does not have a body)
 void run(); // interface method (does not have a body)
}

The C# syntax for an interface is extended to accept the protected, internal, public, and virtual keywords. By default, the default interface methods are virtual unless the sealed or private modifier is used. Similarly, an abstract is a default on interface members without bodies.




Next 5 multiple choice(s)

1

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();
  }
}

 

2

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(){}
}

 

3

Which of the following field cannot be virtual?

4

What is the use of a new keyword in polymorphism?

5

Which of the below is not a built-in delegate?

Comments