This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes OOP Concepts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "OOP Concepts" Watch "OOP Concepts" New topic
Author

OOP Concepts

Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 261

hello friends,
i am pretty much confused between all the oop terms.it's my humble request to explain and make my oop concepts clear.

1.What is difference between encapsulation,abstraction,data hiding,data binding??

I have OOP test tommorrow.
I am requesting all of you to please answer the following questions:-

If the question comes like this
2.The design of classes in the way that hides the details of implementation details from the user is:-
1.Encapsulation
2.Information Hiding
3.Data Abstraction
4.All of the above.
then what should be the answer??

The Object Oriented Technology's __________ Concept means that a small change in users's requirement should not require large changes to be made to the system:-
1.Abstraction
2.Modularity
3.Encapsulation
4.Modeling.


PANKAJ SHET
B.Sc.(I.T.), S.C.J.P., S.C.W.C.D., PGDAC(CDAC)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Good luck with the test, but Do Your Own Homework. You will remember far better if you suggest your answers and we'll see whether we agree.
Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 261

my answer to the 2 above questions will be
1.Encapsulation first question

but i have read a clear statement that Encapsulation implies Information Hiding,so i m still confused.

and

2.Abstraction for the second question.

but then again i have read a clear statement that Abstaction hides the non essential data from the user.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14278
    
  21

Pankaj, if you copy a question from a book, website or other source, we require that you quote your sources.

So, please tell us where you got this question from.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 261

i have these question in a Question Bank given by our College proffessors..
i have it on my desktop.. i can't even copy the whole Question Bank for the security reasons.
and as far as the anwers are concerned, these same questions have different answers in my qustion bank..
same dito question is asked at 3 different places with 3 different answers,when asked to them about the same, they also get confused and make me confused.

but still i can give the link where this question is asked..
some of such confusing questions

it consits of C,C++,and OOPs Concepts,this question is asked here..:-
refer to Q29,Q39
[URL]http://examblast.com/c-multiple-choice-question/index.html[URL]

there are total 39 questions of which such confusing questions have been left unanswered.

i tried to solve all these 39 questions, but was unable to solve some of such questions.

I will be really thankful if i get these doubts solved..

and if i get to know the difference between:
Abstraction,Encapsulation,Data Hiding and Data Binding


-thanks a lot
Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 261

Sir,
There ten questions on which i have doubts.
Those questions and my answers are given ahead.
please give me the right solution for the same.
According to me the answers are :-

Data Hiding: Data Hiding the Hiding data(instavce variables) and making them private and accessible through only methods

Encapsulation: Encapsulation refers to the bundling of data with the methods that operate on that data (Logically same as Data Hiding)

Abstraction : Data Abstraction the hiding implemetation details from outside environment

Data Binding : Data Binding is used in XMLs. data binding refers to the process of representing the information in an XML document as an object in computer memory




1.The design of classes in the way that hides the details of implementation details from the user is:-
1.Encapsulation
2.Information Hiding (Answer)
3.Data Abstraction
4.All of the above.


But then Encapsulation implies information hiding??
according to answer 6, it should be Encapsulation as well as Info hiding??
What if i have to select one of them??

2.The Object Oriented Technology's __________ Concept means that a small change in users's requirement should not require large changes to be made to the system:-

1.Abstraction (Answer)
2.Modularity
3.Encapsulation
4.Modeling.
According to me this concept is of low coupling or modelling??

3.The Abilitity to reuse objects already defined ,perhaps for a different purpose with modification appropriate to the new purpose is
referred to as ___________:-
1.Information Hiding
2.Inheritance (Answer)
3.Redefination
4.Overloading


4.___________ means that both data and methods which may access it are defined together in the same unit:-
1.Data Hiding
2.Encapsulation (Answer)
3.Data Binding
4.none of the above

5.The term given to the process of hiding all details of an object that do not contribute to its essential characteristics is called ________:-
1.Data Hiding (Answer)
2.Packaging
3.Encapsulation
4.Grouping

6.Encapsulation is:-
1.Information hiding
2.Data binding
3.Both (Answer)
4.None

But then for 4 question, answer should be all the three??

7.The Object Oriented technology's use of_______ facilitates the reuse of code and architecture and its _______ feature provides system with stability as a small change in requirements does not require massive change in systems:-
1.encapsulation,inheritance
2.inheritance,polymorphism (Answer)
3.inheritance,encapsulation
4.polymorphism,abstraction

According to Q3 and Q2, the respective answers to both the blanks should be inheritance and abstraction??

8.OOP allows for extension of object function or class function,this ability within OOP is called __________:-
1.Extensibility (Answer)
2.Expansion capacity
3.Virtual Expansion
4.Scalability


9.The ability to send a common message to different classes and for each subclass object to respond to the message in a manner appropriate to it's own properties is called __________:-
1.Adaptability
2.Expansion Capacity
3.Virtual Extension (Answer)
4.Scalability.

10.An ___________ denotes Essential Characteristics of objects that distinguishes it from all other kinds of Objects.:-
1.Aggregation.
2.Abstraction. (Answer)
3.Modularity.
4.None of the above.




Thanks a Lot,
-Pankaj Shet.
[ June 19, 2008: Message edited by: Campbell Ritchie ]
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2563
    
    9

I must say interesting questions your college prof gave. Anyway in my view OOP concepts are really encapsulation, abstraction, inheritance, and polymorphism. If you have some OOP practice that you should able to define these 4 terms fairly easy.

As for how say data/info hiding, is it same as encapsulation/abstraction it depends. As long as you use the "private" keyword in declaring "instance variables" (inside class outside methods) I personally consider that I have encapsulate the data (eg data hiding). If I add an interface file declaring all the methods then a class implements that interface then its abstraction and encapsulation.

Another way to look at abstraction is abstract classes similar to interfaces but need to extends it and make all abstract methods concrete ... hence inheritance (also mean subclassing). And finally polymorphism is many forms of one thing/object eg a set can be created as TreeSet or HashSet. So polymorphism can be considered as reuse.

Hope this clears some concepts for you


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
I think those are simple questions about learning nomenclature; it is probably worthwhile going to Wikipedia and looking what it says about "encapsulation," "data hiding," etc. For "abstraction" make sure to find the object-oriented bit, because "abstraction" means different things in different contexts.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
How did your test go?

BTW: Please use the buttons below the message window rather than writing them by hand. It's quicker, and ensures correct tags. I have corrected your tags, and you can see how much better it looks.
[ June 19, 2008: Message edited by: Campbell Ritchie ]
Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 261

my test is postponed to 21st june.
it fortunately did not happen.
please clear the confusion sir i went through it but was not able to get the correct answers for the same?
alongwith those questions, i have written the doubts in context with the other questions.
also, i feel the remaining questions under which i did not ask you any doubts,
are correctly answered.
[ June 19, 2008: Message edited by: Pankaj Shet ]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
You will have to do some revision, I am afraid. If I were teaching, I wouldn't have set those questions, but I'm not . . .

If you set a MCQ like that, you need to make sure that one answer is correct and all the other possible answers are definitely incorrect. I presume those questions are simply revision exercisees to give you a taste of what the exam will be like. You are sure you have copied them correctly?

What you say about no 4 is correct; all 3 are potential answers, but encapsulation seems to me the best answer.

I am reasonably happy with your answers to 3 4 5 8 10, and I don't understand no 9. If that is what your test is going to be like, make sure to go through your books or Wikipedia.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OOP Concepts