JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Encapsulation interview questions
Encapsulation interview questions
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 5
1. Which among the following best describes encapsulation?
A. It is a way of combining various data members into a single unit
B. It is a way of combining various member functions into a single unit
C. It is a way of combining various data members and member functions into a single unit which can operate on any data
D. It is a way of combining various data members and member functions that operate on those data members into a single unit
Show Correct Answer
Correct Answer is :
It is a way of combining various data members and member functions that operate on those data members into a single unit
2. If data members are private, what can we do to access them from the class object?
A. Create public member functions to access those data members
B. Create private member functions to access those data members
C. Create protected member functions to access those data members
D. Private data members can never be accessed from outside the class
Show Correct Answer
Correct Answer is :
Create public member functions to access those data members
3. While using encapsulation, which among the following is possible?
A. Code modification can be additional overhead
B. Data member’s data type can be changed without changing any other code
C. Data member’s type can’t be changed, or whole code have to be changed
D. Member functions can be used to change the data type of data members
Show Correct Answer
Correct Answer is :
Data member’s data type can be changed without changing any other code
4. Which feature can be implemented using encapsulation?
A. Inheritance
B. Abstraction
C. Polymorphism
D. Overloading
Show Correct Answer
Correct Answer is :
Abstraction
5. Find which of the following uses encapsulation?
A. void main(){ int a; void fun( int a=10; cout<
B. class student{ int a; public: int b;};
C. class student{int a; public: void disp(){ cout<
D. struct topper{ char name[10]; public : int marks; }
Show Correct Answer
Correct Answer is :
class student{int a; public: void disp(){ cout<
Similar Interview Questions
Search for latest jobs
Find Jobs