Test Series - oops

Test Number 9/78

Q: 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
Solution: 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.
Q: 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
Solution: 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.
Q: Class is _________ abstraction.
A. Object
B. Logical
C. Real
D. Hypothetical
Solution: 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.
Q: Object is ________ abstraction.
A. Object
B. Logical
C. Real
D. Hypothetical
Solution: 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.
Q: Abstraction gives higher degree of ________
A. Class usage
B. Program complexity
C. Idealized interface
D. Unstable interface
Solution: 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.
Q: Abstraction can apply to ____________
A. Control and data
B. Only data
C. Only control
D. Classes
Solution: Abstraction applies to both. Control abstraction involves use of subroutines and control flow abstraction. Data abstraction involves handling pieces of data in meaningful ways.
Q: Which among the following can be viewed as combination of abstraction of data and code.
A. Class
B. Object
C. Inheritance
D. Interfaces
Solution: 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.
Q: 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
Solution: 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.
Q: 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
Solution: 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.
Q: 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
Solution: 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.

You Have Score    /10