What is the function of the keyword 'volatile' in C++ ?
- It is used to tells the compiler that the value of the variable may change at any time without any action being taken by the code;
What is the storage class in C++?
- Are used to describe the features of a variable/function. C language uses 4 storage classes
What is the difference between a constructor and a destructor in C++?
- Constructor helps to initialize the object of a class ad is called when an instance or object of a class is created.
- Destructor is used to destroy the instances and is called while object of the class is freed or deleted
What is inheritance in C++?
- Is an mechanism of reusing and extending existing classes without modifying them, thus producing hierarchical relationships between them.
What are the three types of access specifiers in C++?
- Public: Members are accessible from outside the class
- Private: Members cannot be accessed(or viewed) from outside the class
- Protected: Members cannot be accessed from outside the class, however, they can be accessed in inherited classes
What is the difference between a class and a structure in C++?
- The only difference between a class and a structure in C++ is the default accessibility of members variables and methods.
- Struct is public
- Class is private
What is abstraction in C++?
- Abstraction means displaying only essential information and hiding the datails.
What is encapsulation in C++?
- It envolves the bundling of data members and functions inside a single class.
What is an object in C++ ? What is a class in C++?
- Class is a user-defined data type that we can use in our program, and it works as an object constructor, or a "blueprint" for create objects.
- Objects is an instance of a class.
What are the strengths of C++?
- Portability
- Object-Oriented
- Multi-paradigm
- Memory Management
- Compatibility with C
- Low-level manipulation
- Large Community Support
- Scalability
What are the main differences between C and C++?
- C is a subset of C++
- C++ is a superset of C
- C supports procedural programming
- C++ supports procedural and object oriented programming paradigms
- C is a function-driven language
- C++ is an object-oriented language
What are the main characteristics of C++ as a programming language?
- Object-oriented
- Simple
- Plataform dependent
- Memory Management
- Powerfull
- Fast
- Compiler based
What is multithreading in C++?
- Multithreading is?the potential of an Operating System to create a process consisting of multiple threads where threads are the smallest sequence of programs that are managed by the scheduler.
What is the difference between an external iterator and an internal iterator in c++?
- When the client(Programmer) controls the iteration, the iterator is called external iterator or active iterator
- When the iterator controls it, it is called an internal iterator or passive
What is function overriding in C++?
- Is a feature that allows us to use a function in the child class that is already present in its parent class
What is the purpose of the "friend" function in C++?
- The friend function in C++ is defined outside the scope of the class. It has the authority to access all protected members and private members of the class. Friends are not member functions, but the prototypes for friend functions appear in the class function only
- It allows the sharing of private class information by a non-member function
- It accesses the non-public members of a class easily
What is the function of the "auto" keyword in C++?
- The auto keyword?directs the compiler to use the initialization expression of a declared variable, or lambda expression parameter, to deduce its type.
What are the differences between a shallow copy and a deep copy in C++?
- Shallow Copy stores the copy of the original object and points the references to the objects
- Deep copy stores the copy of the original object and recursively copies the objects as well
What is namespace in C++?
- A namespace is?a declarative region that provides a scope to the identifiers (the names of types, functions, variables, etc) inside it. Namespaces are used to organize code into logical groups and to prevent name collisions that can occur especially when your code base includes multiple libraries.
What is the difference between an array and a list in C++?
- ?Array has a fixed size required to be declared prior, but a linked list is not restricted to size, expansion, and contract during execution.
What is function overloading in C++?
- Function overloading is a feature of object-oriented programming where two or more functions can have the same name but different parameters. When a function name is overloaded with different jobs it is called Function Overloading. In Function Overloading “Function” name should be the same and the arguments should be different. Function overloading can be considered as an example of a?polymorphism?feature in C++.
What are the different types os variables in C++?
- Int
- Char
- Bool
- Double
- String
What are the five types of inheritance in C++?
- Single inheritance: Defined as the inheritance in which a derived class is inherited from the only one base class
- Multiple inheritance: Where a class can inherit from more than one class
- Multilevel inhertance: Derive a class from the base class but you can also derive a class from the derived class.
- Hierarchical inheritance: More than one class is inherited from the base class.
- Hybrid inheritance: The derivation of a class involves more than one form of any inheritance
What is polymorphism in C++?
- Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance.
How is memory managed in C++?
- Memory management in C++ can be static or dynamically allocated.
- Static Memory Allocation: The compiler allocates a fixed amount of memory during compile time and the OS internally uses a data structure known as stack to manage the memory.
- Dynamic Memory Allocation: OS is managed at runtime. It is performed using malloc(), calloc(), realloc() and free()
What are the weaknesses of C++?
- Security issues due Object-orientated programming
- Pointers take up a large amount of memory
- Dynamic Memory Allocation can be can be a dangerous form of development
- Difficult to programming
What is the difference between early binding and late biding in C++?
- Early binding(static binding): Early binding occurs when we make the explicit or direct function call in our program.
- Late binding(Dynamic binding): Late binding occurs when we make implicit or indirect function calls in our program.
What is by RAII in the context of C++?
- Resource Acquisition is Initialization(RAII), is a C++ programming technique, which binds the life cycle of a resource that must be acquired before use (allocated heap memory, thread of execution, open socket, open file, locked mutex, disk space, database connection, anything that exists in limited supply) to the lifetime of an object.
What are the main differences between a list and a vector in C++?
- Vector: It has contiguous memory. It is synchronized. Vector may have a default size. In vector, each element only requires the space for itself only. Vector is thread safe.
- List: While it has non-contiguous memory. It is not synchronized. Does not have default size. Insertion is cheap no matter where in the list it occurs.
What is the difference between variables declaration and variable definition in C++?
- The main difference between Declaration and Definition in C++ is that declaration of a variable indicates the compiler about the name and the type of the variable, while the definition of a variable indicates the compiler where and how much storage to create for a variable.
What are the advantages and disadvantages of recursion in C++?
- Advantages: Recursion helps in reducing the lenght of the code. It provides a clean and straightforward way to write the code. It minimizes the calling to the function again and again. Recursion is preferred in problems like tree traversals and the tower of hanoi.
- Disadvantages: Recursion functions are a bit slower than non-recursive functions. It has more significant space requirements than the iterative programs. It has a more significant requirements of time due to functions calls. It is bit difficult to understand.
What is type erasure in C++?
- Type erasure is achieved in C++ by encapsulating implementation in a generic wrapper and providing virtual accessor methods to the concrete implementation through generic interface.
What is a virtual destructor in C++?
- A virtual destructor is used to free up the memory space allocated by the derived class object or instance while deleting instances of the derived class using a base class ponter object.
What are the differences types of preprocessors directives in C++?
- Macros
- File inclusion
- Conditional Compilation
- Pragma directive
How is exception handling performed in C++?
- In C++ exception is handled using: try, throw and catch.
What is the 'diamond problem' that occurs with multiple inheritance in C++?
- Occurs when two superclasses of a class have a common base class.