{"id":15047813,"url":"https://github.com/anathonic/the-cpp-programming-language","last_synced_at":"2025-04-10T01:08:19.610Z","repository":{"id":65289359,"uuid":"588728547","full_name":"anathonic/the-cpp-programming-language","owner":"anathonic","description":"The C++ compendium of knowledge based on \"The C++ Programming Language Fourth Edition\" by Bjarne Stroustrup","archived":false,"fork":false,"pushed_at":"2023-02-20T22:14:49.000Z","size":80,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T01:08:10.197Z","etag":null,"topics":["cinterviewquestions","cplusplus","cplusplus-11","cplusplus-17","cplusplus-20","interview-practice","interview-preparation","interview-questions","junior-software-engineer","stl-algorithms","stl-containers"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anathonic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-01-13T21:02:38.000Z","updated_at":"2025-02-28T20:46:25.000Z","dependencies_parsed_at":"2024-04-03T21:45:02.898Z","dependency_job_id":null,"html_url":"https://github.com/anathonic/the-cpp-programming-language","commit_stats":null,"previous_names":["anathonic/thecppprogramminglanguage","anathonic/the-cpp-programming-language"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anathonic%2Fthe-cpp-programming-language","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anathonic%2Fthe-cpp-programming-language/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anathonic%2Fthe-cpp-programming-language/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anathonic%2Fthe-cpp-programming-language/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anathonic","download_url":"https://codeload.github.com/anathonic/the-cpp-programming-language/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137887,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cinterviewquestions","cplusplus","cplusplus-11","cplusplus-17","cplusplus-20","interview-practice","interview-preparation","interview-questions","junior-software-engineer","stl-algorithms","stl-containers"],"created_at":"2024-09-24T21:04:56.603Z","updated_at":"2025-04-10T01:08:19.564Z","avatar_url":"https://github.com/anathonic.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 1. What is the difference between C and C++?\n\n\u003ctable border=\"0\"\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cb style=\"font-size:30px\"\u003eC \u003c/b\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cb style=\"font-size:30px\"\u003eC++\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n    \u003ctd\u003e\n    \t\u003cul\u003e\n        \t\u003cli\u003e C language is a procedure \u003cbr\u003e oriented programming language \u003c/li\u003e\n  \t\t\u003cli\u003e It follows top-down approach\u003c/li\u003e\n  \t\t\u003cli\u003e It doesn't support function or \u003cbr\u003e operator overloading \u003c/li\u003e\n            \t\u003cli\u003e C language doesn't support \u003cbr\u003e virtual and friend function \u003c/li\u003e\n  \t\t\u003cli\u003e C language has 32 keywords \u003c/li\u003e\n\t\u003c/ul\u003e\n   \u003c/td\u003e\n   \u003ctd\u003e\n    \t\u003cul\u003e\n  \t\t\u003cli\u003e C++ is partially object oriented \u003cbr\u003e programming language \u003c/li\u003e\n  \t\t\u003cli\u003e It follows bottom-up approach \u003c/li\u003e\n  \t\t\u003cli\u003e It supports function as well as \u003cbr\u003e function overloading \u003c/li\u003e\n            \t\u003cli\u003e C++ language supports both \u003cbr\u003e virtual and friend functions \u003c/li\u003e\n  \t\t\u003cli\u003e C++ language has 52 keywords\u003c/li\u003e\n\t\u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n### 2. What are classes and objects in C++?\n\n A class is a user-defined datatype members and member functions and \u003cbr\u003e is defined with the keyword class.\n Objects are defined as an instance of a class. Once the object is created, \u003cbr\u003e then it can operate on both data members and member functions.\n\n### 3. What are access modifiers?\n\nAccess modifiers are used to define accessibility for the class members. \u003cbr\u003e It defines how the members of the class are accessed outside the class scope. \u003cbr\u003e There are three types of access modifiers: \n* Private\n* Public\n* Protected\n\n### 4. What are C++ OOPs concept? \n* Object\n* Class\n* Inheritance \n* Abstraction\n* Encapsulation \n* Polymorphism \n\n### 5. What is an object in C++?\nAn object is an instance of a class with the class's own methods or procedures \u003cbr\u003e and data variables.\n\n### 6. What is class in C++?\nA class is a user-defined data type that we can use in our program, and it works \u003cbr\u003e as an object constructor, or a \"blueprint\" for creating objects. \n\n### 7. What is the inheritance in C++?\nInheritance is one of the main features of object-oriented programming in C++, \u003cbr\u003e allowing us to inherit another class's properties.\n\n### 8. What is meant by abstraction in C++? \nData abstraction refers to providing only essential information to the outside \u003cbr\u003e world and hiding their background details.\n\n### 9. What is Encapsulation in C++?\nEncapsulation is an Object Oriented Programming concept that binds together \u003cbr\u003e the data and functions that manipulate the data, and that keeps both safe from \u003cbr\u003e outside interference and misuse.\n\n### 10. What is Polymorphism in C++?\nWhat is Polymorphism in C++? Polymorphism in C++ means, the same entity \u003cbr\u003e(function or object) behaves differently in different scenarios.\n\n### 11. What is a Vector in STL?\nVectors are the same as dynamic arrays with the ability to resize itself automatically \u003cbr\u003e when an element is inserted or deleted, with their storage being handled automatically \u003cbr\u003e by the container.\n\n### 12. What is a List in STL?\nLists are sequence containers that allow non-contiguous memory allocation. \u003cbr\u003e As compared to vector, the list has slow traversal, but once a position has been \u003cbr\u003e found, insertion and deletion are quick.\n\n### 13. What is a Map in STL?\nMaps are associative containers that store elements in a mapped fashion. \u003cbr\u003e Each element has a key value and a mapped value. No two mapped values \u003cbr\u003e can have the same key values.\n\n### 14. What is a Constructor?\nA constructor is a member function taht is invoked whenever we create an object, \u003cbr\u003e it has the same name as that of the class. \u003cbr\u003e There are 2 types of constructors:\n* Default constructor \n* Parameterized constructor \n\n### 15. What is a Destructor?\nA destructor is a member function that is invoked automatically when the object goes out \u003cbr\u003e of scope or is explicitly destroyed by a call to delete.\n\n### 16. What is operator overloading in C++?\nIt's a type of polymorphism in which an operator is overloaded to give it the user-defined \u003cbr\u003e meaning. C++ allows us to specify more than one definition for a function name or an operator \u003cbr\u003e in the same scope, which is called function overloading and operator overloading, respectively.\n\n### 17. What is a pointer?\nA pointer is a variable that stores the memory address of another variable as its value. \u003cbr\u003e Pointers are used extensively in both C and C++ for three main purposes: to allocate new \u003cbr\u003e objects on the heap, to pass functions to other functions. to iterate over elements in arrays \u003cbr\u003e or other data structures.\n\n### 18. What is a reference?\nA reference variable is an alias, that is, another name for an already existing variable. \u003cbr\u003e Once a reference is initialized with a variable, either the variable name or the reference \u003cbr\u003e name may be used to refer to the variable.\n\n### 19. What is the difference between reference and pointer?\nReferences are used to refer an existing variable in another name whereas pointers \u003cbr\u003e are used to store address of variable. References cannot have a null value assigned \u003cbr\u003e but pointer can. A reference variable can be referenced by pass by value whereas a \u003cbr\u003e pointer can be referenced by pass by reference.\n\n### 20. What is an enum?\nAn enumeration, or Enum , is a symbolic name for a set of values. Enumerations are \u003cbr\u003e treated as data types, and you can use them to create sets of constants for use with \u003cbr\u003e variables and properties.\n\n### 21. What is the difference between Vector and List?\n\u003ctable border=\"0\"\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cb style=\"font-size:30px\"\u003eVector\u003c/b\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cb style=\"font-size:30px\"\u003eList\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n    \u003ctd\u003e\n    \t\u003cul\u003e\n        \t\u003cli\u003e It has contiguous memory \u003c/li\u003e\n  \t\t\u003cli\u003e It is synchronized \u003c/li\u003e\n  \t\t\u003cli\u003e Vector may have a default size \u003c/li\u003e\n            \t\u003cli\u003e In vector, each element only \u003cbr\u003e requires the space for itself only \u003c/li\u003e\n  \t\t\u003cli\u003e Random access of elements is possible \u003c/li\u003e\n\t\u003c/ul\u003e\n   \u003c/td\u003e\n   \u003ctd\u003e\n    \t\u003cul\u003e\n  \t\t\u003cli\u003e It has non-contiguous memory \u003c/li\u003e\n  \t\t\u003cli\u003e It is not synchronized \u003c/li\u003e\n  \t\t\u003cli\u003e List does not have default size \u003c/li\u003e\n            \t\u003cli\u003e In list, each element requires \u003cbr\u003e\n\t\textra space for the node which holds \u003cbr\u003e\n\t\tthe element, including pointers to the \u003cbr\u003e\n\t\tnext and previous elements in the list. \u003c/li\u003e\n  \t\t\u003cli\u003eRandom access of elements is not possible\u003c/li\u003e\n\t\u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n \n ### 22. What is std::move?\nstd::move is used to indicate that an object t may be \"moved from\", i.e. allowing the efficient transfer \u003cbr\u003e of resources from t to another object.\n\n### 23. What is constexpr used for?\nconstexpr indicates that the value, or return value, is constant and, where possible, is computed at compile time.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanathonic%2Fthe-cpp-programming-language","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanathonic%2Fthe-cpp-programming-language","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanathonic%2Fthe-cpp-programming-language/lists"}