Showing only the essential features of an object to the user while hiding its internal details is known as
- A.Abstraction
- B.Encapsulation
- C.Inheritance
- D.Instantiation
Correct answer
Explanation
The correct answer is A, Abstraction. Abstraction presents only what the user needs, such as the accelerator and brake of a car, and keeps the internal working out of sight; in C++ it is obtained through abstract classes with pure virtual functions and in Java through interfaces and abstract classes. Option B is wrong because encapsulation is the packing of data and methods into one unit with the data kept private; abstraction is about what is shown, encapsulation about how it is held together. Option C is wrong because inheritance is the acquisition of the features of a base class by a derived class. Option D is wrong because instantiation simply means creating an object from a class. In a paper the clue words are hiding implementation details for abstraction and binding data with functions for encapsulation.
Read the full article: Object-Oriented Programming: Classes, Objects and Pillars
Practice Questions
View allWhich of the following is regarded as the first object-oriented programming language?
- A.Simula 67
- B.FORTRAN
- C.COBOL
- D.BASIC
Show answer
Simula 67, designed by Ole-Johan Dahl and Kristen Nygaard, introduced the ideas of class, object and inheritance and is therefore treated as the first object-oriented language, from which C++ and Java later borrowed.
Read the full explanation →Which of the following is NOT counted among the four basic features of object-oriented programming?
- A.Abstraction
- B.Inheritance
- C.Recursion
- D.Polymorphism
Show answer
Recursion is a general programming technique in which a function calls itself, and it works equally well in procedural languages such as C, so it is not a feature of the object-oriented approach.
Read the full explanation →Wrapping up of data and the functions that operate on that data into a single unit is called
- A.Inheritance
- B.Encapsulation
- C.Overloading
- D.Compilation
Show answer
Encapsulation means binding the data members and the member functions that act on them inside one unit, the class, and keeping the data private so that it can be reached only through the methods provided; the standard illustration is a capsule holding the medicine inside it.
Read the full explanation →Who developed the C++ programming language?
- A.Dennis Ritchie
- B.James Gosling
- C.Bjarne Stroustrup
- D.Guido van Rossum
Show answer
Bjarne Stroustrup developed the language at Bell Laboratories, starting it as C with Classes and giving it the name C++ in 1983; it adds classes, inheritance and polymorphism to C while keeping C procedural power, which is why it is called a hybrid language.
Read the full explanation →The Java programming language was developed at Sun Microsystems under the leadership of
- A.Alan Kay
- B.James Gosling
- C.Anders Hejlsberg
- D.Ken Thompson
Show answer
James Gosling and his team at Sun Microsystems developed Java, which was first called Oak and was released under the name Java in 1995; its programs are compiled to bytecode and run on the Java Virtual Machine, which makes them platform independent.
Read the full explanation →