C#.NET Multiple choices


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

Which of the following interface to be implemented to disponse an object externally?


 

 

 

 



B


Solution:-

IDisposable is an interface that contains a single method, Dispose(), for releasing unmanaged resources, like files, streams, database connections, and so on.

IDisposable is often used to exploit the using statement and take advantage of an easy way to do the deterministic cleanup of managed objects. The purpose of the Dispose pattern is to provide a mechanism to clean up both managed and unmanaged resources and when that occurs depends on how the Dispose method is being called.

IDisposable Interface in C#
~DisposableClass() We can identify it is a destructor method by the symbol ~ (tilde). It is actually converted into a Finalize method because in C# the compiler translates the destructor to a Finalize() method. ...
GC.SuppressFinalize() If the Dispose method is called then there is no need for the Object.




Next 5 multiple choice(s)

1

Creating a static class is the same as creating _______

2

By default interface methods are?

3

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

 

4

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

 

5

Which of the following field cannot be virtual?

Comments