Question 21 : What is C++?
C++ id general-purpose programming language developed as an extension of the C Programming Language. The main feature of the C++ is that, it supports the Object-Oriented Programming, Generic Programming, and Procedural Programming Paradigms.
Question 22 : What is Object-Oriented Programming?
Object-Oriented Programming is a Programming Paradigm based on the concept of Objects. Which can contain data, in the form of fields (attributes or properties), and code, in the form of procedures (Methods of Functions).
Question 23 : What are the Four Pillars of OOPs?
The four pillars of the Object-Oriented Programming are: Encapsulation, Inheritance, Polymorphism, and Abstraction.
Question 24 : What is Encapsulation?
Encapsulation is the bundling of data and methods that operate on that data into a single unit, typically a class in C++, and restricting access to the internal state of the object.
Question 25 : What is Inheritance?
Inheritance is the a mechanism in which a new class inherits properties and behavior from an existing class, allowing for code reuse and the creation of a hierarchical relationship between classes.
Question 26 : What is Polymorphism?
Polymorphism allows objects of different classes to be treated as objects of a common superclass through the use of common interface, enabling functions to operate differently based on the object they are called with.
Question 27 : What is Abstraction?
Abstraction is the process of hiding the complex implementations details and showing only the essential features of an object or function.
Question 28 : What is class in C++?
A class in C++ is a blueprint for creating objects. It defines the properties and behaviors that object of the class will have.
Question 29 : What is an object in C++?
An object in C++ is an instance of a class. It represents a real-world entity and has attributes (data members) and behaviors (member functions).
Question 30 : What is Constructor?
A constructor is a special member function of a class that is automatically called when an object of that class is created. It is used to initialize the object’s data members.
Question 31 : What is Destructor?
A Destructor is special member function of a class that is automatically called when an object goes out of scope or is explicitly deleted. It is used to release resources held by the object.
Question 32 : What is Function Overloading?
Function Overloading is a feature of C++ that allows multiple functions with the same name but different parameter lists to be defined within the same scope.
Question 33 : What is Operator Overloading?
Operator overloading is a feature of C++ that allows operators to be redefined for user-defined types. It enables operators such as +, -, *, /, etc, to be used with objects of custom classes.
Question 34 : What is namespace in C++?
A namespace is a declarative region that provides a scope for the identifiers (names) inside it, preventing name collision and organizing code into logical groups.
Question 35 : What is difference between a structure and a class in C++?
In C++, the only difference between a structure and a class is that member of a structure are by default public, whereas member of a class are by default private.
Question 36 : What is a pointer?
A pointer is a variable that stores the memory address of another variable. It allows direct manipulation of memory and is commonly used for dynamic memory allocation and passing arguments by reference.
Question 37 : What is a reference?
A reference is an alias or alternating name for a variable. It provides a way to access the same memory location using different names and is often used as function parameters to avoid unnecessary copying data.
Question 38 : What is Dynamic Memory Allocation in C++?
Dynamic Memory allocation in C++ refers to the allocation and deallocation of memory at runtime using the new and delete operators, respectively. It allows for the creation of objects whose size is not known until runtime.
Question 39 : What is storage class in C++?
C++ provides four storage classes: auto, register, static, and extern. These control the lifetime, scope and linkage of variables.
Question 40 : What is the difference between the new and malloc() operators?
The new operator is used for dynamic memory allocation in C++, while malloc() is a function from the C standard library used for dynamic memory allocation in C. The new operator calls constructors for allocated objects, whereas malloc() simply allocates memory without initializing it.