SlideShare une entreprise Scribd logo
1  sur  6
Frequently asked questions in Interview on Object Oriented Programming (OOP)



For More Details on .Net Interview Questions and Answers Please visit : http://www.questpond.com

     1. What is an Object in OOPS?

An object is a software bundle of variables and related methods. Objects are related to real life scenario.
Class is the general thing and object is the specialization of general thingObjects is instance of classes.



Declaration of an Object in OOPs

ClassName objectName=new ClassName();

E.g.: Person objPerson= new Person();



An object is characterized by concepts like:

•        Attribute

•        Behavior

•        Identity




2.       What is an Attribute in OOPs?

     •   Attributes define the characteristics of a class.

     •   The set of values of an attribute of a particular object is called its state.

     •   In Class Program attribute can be a string or it can be a integer
3.       What is a Behavior in OOPS?

     •   Every object has behavior

     •   In C#, behaviors of objects are written in methods.

     •   If a behavior of an object needs to be performed, then the corresponding method is called.




4.       What is an Identity in OOPS?

     •   Each time an object is created the object identity is been defined.

     •   This identity is usually created using an identifier which is derived from the type of item



5.       What is Encapsulation in OOPS?

     •   Encapsulation is one of the fundamental principles of object-oriented programming.

     •   Encapsulation is a process of hiding all the internal details of an object from the outside world

     •   Encapsulation is the ability to hide its data and methods from outside the world and only expose
         data and methods that are required

     •   Encapsulation is a protective barrier that prevents the code and data being randomly accessed
         by other code or by outside the class

     •   Encapsulation gives us maintainability, flexibility and extensibility to our code.

     •   Encapsulation makes implementation inaccessible to other parts of the program and protect
         from whatever actions might be taken outside the function or class.

     •   Encapsulation provides a way to protect data from accidental corruption

     •   Encapsulation hides information within an object

     •   Encapsulation is the technique or process of making the fields in a class private and providing
         access to the fields using public methods
•   Encapsulation gives you the ability to validate the values before the object user change or obtain
         the value

     •   Encapsulation allows us to create a "black box" and protects an objects internal state from
         corruption by its clients.




There are two ways to create a validation process.

1.       Using Assessors and Mutators

2.       Using properties



Benefits of Encapsulation

     •   In Encapsulation fields of a class can be read-only or can be write-only

     •   A class can have control over in its fields

     •   A class can change data type of its fields anytime but users of this class do not need to change
         any code




6. What is Inheritance in OOPS?

     •       Inheritance, together with encapsulation and polymorphism, is one of the three primary
             characteristics (concept) of object-oriented programming

     •       Inheritance enables you to create new classes that reuse, extend, and modify the behavior
             that is defined in other classes

     •       The Class whose methods and variables are defined is called super class or base class

     •       The Class that inherits methods and variables are defined is called sub class or derived class

     •       Sometimes base class known as generalized class and derived class known as specialized
             class
•       Keyword to declare inheritance is “:” (colon) in visual c#



Benefits of using Inheritance

    •       Once a behavior (method) or property is defined in a super class(base class),that behavior
            or property is automatically inherited by all subclasses (derived class).

    •       Code reusability increased through inheritance

    •       Inheritance provide a clear model structure which is easy to understand without much
            complexity

    •       Using inheritance, classes become grouped together in a hierarchical tree structure

    •       Code are easy to manage and divided into parent and child classes




7. What is Polymorphism in OOPS?



    •       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.



Types of Polymorphism

    •       Compile time Polymorphism

    •       Run time Polymorphism
8. What is Compile Time Polymorphism in OOPS?

    •       Compile time Polymorphism also known as method overloading

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



9. What is Run Time Polymorphism in OOPS?

    •       Run time Polymorphism also known as method overriding

    •       Method overriding means having two or more methods with the same name , same
            signature but with different implementation




10. What is Access Modifier in OOPS?

Access modifiers determine the extent to which a variable or method can be accessed from another
class or object



The following five accessibility levels can be specified using the access modifiers

    •           Private

    •           Protected

    •           Internal

    •           Protected internal

    •           Public
Questpond - Top 10 Interview Questions and Answers on OOPS

Contenu connexe

Tendances (20)

Encapsulation
EncapsulationEncapsulation
Encapsulation
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
What is oops concept in java?
What is oops concept in java?What is oops concept in java?
What is oops concept in java?
 
01 introduction to oop and java
01 introduction to oop and java01 introduction to oop and java
01 introduction to oop and java
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - Encapsulation
 
Oops (inheritance&interface)
Oops (inheritance&interface)Oops (inheritance&interface)
Oops (inheritance&interface)
 
Java ppt
Java pptJava ppt
Java ppt
 
Object oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh UpadhyayObject oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh Upadhyay
 
Oopsinphp
OopsinphpOopsinphp
Oopsinphp
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
 
Course outline [csc241 object oriented programming]
Course outline [csc241 object oriented programming]Course outline [csc241 object oriented programming]
Course outline [csc241 object oriented programming]
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
OOP Java
OOP JavaOOP Java
OOP Java
 

Similaire à Questpond - Top 10 Interview Questions and Answers on OOPS

Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP conceptsAhmed Farag
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programmingAmar Jukuntla
 
AkhileshD_Presentation_Core_Java_OOPs.pptx
AkhileshD_Presentation_Core_Java_OOPs.pptxAkhileshD_Presentation_Core_Java_OOPs.pptx
AkhileshD_Presentation_Core_Java_OOPs.pptxAkhilesh740777
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSkillwise Group
 
Features of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptxFeatures of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptxSwagatoBiswas
 
Core java lessons
Core java lessonsCore java lessons
Core java lessonsvivek shah
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oopcolleges
 
Object oriented programming 6 oop with c++
Object oriented programming 6  oop with c++Object oriented programming 6  oop with c++
Object oriented programming 6 oop with c++Vaibhav Khanna
 
Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners Vibhawa Nirmal
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingVasilios Kuznos
 
What is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptxWhat is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptxhreempandya
 
Lesson 1 - Object Oriented Programming CPP103.pptx
Lesson 1 - Object Oriented Programming CPP103.pptxLesson 1 - Object Oriented Programming CPP103.pptx
Lesson 1 - Object Oriented Programming CPP103.pptxLuiFlor
 

Similaire à Questpond - Top 10 Interview Questions and Answers on OOPS (20)

Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
 
AkhileshD_Presentation_Core_Java_OOPs.pptx
AkhileshD_Presentation_Core_Java_OOPs.pptxAkhileshD_Presentation_Core_Java_OOPs.pptx
AkhileshD_Presentation_Core_Java_OOPs.pptx
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
oop.pptx
oop.pptxoop.pptx
oop.pptx
 
Basic concepts of oops
Basic concepts of oopsBasic concepts of oops
Basic concepts of oops
 
Features of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptxFeatures of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptx
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
Object oriented programming 6 oop with c++
Object oriented programming 6  oop with c++Object oriented programming 6  oop with c++
Object oriented programming 6 oop with c++
 
Introduction
IntroductionIntroduction
Introduction
 
Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
java - oop's in depth journey
java - oop's in depth journeyjava - oop's in depth journey
java - oop's in depth journey
 
What is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptxWhat is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptx
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
Lesson 1 - Object Oriented Programming CPP103.pptx
Lesson 1 - Object Oriented Programming CPP103.pptxLesson 1 - Object Oriented Programming CPP103.pptx
Lesson 1 - Object Oriented Programming CPP103.pptx
 

Dernier

VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...Suhani Kapoor
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girlsshivangimorya083
 
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士obuhobo
 
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...Suhani Kapoor
 
The Impact of Socioeconomic Status on Education.pdf
The Impact of Socioeconomic Status on Education.pdfThe Impact of Socioeconomic Status on Education.pdf
The Impact of Socioeconomic Status on Education.pdftheknowledgereview1
 
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service CuttackVIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service CuttackSuhani Kapoor
 
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...Suhani Kapoor
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceSanjay Bokadia
 
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service CuttackLow Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service CuttackSuhani Kapoor
 
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call GirlsSonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call GirlsNiya Khan
 
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...Suhani Kapoor
 
OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理cowagem
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceanilsa9823
 
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证obuhobo
 
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service BhiwandiVIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service BhiwandiSuhani Kapoor
 
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Zeeman Effect normal and Anomalous zeeman effect
Zeeman Effect normal and Anomalous zeeman effectZeeman Effect normal and Anomalous zeeman effect
Zeeman Effect normal and Anomalous zeeman effectPriyanshuRawat56
 
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
Call Girl in Low Price Delhi Punjabi Bagh  9711199012Call Girl in Low Price Delhi Punjabi Bagh  9711199012
Call Girl in Low Price Delhi Punjabi Bagh 9711199012sapnasaifi408
 
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...Call Girls in Nagpur High Profile
 

Dernier (20)

Call Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
Call Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCeCall Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
Call Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
 
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
 
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
 
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
 
The Impact of Socioeconomic Status on Education.pdf
The Impact of Socioeconomic Status on Education.pdfThe Impact of Socioeconomic Status on Education.pdf
The Impact of Socioeconomic Status on Education.pdf
 
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service CuttackVIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
 
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector Experience
 
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service CuttackLow Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
 
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call GirlsSonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
 
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
 
OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
 
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
 
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service BhiwandiVIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
 
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Zeeman Effect normal and Anomalous zeeman effect
Zeeman Effect normal and Anomalous zeeman effectZeeman Effect normal and Anomalous zeeman effect
Zeeman Effect normal and Anomalous zeeman effect
 
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
Call Girl in Low Price Delhi Punjabi Bagh  9711199012Call Girl in Low Price Delhi Punjabi Bagh  9711199012
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
 
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
 

Questpond - Top 10 Interview Questions and Answers on OOPS

  • 1. Frequently asked questions in Interview on Object Oriented Programming (OOP) For More Details on .Net Interview Questions and Answers Please visit : http://www.questpond.com 1. What is an Object in OOPS? An object is a software bundle of variables and related methods. Objects are related to real life scenario. Class is the general thing and object is the specialization of general thingObjects is instance of classes. Declaration of an Object in OOPs ClassName objectName=new ClassName(); E.g.: Person objPerson= new Person(); An object is characterized by concepts like: • Attribute • Behavior • Identity 2. What is an Attribute in OOPs? • Attributes define the characteristics of a class. • The set of values of an attribute of a particular object is called its state. • In Class Program attribute can be a string or it can be a integer
  • 2. 3. What is a Behavior in OOPS? • Every object has behavior • In C#, behaviors of objects are written in methods. • If a behavior of an object needs to be performed, then the corresponding method is called. 4. What is an Identity in OOPS? • Each time an object is created the object identity is been defined. • This identity is usually created using an identifier which is derived from the type of item 5. What is Encapsulation in OOPS? • Encapsulation is one of the fundamental principles of object-oriented programming. • Encapsulation is a process of hiding all the internal details of an object from the outside world • Encapsulation is the ability to hide its data and methods from outside the world and only expose data and methods that are required • Encapsulation is a protective barrier that prevents the code and data being randomly accessed by other code or by outside the class • Encapsulation gives us maintainability, flexibility and extensibility to our code. • Encapsulation makes implementation inaccessible to other parts of the program and protect from whatever actions might be taken outside the function or class. • Encapsulation provides a way to protect data from accidental corruption • Encapsulation hides information within an object • Encapsulation is the technique or process of making the fields in a class private and providing access to the fields using public methods
  • 3. Encapsulation gives you the ability to validate the values before the object user change or obtain the value • Encapsulation allows us to create a "black box" and protects an objects internal state from corruption by its clients. There are two ways to create a validation process. 1. Using Assessors and Mutators 2. Using properties Benefits of Encapsulation • In Encapsulation fields of a class can be read-only or can be write-only • A class can have control over in its fields • A class can change data type of its fields anytime but users of this class do not need to change any code 6. What is Inheritance in OOPS? • Inheritance, together with encapsulation and polymorphism, is one of the three primary characteristics (concept) of object-oriented programming • Inheritance enables you to create new classes that reuse, extend, and modify the behavior that is defined in other classes • The Class whose methods and variables are defined is called super class or base class • The Class that inherits methods and variables are defined is called sub class or derived class • Sometimes base class known as generalized class and derived class known as specialized class
  • 4. Keyword to declare inheritance is “:” (colon) in visual c# Benefits of using Inheritance • Once a behavior (method) or property is defined in a super class(base class),that behavior or property is automatically inherited by all subclasses (derived class). • Code reusability increased through inheritance • Inheritance provide a clear model structure which is easy to understand without much complexity • Using inheritance, classes become grouped together in a hierarchical tree structure • Code are easy to manage and divided into parent and child classes 7. What is Polymorphism in OOPS? • 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. Types of Polymorphism • Compile time Polymorphism • Run time Polymorphism
  • 5. 8. What is Compile Time Polymorphism in OOPS? • Compile time Polymorphism also known as method overloading • Method overloading means having two or more methods with the same name but with different signatures 9. What is Run Time Polymorphism in OOPS? • Run time Polymorphism also known as method overriding • Method overriding means having two or more methods with the same name , same signature but with different implementation 10. What is Access Modifier in OOPS? Access modifiers determine the extent to which a variable or method can be accessed from another class or object The following five accessibility levels can be specified using the access modifiers • Private • Protected • Internal • Protected internal • Public