Floating FB popout byF5debug

Interview Questions and Answers on .Net Framework, OOPS, ASP.Net, C#.Net, SQL Server, WCF Series – Part 8


Question 71 - What are the different Access Modifiers available?

  • Public - Access to same assembly or another assembly that references it.
  • Private - Access to same class or struct.
  • Protected - Access to same class or struct, or in a class that is derived.
  • Internal - Access to any code in the same assembly, but not from another assembly.
  • Protected Internal - Access to any code in the assembly in which it is declared, or from within a derived class in another assembly.

Question 72 - What are the differences between Class and Struts?

Class is a reference type Struct is a value type
Class supports inheritance Struct will not support inheritance
Class variables are stored on Heap Struct variables are stored on Stack
Class can have destructor Struct will not have destructor
Boxing a class object creates reference to same object Boxing a strut object will create a copy in diff type
All the members of Class are private by default All the members of struct are public by default
Class is well suited for Data hiding Struts are not suited for Data hiding


Question 73 - What are the Similarities between Class and Struts?

Both are user defined types.

Both of them can have constructor without parameter and with parameter.Both can have delegates and events.Both can have methods, properties , fields, constants , enumerations, events.


Question 74 - What is the term Virtual means?

When we need to override a method of the base class in the sub class, then we give the virtual keyword in the base class method. This makes the method in the base class to be overridable. Methods, properties, and indexers can be virtual, which means that their implementation can be overridden in derived classes. You cannot use the virtual modifier with the following modifiers:

  • Static,
  • Abstract
  • Override

Question 75 - What is a Sealed Class?

  • Sealed classes are used to restrict the inheritance feature of object oriented programming.
  • Once class is defined as sealed class, this class cannot be inherited so we can’t derive class.
  • Keywords: C# - Sealed , VB.NET - NotInheritable
  • If you have ever noticed, struct are sealed. You cannot derive a class from a struct.
  • A sealed class cannot be used as a base class. For this reason, it cannot also be an abstract class.
  • The best usage of sealed classes is when you have a class with static members.
  • Example - The Pens and Brushes classes of the System.Drawing namespace. The Pens class represent the pens for standard colors.
  • This class has only static members. Pens.Blue represents a pen with blue color. Similarly, the Brushes class represents standard brushes.
  • The Brushes.Blue represents a brush with blue color.

Question 76 - What is Polymorphism?

  • Polymorphism is one of the primary characteristics (concept) of object-oriented programming.
  • Poly means many and morph means form. Thus, polymorphism refers to being able to use many forms of a type without regard to the details.
  • Polymorphism is the characteristic of being able to assign a different meaning specifically, to allow an entity such as a variable, a function, or an object to have more than one form.
  • Polymorphism is the ability to process objects differently depending on their data types.
  • Polymorphism is the ability to redefine methods for derived classes.

Question 77 - What are the Types of Polymorphism?

  • Compile time Polymorphism (method overloading)
  • Run time Polymorphism (method overriding)

Question 78 - What is Method Overloading? Or What is Early Binding?

Method overloading means having two or more methods with the same name but with different signatures

Question 79 - What is Method Overriding or What is Late Binding?

Method overriding means having two or more methods with the same name , same signature but with different implementation. (Base class and Child class implementation of a method with same name and signature)

Question 80 - What is an Inheritance?

It is the ability to use all of the functionality of an existing class, and extend those capabilities without re-writing the original class. It is the process by which one object acquires the properties of another object. A new class that is created by inheritance is sometimes called a child class or a subclass. The class you originally inherited from is called the base class, parent class, or the superclass.

Disclaimer – F5debug Interview Questions & Answers Series:

You may recopy extracts from these pages ("the material") to individual third party websites or to any intranet websites, but only if:

You acknowledge www.f5debug.net as the source of the material. Such acknowledgment should include reference to www.f5debug.net in the copy of the material and should also include “© Karthikeyan Anbarasan, www.f5debug.net ".

About Author: Karthikeyan Anbarasan, Microsoft MVP (Most Valuable Professional) in ASP.NET/IIS Architecture. He is the Founder and Chief Editor of the www.f5debug.net website and has authored books on Windows Phone and Business Intelligence(SSIS). He is also a Passionate Speaker and a Blogger on Microsoft Technologies.

You can Join Me On: Facebook, Twitter, Google Plus, LinkedIn

Add comment

  Country flag

  • Comment
  • Preview

Recent Posts

Random Posts

Most Viewed

URL Shortner

Create your own short urls!!!

Site Counter

free counters


This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet. I have documented my personal experience on this blog.

Protected by Copyscape Web Plagiarism Finder

Site Meter