Question 1: C++ OOPS - Encapsulation Concept
What is encapsulation in C++?
Question 2: C++ OOPS - Access Modifiers in Encapsulation
Which access modifier is mainly used to achieve encapsulation in C++?
Question 3: C++ OOPS - Example of Encapsulation
If age is a private member of class Person, how should it be accessed?
Question 4: C++ OOPS - Benefit of Encapsulation
Which of the following is NOT a benefit of encapsulation?
Question 5: C++ OOPS - Access Control
What will happen if you try to directly access a private data member of a class?
Question 6: C++ OOPS - Encapsulation & Abstraction
How is encapsulation different from abstraction?
Question 7: C++ OOPS - Getter Method
Which is the correct way to write a getter for salary (private) in class Employee?
Question 8: C++ OOPS - Setter Method
Which is the best way to define a setter for salary in class Employee?
Question 9: C++ OOPS - Encapsulation Security
Why does encapsulation improve security?
Question 10: C++ OOPS - Real-life Example of Encapsulation
Which of the following is a real-world analogy for encapsulation?