1. What is C++?

C++ is a general-purpose, object-oriented programming language developed by
Bjarne Stroustrup in 1985 at Bell Labs. It is an extension of C language
with added features like classes, objects, inheritance, polymorphism, and
encapsulation. It supports procedural, object-oriented, and generic programming.

2. What are the main features of C++?

Major features include Object-Oriented Programming (OOP), Encapsulation,
Abstraction, Inheritance, Polymorphism, Function Overloading, Operator Overloading,
Templates, Exception Handling, and Standard Template Library (STL).

3. What is the difference between C and C++?

C is a procedural programming language while C++ supports object-oriented
programming. C++ supports classes, inheritance, polymorphism, and templates,
which are not available in C.

4. What is a class in C++?

A class is a user-defined data type that contains data members (variables)
and member functions (methods). It acts as a blueprint for creating objects.

5. What is an object?

An object is an instance of a class. It represents real-world entities and
contains properties (data) and behavior (functions).

6. What is a constructor?

A constructor is a special member function of a class that initializes
the object. It has the same name as the class and is automatically called
when an object is created.

7. What is a destructor?

A destructor is a special member function that is used to destroy an object
and release resources. It has the same name as the class preceded by (~).

8. What is function overloading?

Function overloading allows multiple functions with the same name but
different parameters in the same scope.

9. What is operator overloading?

Operator overloading allows redefining the functionality of operators
for user-defined data types.

10. What is inheritance?

Inheritance is a feature of OOP where one class acquires the properties
and behaviors of another class.

11. What are access specifiers?

Access specifiers define visibility of class members. They are:
public, private, and protected.

12. What is encapsulation?

Encapsulation is wrapping data and methods into a single unit (class)
and restricting direct access to some components.

13. What is abstraction?

Abstraction means hiding implementation details and showing only
essential features of the object.

14. What is polymorphism?

Polymorphism allows functions or objects to behave differently
based on context. It is achieved through function overloading
and virtual functions.

15. What is virtual function?

A virtual function ensures that the derived class function is
called instead of base class function when using base class pointer.

16. What is a pointer?

A pointer is a variable that stores the memory address of another variable.

17. What is a reference variable?

A reference variable is an alias for another variable.

18. What is dynamic memory allocation?

Dynamic memory allocation is allocation of memory at runtime using
new and delete operators.

19. What is namespace?

Namespace is used to avoid name conflicts in large projects.

20. What is inline function?

An inline function is expanded at the place of function call
to reduce function call overhead.

21. What is a friend function?

A friend function can access private and protected members of a class.

22. What is STL?

Standard Template Library (STL) is a library of generic classes and functions
such as vector, list, map, stack, and algorithms.

23. What is template?

Templates allow writing generic code for any data type.

24. What is exception handling?

Exception handling manages runtime errors using try, catch, and throw.

25. What is the difference between struct and class?

By default, struct members are public while class members are private.

📢 Join Our WhatsApp Channel

💼 Get Daily IT Job Updates, Interview Preparation Tips & Instant Alerts directly on WhatsApp.

👉 Join WhatsApp Now

📢 Join Our Telegram Channel

💼 Get Daily IT Job Updates, Interview Tips & Exclusive Alerts directly on Telegram!

👉 Join Telegram

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2022 - 2025 itfreesource.com

Enable Notifications OK No thanks