.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Ava Aiden
Imran Ghani
Thomas Shaw


Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.


Post New Question Subscribe to Interview Questions
 
Quick Links For Interview Questions Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  OOPs  JQuery  JavaScript/VBScript
BiztalkPatten/PracticesIISWCFWPFWWF
NetworkingAptitudeOthers  All    
 

OOPS Interview Questions and Answers

What is the difference between abstract class and interface?

Author: ASPEvil          Posted Date: January 30, 2017    Category: OOPS     Points: 40

1) Abstract class can have abstract and non-abstract methods.Interface can have only abstract methods.

2) Abstract class doesn't support multiple inheritance.Interface supports multiple inheritance.

3) Abstract class can have final, non-final, static and non-static variables.Interface has only static and final variables.

4) Abstract class can have static methods, main method and constructor.Interface can't have static methods, main method or constructor.

5) Abstract class can provide the implementation of interface.Interface can't provide the implementation of abstract class.

6) The abstract keyword is used to declare abstract class.The interface keyword is used to declare interface.

7) Example for abstract class:
public abstract class Pencil{
public abstract void Draw();
}
Example for interface class:
public interface Drawing{
void Draw();
}

What is encapsulation?

Author: Subhransu Sekhar Jena          Posted Date: October 31, 2014    Category: OOPS     Points: 40

Encapsulation is the ability to contain and control access to a group of associated items. Classes provide one of the most common ways to encapsulate items. Encapsulation allows you to control how the data and procedures are used. You can use access modifiers, such as Private or Protected, to prevent outside procedures from executing class methods or reading and modifying data in properties and fields. You should declare internal details of a class as Private to prevent them from being used outside of your class; this technique is called data hiding.One basic rule of encapsulation is that class data should be modified or retrieved only via Property procedures or methods. Hiding the implementation details of your classes prevents classes from being used in undesired ways, and lets you to later modify such items without risk of compatibility problems.

How will you create objects?

Author: Subhransu Sekhar Jena          Posted Date: October 31, 2014    Category: OOPS     Points: 40

A class defines a type of object, but it is not an object itself. An object is a concrete entity based on a class, and is sometimes referred to as an instance of a class.
Objects can be created by using the new keyword followed by the name of the class that the object will be based on, like this:
Customer object1 = new Customer();
When an instance of a class is created, a reference to the object is passed back to the programmer.

What is the difference between class and object?

Author: Subhransu Sekhar Jena          Posted Date: October 31, 2014    Category: OOPS     Points: 40

Classes describe the structure of objects, while objects are usable instances of classes. Each instance is an exact yet distinct copy of its class. Because an object is an instance of a class, the act of creating an object is called instantiation.
Usually, changing the data in one object does not change the data in any other object.

What is Class?

Author: Subhransu Sekhar Jena          Posted Date: October 31, 2014    Category: OOPS     Points: 40

Classes are symbolic representations of objects; classes describe the properties, fields, methods, and events that form objects. Classes control user access to object items through encapsulation.
a class defines the data and behavior of the data type. Programmers can then create objects that are instances of this class.
Classes have the following properties:
· a class can inherit implementation from only one base class.
· A class can implement more than one interface.
· Class definitions can be split between different source files.
· Static classes are sealed classes that contain only static methods.

What is Object?

Author: Subhransu Sekhar Jena          Posted Date: October 31, 2014    Category: OOPS     Points: 40

Objects are programming constructs that have data, behavior, and identity. Object data is contained in the fields, properties, and events of the object, and object behaviors are defined by the methods and interfaces of the object.
Objects have identity - two objects with the same set of data are not necessarily the same object.
Objects in C# are defined through classes and structs - these form the single blueprint from which all objects of that type operate.
Objects have the following properties:
· Everything you use in C# is an object, including Windows Forms and controls.
· Objects are instantiated; that is, they are created from templates defined by classes and structs.
· Objects use Properties to obtain and change the information they contain.
· Objects often have methods and events that allow them to perform actions.
· All C# objects inherit from the Object.

Can we declare an Abstract method in non-abstract class?

Author: Subhransu Sekhar Jena          Posted Date: September 26, 2014    Category: OOPS     Points: 40

NO

How many Access Modifiers in JAVA?

Author: Daniel Bhagathsingh          Posted Date: December 18, 2013    Category: OOPS     Points: 40

It's having Three Access Modifiers.
1.Private
2.Public
3.Protected

What are the various types of constructors?

Author: Bhumika Patel          Posted Date: March 07, 2013    Category: OOPS     Points: 40



There are three various types of constructors , and they are as follows:.

- Default Constructor - With no parameters.

- Parametric Constructor - With Parameters. Create a new instance of a class and also passing arguments simultaneously.

- Copy Constructor - Which creates a new object as a copy of an existing object.


What is the difference between Object and Instance?

Author: Narayanan          Posted Date: February 28, 2013    Category: OOPS     Points: 40

An instance of a user-defined type is called an object. We can instantiate many objects from one class.
An object is an instance of a class.

« Previous12345Next »



Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend