ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  Dot Net  >>  Dot Net AllOther
 
 


 

 
 Dot Net Framework interview questions  Dot Net Framework Interview Questions
 Dot Net Remoting interview questions  Dot Net Remoting Interview Questions
 Dot Net WindowsForms interview questions  Dot Net WindowsForms Interview Questions
 Dot Net General interview questions  Dot Net General Interview Questions
 Dot Net AllOther interview questions  Dot Net AllOther Interview Questions
Question
Difference between abstract class and interface
 Question Submitted By :: Nitin
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Difference between abstract class and interface
Answer
# 1
Abstract classes can have implementations for some of its 
members (Methods), but the inteface class can't have 
implementation for any of its members.
 
Is This Answer Correct ?    255 Yes 45 No
Shilpa
 
  Re: Difference between abstract class and interface
Answer
# 2
1) Abstract class defines few or none of the methods, but 
interface defines all the methods..
2) Abstract classes should have subclasses else that will 
be useless..
Interfaces must have implementations by other classes else 
that will be useless
3)only an interface can extend another interface, but any 
class can extend an abstract class..
4)All variable in interfaces are final by default
 
Is This Answer Correct ?    105 Yes 95 No
Brgkkc
[Evb]
 
 
 
  Re: Difference between abstract class and interface
Answer
# 3
Interfaces provide a form of multiple inheritance. A class 
can extend only one other class. 
Interfaces are limited to public methods and constants with 
no implementation. Abstract classes can have a partial 
implementation, protected parts, static methods, etc. 
A Class may implement several interfaces. But in case of 
abstract class, a class may extend only one abstract class. 
Interfaces are slow as it requires extra indirection to to 
find corresponding method in in the actual class. Abstract 
classes are fast.
 
Is This Answer Correct ?    92 Yes 16 No
Maneswari
 
  Re: Difference between abstract class and interface
Answer
# 4
in Abstract Class atleast one method is undefined where as 
in interface all method is undefined
 
Is This Answer Correct ?    67 Yes 47 No
Vinay Tiwari
 
  Re: Difference between abstract class and interface
Answer
# 5
1. Accessibility modifier(Public/Private/internal) is 
allowed for abstract class.
Interface doesn't allow accessibility modifier

2. class can inherit only one abstract class
class can implement more than one interface.
 
Is This Answer Correct ?    82 Yes 20 No
Nikhil
 
  Re: Difference between abstract class and interface
Answer
# 6
Interface: 1)In case if interface it is one contract.The 
functions which we define functions we have to make 
implements in body.
            2)It can come in inheritance chain

Abstract Class:1) In case of Abstract class we have to use 
keyword that is"Mustinherit".
               2)In that this is not come in inheritance 
chain
 
Is This Answer Correct ?    20 Yes 44 No
Versha
 
  Re: Difference between abstract class and interface
Answer
# 7
Abstract classes can have implementations for some of its 
members (Methods), but the inteface class can't have 
implementation for any of its members
 
Is This Answer Correct ?    56 Yes 10 No
Karthik
 
  Re: Difference between abstract class and interface
Answer
# 8
(1)       An abstract class may contain complete or 
incomplete methods. Interfaces can contain only the 
signature of a method but no body. Thus an abstract class 
can implement methods but an interface can not implement 
methods.
(2)         An abstract class can contain fields, 
constructors, or destructors and implement properties. An 
interface can not contain fields, constructors, or 
destructors and it has only the property's signature but no 
implementation.
(3)         An abstract class cannot support multiple 
inheritance, but an interface can support multiple 
inheritance. Thus a class may inherit several interfaces 
but only one abstract class.
(4)         A class implementing an interface has to 
implement all the methods of the interface, but the same is 
not required in the case of an abstract Class.
(5)       Various access modifiers such as abstract, 
protected, internal, public, virtual, etc. are useful in 
abstract Classes but not in interfaces. 
(6)         Abstract classes are faster than interfaces.
 
Is This Answer Correct ?    125 Yes 12 No
Arjunrao
 
  Re: Difference between abstract class and interface
Answer
# 9
1) Abstract class is must inheritable & its scope is upto 
derived class

2) Interface is must implementable & its scope is upto any 
level of its inheritence chain.
 
Is This Answer Correct ?    33 Yes 9 No
Ramana
 
  Re: Difference between abstract class and interface
Answer
# 10
1. Interface comes in Inheritance chain while Abstract not
2. One class can inherit muliple interface but it can't 
inerit mulitple abstract class
3. Abstract class can have concert method but interface 
can't.
4.An abstract class can contain fields, constructors, or 
destructors and implement properties. An interface can not 
contain fields, constructors, or destructors and it has 
only the property's signature but no implementation.
5.Abstract classes are faster than interfaces.
 
Is This Answer Correct ?    23 Yes 3 No
Chetan S
 
  Re: Difference between abstract class and interface
Answer
# 11
Both are same in functionality...
 
Is This Answer Correct ?    10 Yes 96 No
Santhosh
 
  Re: Difference between abstract class and interface
Answer
# 12
(1)       An abstract class may contain complete or 
incomplete methods. Interfaces can contain only the 
signature of a method but no body. Thus an abstract class 
can implement methods but an interface can not implement 
methods.
(2)         An abstract class can contain fields, 
constructors, or destructors and implement properties. An 
interface can not contain fields, constructors, or 
destructors and it has only the property's signature but no 
implementation.
(3)         An abstract class cannot support multiple 
inheritance, but an interface can support multiple 
inheritance. Thus a class may inherit several interfaces 
but only one abstract class.
(4)         A class implementing an interface has to 
implement all the methods of the interface, but the same is 
not required in the case of an abstract Class.
(5)       Various access modifiers such as abstract, 
protected, internal, public, virtual, etc. are useful in 
abstract Classes but not in interfaces. 
(6)         Abstract classes are faster than interfaces
 
Is This Answer Correct ?    28 Yes 3 No
Rubeena
 
  Re: Difference between abstract class and interface
Answer
# 13
Interfaces have only declarations of methods but abstract 
classes can also have implementations of some methods.
 
Is This Answer Correct ?    32 Yes 2 No
Priyanka
 
  Re: Difference between abstract class and interface
Answer
# 14
Abstract class defined with methods. Interface will declare 
only the methods. Abstract classes are very much useful 
when there is a some functionality across various classes. 
Interfaces are well suited for the classes which varies in 
functionality but with the same method signatures.
 
Is This Answer Correct ?    15 Yes 2 No
Aninda Bhattacharyya
 
  Re: Difference between abstract class and interface
Answer
# 15
a) Interface force class to implement all methods and 
function for implement while as Abstarct class does not 
force class , you can override method and fuction of base 
class .                                                   
b) Interface contains method and function without 
implemention with signature only while as Abstract class 
contains method , function with implemention and signature  
c) By default , method ,function and members is public in 
nature within interface , while as In Abstract class , 
memebers can be protected as well private etc..            
d) Interface supports Multiple inheritance while as 
Abstract class does not support Multiple Inheritance       
e)Abstract classes are faster than interfaces               
f)you can prevent not required method to override in 
Abstract class , but not in Interface
 
Is This Answer Correct ?    10 Yes 1 No
Amit Sinha
 
  Re: Difference between abstract class and interface
Answer
# 16
An Abstract Class can contain default Implementation, where 
as an Interface should not contain any implementation at 
all. An Interface should contain only definitions but no 
implementation. where as an abstract class can contain 
abstract and non-abstract methods. When a class inherits 
from an abstract, the derived class must implement all the 
abstract methods declared in the base class. an abstract 
class can inherit from another non-abstract class.
 
Is This Answer Correct ?    14 Yes 1 No
Mahendra Pratap Singh
 
  Re: Difference between abstract class and interface
Answer
# 17
1.)when a class is said to be Abstract if it contain both
implementation & unimplementation details ie,method with
body(implementation),method with out body(un-implementation).
in a class if any method with out body is said to be
abstract method.then before the class name we should keep
abstract to the class.
2.)An interface is a one which is having un-implementation
details(method with out body),multiple inheritence can be
achieved in java by using interfaces.
 
Is This Answer Correct ?    6 Yes 7 No
Rajesh
 
  Re: Difference between abstract class and interface
Answer
# 18
1.)
abstract class contains the the incomplete data while
interface contains the complete data.

2.)
the new class in necessary to inherit  the abstract class &
give it own body & then it becomes complete  
while in case of interface the new class inherits the
interface ti use it`s data contained.
 
Is This Answer Correct ?    4 Yes 4 No
Uttam
 
  Re: Difference between abstract class and interface
Answer
# 19
* An abstract class can have abstract members as well
non abstract members. But in an interface all the members
are implicitly abstract and all the members of the interface
must override to its derived class

    * The members of the interface are public with no
implementation. Abstract classes can have protected parts,
static methods, etc.

  for more  detailed   main five difference  visit this  link

http://codesforprogrammers.blogspot.com/search/label/Abstract%20class%20vs%20Interface
 
Is This Answer Correct ?    3 Yes 2 No
Max
 
  Re: Difference between abstract class and interface
Answer
# 20
1)We define an Interface in the Java application with a 
set  of abstract methods without any implementation. Which 
means all the methods of an interface are by default 
abstract methods and public methods.
2)Once an Interface is defined in the application then any 
class can implement that interface, in such case the class 
must be implemented with all the mehtods of the respective 
Interface otherwise the class will become as abstract class.
3)A class can implement any no. of interfaces, in such case 
the class must be implimented with all the methods of those 
interfaces otherwise the class will become as abstract class
 
Is This Answer Correct ?    2 Yes 1 No
Shaveen Kaushal
 
  Re: Difference between abstract class and interface
Answer
# 21
a.Abstract classes can inherit interfaces while interfaces 
cannot inherit abstract classes
b.Abstract classes can have implementation within them 
while interfaces cannot contain any code
 
Is This Answer Correct ?    3 Yes 3 No
Subru
 
  Re: Difference between abstract class and interface
Answer
# 22
)We define an Interface in the Java application with a 
set  of abstract methods without any implementation. Which 
means all the methods of an interface are by default 
abstract methods and public methods.
2)Once an Interface is defined in the application then any 
class can implement that interface, in such case the class 
must be implemented with all the mehtods of the respective 
Interface otherwise the class will become as abstract class.
3)A class can implement any no. of interfaces, in such case 
the class must be implimented with all the methods of those 
interfaces otherwise the class will become as abstract class
 
Is This Answer Correct ?    2 Yes 2 No
Niraj Kumar
 
  Re: Difference between abstract class and interface
Answer
# 23
1. Abstract class can have implemented methds
   but interface contains only final varibles and 
   method declaration(signature);

2. In Abstract class there is "IS A " Kind of relationship 
   between abstract class and its implemented method class
   but in interface it can be between any non-relative
   classes.

3. Absrtact class can be extended by only one class;
   Interface can be implemented by more than one class;  
   ie. class can inherit only one abstract class
   but class can implement more than one interface.

4.A class implementing an interface has to 
   implement all the methods of the interface, 
but             the        same     is 
    not required in the case of an abstract Class.

5.Access modifiers (protected, abstract, public, etc. )are 
useful in abstract Classes but not in interfaces.
 
Is This Answer Correct ?    1 Yes 2 No
Thakur Laxmikant
 
  Re: Difference between abstract class and interface
Answer
# 24
An abstract class may or may not have abstract method,but 
it is useless without abstract method ,so an abstract class 
should have atleast single abstract method.
while in case of an interface it is hardcode that an 
interface can have only the abstract methods with it.
 
Is This Answer Correct ?    2 Yes 1 No
Vivek Sharma
 
  Re: Difference between abstract class and interface
Answer
# 25
ABSTRACT CLASS:
1) we can't create object of abstract class.
2) we can declare a variable.
3) we can make normal method and abstract method.
4) we can't make method body with abstract method.
5) in derived class we can use abstract method by override  
    keyword.
6) we can't use multiple inheritance in abstract class.
7) Absrtact class can be extended by only one class;
   Interface can be implemented by more than one class;  
   ie. class can inherit only one abstract class


8)Abstract classes can inherit interfaces while interfaces 
      cannot inherit abstract classes
   but class can implement more than one interface.
9)  The members of the interface are public with no
    implementation. Abstract classes can have protected   
    parts,static methods, etc.

10)An abstract class can contain fields, 
constructors, or destructors and implement properties. An 
interface can not contain fields, constructors, or 
destructors and it has abstractmethod,property's signature 
but no implementation etc.

Rajneesh Hajela
Gwalior(M.P.)
 
Is This Answer Correct ?    4 Yes 1 No
Rajneesh Hajela
 

 
 
 
Other Dot Net AllOther Interview Questions
 
  Question Asked @ Answers
 
which would be the best to use inproc,outproc or sql server Ness-Technologies1
what is ado.net HCL6
what are clr,cls,cts?what is .net framework? Six-Sigma3
what are constructors and destructors Six-Sigma1
what is the difference between asp and asp.net Six-Sigma1
2. What type of code (server or client) is found in a Code-Behind class?  1
What is this DLL hell problem in dotnet? Can a virtual class be created/can a virtual method be created inside the class? HCL2
can any one urls for learning .net(which is written in simple english)  1
what is Difference beetween Array and Hash Table.? Patni5
Explain in-proc,out-proc and sql server. Ness-Technologies3
What is the difference between a web custom control,web user control and a web part. 247Customer1
When should you use Abstract Class vs Interface while programming? Give 1 Example T3-Softwares2
If I'm developing an application that must accomodate multiple security levels though secure login and my ASP.NET web appplication is spanned across three web-servers (using round-robbin load balancing) what would be the best approach to maintain login-in state for the users?  2
what is a required field validation control? Six-Sigma2
What does the "EnableViewState" property do? Why would I want it on or off?  1
how windows applications different from the console applications? Six-Sigma1
what is web service?  1
Hi i need fast track course maximum to complete within a month....courses are Asp.net,c3,vb.net n sql server........at hyderbad location ..best institute n cost Chevron1
Navigation controls in ASP.net,explain each control in brief? Six-Sigma1
does .NET support multiple inheritance ? Ness-Technologies10
 
For more Dot Net AllOther Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com