0% found this document useful (0 votes)
40 views4 pages

This Set of Object Oriented Programming Abstraction

Uploaded by

Natanem Yimer
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
40 views4 pages

This Set of Object Oriented Programming Abstraction

Uploaded by

Natanem Yimer
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 4

This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions &

Answers (MCQs) focuses on “Abstraction”.

1. Which among the following best defines abstraction?


a) Hiding the implementation
b) Showing the important data
c) Hiding the important data
d) Hiding the implementation and showing only the features
View Answer
Answer: d
Explanation: It includes hiding the implementation part and showing only the required data
and features to the user. It is done to hide the implementation complexity and details from
the user. And to provide a good interface in programming.
2. Hiding the implementation complexity can ____________
a) Make the programming easy
b) Make the programming complex
c) Provide more number of features
d) Provide better features
View Answer
Answer: a
Explanation: It can make programming easy. The programming need not know how the
inbuilt functions are working but can use those complex functions directly in the program. It
doesn’t provide more number of features or better features.
3. Class is _________ abstraction.
a) Object
b) Logical
c) Real
d) Hypothetical
View Answer
Answer: b
Explanation: Class is logical abstraction because it provides a logical structure for all of its
objects. It gives an overview of the features of an object.
4. Object is ________ abstraction.
a) Object
b) Logical
c) Real
d) Hypothetical
View Answer
Answer: c
Explanation: Object is real abstraction because it actually contains those features of class. It
is the implementation of overview given by class. Hence the class is logical abstraction and
its object is real.
5. Abstraction gives higher degree of ________
a) Class usage
b) Program complexity
c) Idealized interface
d) Unstable interface
View Answer
Answer: c
Explanation: It is to idealize the interface. In this way the programmer can use the
programming features more efficiently and can code better. It can’t increase the program
complexity, as the feature itself is made to hide it.
6. Abstraction can apply to ____________
a) Control and data
b) Only data
c) Only control
d) Classes
View Answer
Answer: a
Explanation: Abstraction applies to both. Control abstraction involves use of subroutines
and control flow abstraction. Data abstraction involves handling pieces of data in meaningful
ways.
7. Which among the following can be viewed as combination of abstraction of data and
code.
a) Class
b) Object
c) Inheritance
d) Interfaces
View Answer
Answer: b
Explanation: Object can be viewed as abstraction of data and code. It uses data members
and their functioning as data abstraction. Code abstraction as use of object of inbuilt class.
8. Abstraction principle includes___________
a) Use abstraction at its minimum
b) Use abstraction to avoid longer codes
c) Use abstraction whenever possible to avoid duplication
d) Use abstraction whenever possible to achieve OOP
View Answer
Answer: c
Explanation: Abstraction principle includes use of abstraction to avoid duplication (usually of
code). It this way the program doesn’t contain any redundant functions and make the
program efficient.
9. Higher the level of abstraction, higher are the details.
a) True
b) False
View Answer
Answer: b
Explanation: Higher the level of abstraction, lower are the details. The best way to
understand this is to consider a whole system that is highest level of abstraction as it hides
everything inside. And next lower level would contain few of the computer components and
so on.
10. Encapsulation and abstraction differ as ____________
a) Binding and Hiding respectively
b) Hiding and Binding respectively
c) Can be used any way
d) Hiding and hiding respectively
View Answer
Answer: a
Explanation: Abstraction is hiding the complex code. For example, we directly use cout
object in C++ but we don’t know how is it actually implemented. Encapsulation is data
binding, as in, we try to combine a similar type of data and functions together.
11. In terms of stream and files ____________
a) Abstraction is called a stream and device is called a file
b) Abstraction is called a file and device is called a stream
c) Abstraction can be called both file and stream
d) Abstraction can’t be defined in terms of files and stream
View Answer
Answer: a
Explanation: Abstraction is called stream to provide a level of complexity hiding, for how the
files operations are actually done. Actual devices are called file because in one way or
another, those can be considered as single entity and there is nothing hidden.
12. If two classes combine some private data members and provides public member
functions to access and manipulate those data members. Where is abstraction used?
a) Using private access specifier for data members
b) Using class concept with both data members and member functions
c) Using public member functions to access and manipulate the data members
d) Data is not sufficient to decide what is being used
View Answer
Answer: c
Explanation: It is the concept of hiding program complexity and actual working in
background. Hence use of public member functions illustrates abstraction here.
13. A phone is made up of many components like motherboard, camera, sensors and etc. If
the processor represents all the functioning of phone, display shows the display only, and
the phone is represented as a whole. Which among the following have highest level of
abstraction?
a) Motherboard
b) Display
c) Camera
d) Phone
View Answer
Answer: d
Explanation: Phone as a whole have the highest level of abstraction. This is because the
phone being a single unit represents the whole system. Whereas motherboard, display and
camera are its components.
14. Which among the following is not a level of abstraction?
a) Logical level
b) Physical level
c) View level
d) External level
View Answer
Answer: d
Explanation: Abstraction is generally divided into 3 different levels, namely, logical, physical
and view level. External level is not defined in terms of abstraction.
15. Using higher degree of abstraction __________
a) May get unsafe
b) May reduce readability
c) Can be safer
d) Can increase vulnerability
View Answer
Answer: c
Explanation: It will make the code safer. One may think it reduces the readability, but the
fact is, it actually helps us understand the code better. We don’t have to read the complex
code which is of no use in understanding the program.

You might also like