Pesky c++ interview questions.
Things you are suppose to regurgitate during c++ screening interviews (yep, in the real world you can't look up things on the Internet). Mostly lifted from Wikipedia. Posted looking for clarity and avoiding fire-hose effect (bucket loads of information cramming your screen
Smart Pointer:
Data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking. These additional features are intended to reduce bugs caused by the misuse of pointers while retaining efficiency. Smart pointers typically keep track of the objects that point to them for the purpose of memory management. Virtual Function: Function or method whose behavior can be overridden within an inheriting class by a function with the same signature. Dynamic Cast: Operator, which allows the program to safely attempt conversion of an object into an object of a more specific object type (as opposed to conversion to a more general type, which is always allowed). STL Vector. A vector is a dynamic array. It is one of several data structures called container, others being sets, maps, ... It is implemented as a class template. Access time to any member is constant. The vectory access mechanism is a random iterator. Copy Constructor. A copy constructor is a special constructor in the C++ programming language used to create a new object as a copy of an existing object. This constructor takes a single argument: a reference to the object to be copied. Default Constructor. Constructor without parameters. STL Map. Standard C++ container. It is a sorted associative array of unique keys and associated data. STL List. A doubly-linked list; elements are not stored in contiguous memory. Opposite performance from a vector. Slow lookup and access (linear time), but once a position has been found, quick insertion and deletion (constant time) Virtual Destructor. A virtual destructor is a destructor that can be overridden by subclasses. In C++, use of virtual destructors in inheritance hierarchies facilitates proper clean-up of objects, preventing resource leaks and heap corruption. Abstract Class A Base class without implementation. The implementation must take place in the derived class. Local Class A class defined within the scope of a function. Conversion Constructor. Constructor with a single argument used for type conversion.
Smart Pointer:
Data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking. These additional features are intended to reduce bugs caused by the misuse of pointers while retaining efficiency. Smart pointers typically keep track of the objects that point to them for the purpose of memory management. Virtual Function: Function or method whose behavior can be overridden within an inheriting class by a function with the same signature. Dynamic Cast: Operator, which allows the program to safely attempt conversion of an object into an object of a more specific object type (as opposed to conversion to a more general type, which is always allowed). STL Vector. A vector is a dynamic array. It is one of several data structures called container, others being sets, maps, ... It is implemented as a class template. Access time to any member is constant. The vectory access mechanism is a random iterator. Copy Constructor. A copy constructor is a special constructor in the C++ programming language used to create a new object as a copy of an existing object. This constructor takes a single argument: a reference to the object to be copied. Default Constructor. Constructor without parameters. STL Map. Standard C++ container. It is a sorted associative array of unique keys and associated data. STL List. A doubly-linked list; elements are not stored in contiguous memory. Opposite performance from a vector. Slow lookup and access (linear time), but once a position has been found, quick insertion and deletion (constant time) Virtual Destructor. A virtual destructor is a destructor that can be overridden by subclasses. In C++, use of virtual destructors in inheritance hierarchies facilitates proper clean-up of objects, preventing resource leaks and heap corruption. Abstract Class A Base class without implementation. The implementation must take place in the derived class. Local Class A class defined within the scope of a function. Conversion Constructor. Constructor with a single argument used for type conversion.
class Boo { double value; public: Boo(int i); operator double () { return value; } }; Boo BooObj; double i = BooObj; // good heavens you can assign Boo to double!
Comments
Brilliant article, glad I slogged through the C++ Interview Questions and answers it seems that a whole lot of the details really come back to from my past project.
write a c program that finds number of any paragraph and sentence in a text.
I'm new at this and i really need to do this.
Follow my new blog if you interested in just tag along me in any social media platforms!
Thank you,
Irene Hynes