|
via Udemy |
Go to Course: https://www.udemy.com/course/learn-cpp-from-interview-questions/
Welcome to the Course " Learn C++ From Interview Questions "This course is from a software engineer who has managed to crack interviews in around 16 software companies.Sometimes, life gives us no time to prepare, There are emergency times where in we have to buck up our guts and start bringing the situations under our control rather then being in the control of the situation. At the end of the day, All leave this earth empty handed. But given a situation, we should live up or fight up in such a way that the whole action sequence should make us proud and be giving us goosebumps when we think about it right after 10 years.We observe in quite a lot of interviews that most of us find it quite confusing (at the moment) to answer basic questions like the format of the a.out file, not having a clear understanding of the distinction between protected and private data members of the class, finding it difficult to create static libraries and dynamic libraries, not knowing that is there is really a difference between static and dynamic libraries, confusion in the usage of different combinations of dynamic memory allocation and free calls like new, delete, malloc and free , unknown about the difference between up casting and object slicing, thinking that the concepts of function templates and template functions are similar. The basic problem is here even though most of us are good at concepts, We get confused while answering when we come across a tricky question. As we all know, these tricky questions are simpler ones which are twisted and turned while asking them in the interviews. This is just to confuse the candidate in order to check whether the candidate really has a strong hold on the concepts.Here in this course, We have tried an approach where in we are trying to make our audience understand the concepts of c++ through tricky interview questions.This course is designed for almost 7.5 hours and a preview of 30 mins. Please go through the c++ questions dealt and the preview of the course. If you are interested, Kindly enroll in the course. Kindly adjust the talking speed in accordance to your convenience (Please set the course narration speed to 1.24x on your conveniencce.). The concepts are presented in Neutral English. As per Udemy Policy, you can always refund if you want to withdraw from the course at any point of time.The Questions handled in the course is as follows:Where are the function declarations foundWhere are the function definitions foundAfter compilation, are the function definitions found in a.out fileIn static library, are the library files part of the executable file (a.out)In dynamic library, are the library files part of the executable file (a.out)What is the full form of a.outWhat is the format of a.out fileIs reference a constant pointerWhat happens when a reference variable is re-assigned a value from another variable What happens when a reference variable is used with & and is re-assigned a value from another variableWhat is the difference between a reference and constant pointerWhat is the advantage of a reference over a pointerHow does a reference to a reference workIn the given program, convert all the const pointer statements to referencesExplain the below statements: int *const p; const int *p; const int * const p; int const *p;What is the difference between the operators (&) and (&*) when used in the context of pointersIn C++, is it mandatory to name a structure or a unionIs the life time of a locally declared reference limited to the function in which it is declaredDeclare the following: an array of 5 integers an array of 5 pointers a pointer to an array of 5 integers a reference to an array of 5 integersIs it possible to create an array of referencesCan we have multiple definitions of a function in a single moduleWhat is the difference between declaration and definition of a variableDefine a structure which contains a member function to add 2 of it's data members and print the resultDoes a pointer to a variable act like a constant reference OR Does a reference to a variable act like constant pointerA reference can point to different variables but a variable can't be tied to multiple referencesDoes scope resolution operator help us in retrieving only the value of global variables whose identifier names are similar to the local variable namesWhat is the difference between the below two statements: a constant reference reference is a constant pointerCan we call a pointer ( which points to a read only string ) as a constant pointerDo we get a lvalue error in an assignment statement where a function call is placed on the left hand side of the assignment operatorAre there only 2 ways to pass variables to a function ?Does passing arguments by reference really advantageousIs static variable intermodular or intramodularAre Inline functions similar to macro definitionsFunction overloading is asking the same function to perform different tasks in different contexts of the programName mangling is the concept where a name management database is used to maintain different global variables across different modulesCan we overload the function to accept an char value and an char referenceSuppose I have a structure having data members. I create 2 structure objects. Can I add 2 structure objects which automatically will take care of adding the data members of the 2 objects of the structureCan we increment the data member of the structure through the structure object using the ++ operatorOperator overloading is programming the operator to perform a different functionIn function overloading, Is name mangling concept applied on both function definitions and declarations Is name mangling concept taken care for all the functions irrespective of whether the function is overloaded or notFunction overloading is differentiating the function( with same names) based on their return typeCan A function be overloaded only onceWe will get a compilation error, if we overload -operator to perform incrementationMacros perform typechecking of the arguments passed to macro functionsWhat is a class and a objectIs it true that A constructor is not a mandatory function in a classIs it true that A destructor function is automatically called when the object of the class is constructedIs it true that when Malloc allocates memory dynamically when creating an object of the class, it also calls the constructorIs it true that when New allocates memory dynamically when creating an object of the class, it doesn't call the constructorIs it true that when Delete operator calls the destructor function of the class when the object is being destroyedIs it true that when Free function can be used to free the memory which is dynamically allocated by using the new operatorIs it true that when Delete operator can be used to free the memory which is dynamically allocated by using the new operatorCan A public data member of the class can be accessed from anywhere with in the class or from outside the classCan A private data member of the class can be accessed by the class object from outside the classCan A member function of the class can be made privateCan A public member function of a particular class can be called by the object of the class from outside the classCan A private member function cannot be called directly by the object of the class from outside the classCan I alter the private data member of the class from outside the classIs it true that A static member function can be accessed only by the class name from outside the classCan a static member function change the data member value belonging to a particular objectCan a constructor of a object initialize the static data member of the classCan a normal member function change modify the static data member of the classWhat is the difference between a static member function accessing the static data member and a normal member function accessing the static data memberCan we modify a publicly declared static data member from outside the classCan one class contain an another class in itCreate an array of 3 objects and initialize themIs it logical to initialize the data members in the class when the class is createdCan we initialize the public const data member of the class from outside the classCan one class have an other class's object declared in it's private sectionCan we create an object of an anonymous/nameless class Does an overloaded assignment operator get's called by default when one object is assigned to the other objectDoes an overloaded ‘+' operator get's called by default when one object is added with another objectCan we assign an integer value to an object Explain the concept of this pointerIs it true that the member functions can only access the data members related to classCan we create a static objectCan we have a const member functionIs there any difference between assignment operators and copy constructors Which function get's called when an object is passed to a function or returned from a function by valueIs it true that If a derived class is privately derived from a base class then the protected and public data members of the base class will become private for the desired classIs it true that If a derived class is protectedly derived from a base class, then protected and public data members of the base class will become protected for the derived classIs it true that If a derived class inherits privately all public members of the base class, the public member of the base class will become private for the derived class Continued from the above statement, can we make some of the members of the base class to be accessible from outside the derived classIs the size of the base class is equal to the sum of the sizes of the data members of the base class and the derived classes Is it true that multiple inheritance is similar to multilevel inheritanceCan we derive a child class from a base class even before the base class is definedA derived class is derived publicly from the base class. The derived class has got a member function which overrides the member function defined in the base class. Is it true that the member function of the base class will be called by an object of the derived classIs it true that the base class can access the public members of the derived classIs it true that When a class is publicly derived from a base class, then the private members of the base class is not accessible from outside the derived class, but the public and protected members are accessible from outside and inside the member functions of the derived classIs it true that When a class is privately derived from a base class, the protected and public members of the base class will become private for the derived class Is it true that When a class is protectedly derived from a base class, then the protected and public members of the base class become protected members of the derived class Is it true that The object of the derived class can access the private and protected members of the base class from outside the derived classIs it true that a virtual function without the expression = 0 added to the declaration can't be overriddenIs it true that An abstract class is something where in the derived class can't override the member functions of the base classIs it true that we can't have a pointer to an abstract classIs it true that The normal functions are resolved at run timeIs it true that the virtual table contain the address of virtual functionsIs it true that The address of the derived class object can't be stored in a base class pointer. This leads to a compilation errorIs it true that Virtual functions don't support polymorphismCan a derived class pointer can call the virtual function defined in the base class Is it true that The virtual function table is shared across different objects of the classIs it true that The this pointer contains the address of the object where as the object contains vptr which in turn holds the address of the virtual tableCan we have a pure virtual constructor and destructor functionsIs it true that An abstract base class is something which doesn't contain a pure virtual functionIs it true that An abstract class doesn't need a constructorIs it true that The ‘has a' is a concept where in when a class is derived from another class, it is said to a type of it's base class Is it true that The ‘kind of' relationship is something where in one class will have an object of another class created in itCan we use the explicit keyword along with the constructors to prevent implicit conversionsIs it true that The data member of the const object can be changed using the mutable keywordIs it true that a friend function of a class can never access private data of a classIs it true that a friend function should mandatorily a member function of the classIs it true that Forward referencing is a concept where in a friend function can refer a undefined and a undeclared classIs it true that A friend class of a class can access the data members of the classIs it true that The dynamic cast operator gives the information about the object at run timeCan we convert a const integer variable to non const variableIs it true that We don't have to rewrite the code when we are using composition or inheritanceIs it true that A function that is a friend of a class can access only the public data members of a classIs it true that If class B is declared as a friend to class A, then class A can access all private & public members of class BIs it true that templates can't be used on user defined data typeIs it true that Function template and template functions are similarIs it true that Macros are more advantageous then templatesIs it true that We get a compilation error if class templates are instantiated using objectsIs it true that The member functions of a template class should mandatorily be defined in the classIs it true that If there is a function template called fun(), then a specific appropriate version of it would be generated when the fun() is called with a new data type argumentIs it true that template saves memoryIs it true that A function template should mandatorily have only one argument typeIs it true that We get run time error if we set default values to template argumentsIs it true that We get compile time error if function templates are overloaded