Select the appropriate answer. 1. Which of the following is the most accurate description of encapsulation? a) It's a method of integrating many data elements into a single unit. b) Its a technique for integrating many member functions into a single unit. c) It's a method of integrating different data members and member functions into a single unit that can work with any data. d) It's a way of combining several data members and member functions into a single unit that can handle any data. 2. What can we do to get data members from the class object if they are private? a) To gain access to such data members, create public member functions. b) To have access to such data members, create private member functions. c) To gain access to certain data members, create protected member functions. d) Members of private data are never accessible from outside the class. 3. Which of the following is achievable when utilizing encapsulation? a) Modifications to the code might add to the workload. b) The data type of a data member can be modified without affecting any other code. c) The type of a data member cannot be changed without changing the entire code. d) The data type of data members can be changed using member functions. 4. Which of the following is an example of encapsulation? a) void main(){ int a; void fun( int a=10; cout<
Select the appropriate answer.
1. Which of the following is the most accurate description of encapsulation?
a) It's a method of integrating many data elements into a single unit.
b) Its a technique for integrating many member functions into a single unit.
c) It's a method of integrating different data members and member functions into a single unit that can work with any data.
d) It's a way of combining several data members and member functions into a single unit that can handle any data.
2. What can we do to get data members from the class object if they are private?
a) To gain access to such data members, create public member functions.
b) To have access to such data members, create private member functions.
c) To gain access to certain data members, create protected member functions.
d) Members of private data are never accessible from outside the class.
3. Which of the following is achievable when utilizing encapsulation?
a) Modifications to the code might add to the workload.
b) The data type of a data member can be modified without affecting any other code.
c) The type of a data member cannot be changed without changing the entire code.
d) The data type of data members can be changed using member functions.
4. Which of the following is an example of encapsulation?
a) void main(){ int a; void fun( int a=10; cout<<a); fun(); }
b) class student{ int a; public: int b;};
c) class student{int a; public: void disp(){ cout<<a;} };
d) struct topper{ char name[10]; public : int marks; }
5. Which of the following statements most accurately represents constructor overloading?
a) Defining one constructor in each class of a program
b) Defining more than one constructor in single class
c) Defining more than one constructor in single class with different signature
d) Defining destructor with each constructor
Which of the following statements about constructors is false?
a) Constructors doesn’t have a return value
b) Constructors are always user-defined
c) Constructors are overloaded with different signature
d) Constructors may or may not have any arguments being accepted
7. Why do we utilize constructor overloading in the first place?
a) To use different types of constructors
b) because it’s a feature provided
c) To initialize the object in different ways
d) To differentiate one constructor from another
8. Which aspect of OOP is employed here if a function may execute more than one type of work while keeping the function name the same?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Abstraction
9. The following code demonstrates which OOP feature?
class student{ int marks; };
class topper: public student{ int age; topper(int age){ this.age=age; } };
a) Inheritance
b) Polymorphism
c) Inheritance and polymorphism
d) Encapsulation and Inheritance
10. ___________ Feature of Polymorphism in a class is highlighted.
a) Nested class
b) Enclosing class
c) Inline function
d) Virtual Function
Trending now
This is a popular solution!
Step by step
Solved in 5 steps