{"id":84440,"date":"2021-10-05T09:00:23","date_gmt":"2021-10-05T03:30:23","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=84440"},"modified":"2021-10-05T09:00:23","modified_gmt":"2021-10-05T03:30:23","slug":"cpp-interview-questions-with-answers","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/","title":{"rendered":"C++ Interview Questions with Answers"},"content":{"rendered":"<p>The C++ programming language contains vast concepts and useful topics. There are so many basic to advanced level questions from the C++ programming language. In this tutorial, we discussed some basic to advanced level questions which are frequently asked in placements and interviews. These questions will help you to improve your understanding of the C++ programming language.<\/p>\n<p>Following are some of the C++ Interview questions with their answers. This will help you better in preparing for placements and interviews.<\/p>\n<h3>C++ Basic Interview Questions<\/h3>\n<p><strong>Q.1<\/strong> Can you tell the difference between reference and pointers?<\/p>\n<p><strong>Ans.<\/strong> References and pointers both are being used to change the local variables of a function which is inside another function.<\/p>\n<p><strong>Pointers<\/strong><br \/>\nUsed to store the address of a variable.<br \/>\n<strong>Syntax<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Data_type *pointer;<\/pre>\n<p><strong>References<\/strong><br \/>\nWhen you declare a parameter as reference then it refers to an existing variable in another name.<br \/>\n<strong>Syntax<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Data_Type &amp;newname=existing name;\n<\/pre>\n<table>\n<tbody>\n<tr>\n<td><b>Reference<\/b><\/td>\n<td><b>Pointer<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">References are less powerful.<\/span><\/td>\n<td><span style=\"font-weight: 400\">Pointers are more powerful.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">References are easier to use.\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400\">Pointers are not that easy to use.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">It is used to refer to an existing variable in another name.<\/span><\/td>\n<td><span style=\"font-weight: 400\">It is used to store the address of a variable.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">References cannot have a null value.<\/span><\/td>\n<td><span style=\"font-weight: 400\">Pointers can have a null value.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">You have to initialize it on declaration.<\/span><\/td>\n<td><span style=\"font-weight: 400\">But in the case of a pointer, you do not have to do it.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Q.2<\/strong> What is the use of \u2018this\u2019 pointer?<\/p>\n<p><strong>Ans.<\/strong> The \u2018this\u2019 is a keyword. It is mainly used to refer to the current instance of the class. It can be used inside a member function to refer to the invoking objects. Only member functions have this pointer. But friend functions do not have this pointer.<br \/>\nThere are some main usages of this pointer in C++:-<\/p>\n<ul>\n<li>You can use this pointer to pass the current object as a parameter to another object.<\/li>\n<li>It is also used to refer to the current class instance variable.<\/li>\n<li>The \u2018this\u2019 pointer is an implicit parameter to all member functions.<\/li>\n<li>It also helps you to reduce the complexity of the code and also provides better readability.<\/li>\n<li>It also helps you to distinguish data members from local variables of member functions if they have the same name.<\/li>\n<\/ul>\n<p><strong>Q.3<\/strong> In C++, why should you use the friend class and function?<\/p>\n<p><strong>Ans.<\/strong> In C++, the Friend function is one of the most useful and important functions that you should watch out for. It helps you to access the protected and private members of the class in which it is declared as a friend. Also, using the friend function, you will be able to access the private and protected class members.<br \/>\nFriend Function is mainly of 2 types:-<\/p>\n<ul>\n<li>A global function:- It will allow you to access all the private and protected members of the class.<\/li>\n<li>Method of another class:- If you have more than one class and you want to access the non-public data members of a particular class then you can use the Friend function.<\/li>\n<\/ul>\n<p><strong>Q.4<\/strong> What is the main difference between function overloading and operator overloading?<\/p>\n<p><strong>Ans.<\/strong> With the help of operator overloading, you can redefine the way how an operator works for user-defined types. For example, you can overload an operator \u2018+\u2019 in a class-like string to concatenate two strings with the help of \u2018+\u2019.<\/p>\n<p>In function overloading, the compiler will identify the appropriate function by examining the number of the types of parameters or arguments in the overloaded function. It also helps you in reducing the investment of different function names. With this, you can also perform similar functionality by more than one function.<\/p>\n<p>You do not have to change the fundamental language, it provides a pleasant appearance without it. Function calls that are equivalent are being provided syntactic sugar by all overloaded operators. Function overloading allows two or more functions with different types and the number of parameters have to be the same. You can redefine a function by using different types of arguments or by using a different number of arguments.<\/p>\n<p><strong>Q.5<\/strong> Can you compile a C++ program without the main() function in it?<\/p>\n<p><strong>Ans.<\/strong> Yes, you can compile a C++ program without the main() function. But the program will not execute after compiling.<\/p>\n<p>In a program code, main is known as the entry point. Instead of the main function, you can rename the main function as something else by recompiling the program code of the startup file. You can change the name of main to something if you make another language or hack the sources of these language compilers. You will face several dysfunctionalities because it will violate the C++ standards.<\/p>\n<p><strong>Q.6<\/strong> What will be the output of the following program?<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\nusing namespace std;\nint main()\n{\n int num[4]={4,5,6,8}, sum = 0;\n for (int i = 0; i &lt; 4; ++i)\n {\n sum += num[i];\n }\n cout &lt;&lt; \"Sum = \" &lt;&lt; sum &lt;&lt; endl;\n return 0;\n}\n<\/pre>\n<p><strong>Ans. <\/strong><br \/>\n<strong>Output:-<\/strong><br \/>\n23<\/p>\n<p><strong>Q.7<\/strong> Why do you use static members in C++?<\/p>\n<p><strong>Ans.<\/strong> A static member is allocated storage. It is mainly used for recording data common to all objects of a class. You can use a static member as a counter to store the number of objects of a particular class type which is created. You can call a static member function even if no objects of the class exist. Also, you can only access the static members using the class name and the scope resolution operator.<\/p>\n<p><strong>Q.8<\/strong> Can you use access specifiers to perform data hiding in C++?<\/p>\n<p><strong>Ans.<\/strong> Yes, you can use access specifiers to perform data hiding. These include private and protected. It is mainly used to perform data hiding in object oriented programming. There are three types of access specifiers such as private, public and protected. Data hiding maintains object integrity.<\/p>\n<p><strong>Q.9<\/strong> What is the output of the following program?<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;iostream&gt;\n#include&lt;math.h&gt;\nusing namespace std;\nint main()\n{\n  int num=10,num1=2,out;\n  \n  out = num*pow(num,num1);\n  out = out % 2;\n  out += 1;\n  cout&lt;&lt;out;\n  return 0;\n}\n<\/pre>\n<p><strong>Ans. <\/strong><br \/>\n<strong>Output:-<\/strong><br \/>\n1<\/p>\n<p><strong>Q.10<\/strong> What is the output of the following program?<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;iostream&gt;\nusing namespace std;\nint main(){\n   int n = 128,a=0;\n   int res = n\/a;\n   cout&lt;&lt;res;\n   return 0;\n}\n<\/pre>\n<p><strong>Ans.<\/strong> This program will give you an error. Because you are dividing a number by 0. It will throw you an exception.<\/p>\n<p><strong>Q.11<\/strong> Why do you use namespace in C++?<\/p>\n<p><strong>Ans.<\/strong> It is used to organize codes into logical groups and to prevent name collisions that can happen when your code includes multiple libraries. At namespace scope, all identifiers are visible to one another without qualification.<br \/>\nIt is a declarative space which provides a scope to the identifiers inside it.<\/p>\n<p>It works the same as the namespace. Usage of namespace is considered as a bad practice. The problem with putting \u2018using namespace\u2019 in the header files of your classes is that it forces anyone who wants to use your classes to also be using those other namespaces.<\/p>\n<h3>Intermediate C++ Programming Interview Questions Answers<\/h3>\n<p><strong>Q.12<\/strong> State the difference between delete[] and delete in C++?<br \/>\n<strong>Ans.<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>delete[]<\/b><\/td>\n<td><b>delete<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">This is used to release an array.\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400\">delete is used to release a unit of memory.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">It deallocates memory and calls destructors for an array of objects created with new[].<\/span><\/td>\n<td><span style=\"font-weight: 400\">It deallocates memory and calls the destructor for a single object created with new.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">You should always use delete to destroy the objects that are created with new.<\/span><\/td>\n<td><span style=\"font-weight: 400\">You should always use delete[] to destroy the arrays that are created with new[].<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">It is used for deleting an array through a pointer.<\/span><\/td>\n<td><span style=\"font-weight: 400\">It is used for one single pointer.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Q.13<\/strong> Write a program to check for equality without using arithmetic and comparison operators?<br \/>\n<strong>Ans.<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;iostream&gt;\nusing namespace std;\nint main(){\n   int a = 16;\n   int b = 13;\n   if ( (a ^ b) )\n  \tcout&lt;&lt;\"a is not equal to b\";\n   else\n  \tcout&lt;&lt;\"a is equal to b\";\n  \treturn 0;\n}\n<\/pre>\n<p><strong>Output:-<\/strong><br \/>\na is not equal to b<\/p>\n<p><strong>Q.14<\/strong> What is the usage of scope resolution operator in C++?<\/p>\n<p><strong>Ans.<\/strong> It is denoted by \u2018::\u2019. It is used to define the member function outside the class. This is a very important one when it comes to C++. This is also used to define a function outside of the class and used to access the static variables of the class.<\/p>\n<p>You have to be careful while using this operator. It will always call the global variable if the global variable has the same name as the local variable.<\/p>\n<p><strong>Q.15<\/strong> In C++, can you define a String Primitive data type?<\/p>\n<p><strong>Ans.<\/strong> No, you cannot have a string primitive data type in C++. But you can have a class from the Standard Template Library.<\/p>\n<p>Primitive data types are those data types which are used by users when creating variables in their program.<\/p>\n<p><strong>Example:-<\/strong><br \/>\nboolean<br \/>\nchar<br \/>\nbyte<br \/>\nlong<br \/>\nint<br \/>\nfloat<br \/>\nshort<\/p>\n<p><strong>Non Primitive data types:<\/strong><br \/>\nString<br \/>\narray<br \/>\nclass<br \/>\nenum<br \/>\netc.<\/p>\n<p><strong>Q.16<\/strong> What is the use of the Auto keyword in C++?<\/p>\n<p><strong>Ans.<\/strong> The keyword \u2018Auto\u2019 is used by default for various functions to make functions work automatically.<br \/>\nIn case of any functions, if the return type is auto then it will be evaluated by return type expression at runtime.<br \/>\nIt is a simple way to declare a variable that has a complicated type.<\/p>\n<p><strong>Example<\/strong>:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">auto a=10;<\/pre>\n<p><strong>Q.17<\/strong> When you use multiple inheritance, what is the problem you face?<\/p>\n<p><strong>Ans.<\/strong> When you inherit more than one class in the same derived class and all these base classes also inherit the same single class, multiple references of the super parent class become available to the derived class.<br \/>\nThat\u2019s why it becomes unclear to the derived class, which version of the super parent class it should refer to.<\/p>\n<p><strong>Q.18<\/strong> Can you overload a destructor?<\/p>\n<p><strong>Ans.<\/strong> With the help of destructors, you can easily deallocate memory. And it is also used to do other cleanup for a class object. It is called for a class object and when that object is explicitly deleted. It is a member function which is invoked when the object goes out of scope or if it is deleted by a call to delete.<\/p>\n<p>No, a destructor cannot be overloaded. It has the only form without the parameters. There should be only one empty destructor per class. And it must have a void parameter list.<\/p>\n<p>Destructor does not take any parameters and it also does not return anything. That\u2019s why there is the possibility of multiple destructors with different signatures in a class.<\/p>\n<p><strong>Example:- Overloading a destructor<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class Tech{\npublic:\n  Tech(){\n    cout&lt;&lt;\"constructor...\";\n  }\n  \/\/Destructor\n  ~Tech(){\n    cout&lt;&lt;\"Destructor...\";\n  }\n\n  ~Tech(int a){\n    cout&lt;&lt;\"Destructor overloaded...\";\n  }\n};\n\nint main(){\n  Tech obj;\n  return 0;\n}\n<\/pre>\n<p>The compiler will give you an error if we try to overload the destructor for the class Tech.<\/p>\n<p><strong>Output:-<\/strong><br \/>\nmain.cpp:13:5: error: &#8216;Tech::~Tech()&#8217; cannot be overloaded<br \/>\n~Tech(int a){<\/p>\n<p><strong>Q.19<\/strong> State the difference between C and C++?<\/p>\n<p><strong>Ans.<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>C<\/b><\/td>\n<td><b>C++<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">It does not support data hiding.<\/span><\/td>\n<td><span style=\"font-weight: 400\">This programming language supports data hiding.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Function and operator overloading is not supported in C.<\/span><\/td>\n<td><span style=\"font-weight: 400\">C++ supports function and operator overloading.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">C is a function driven language.<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u00a0This is an object driven language.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">C does not support inheritance.<\/span><\/td>\n<td><span style=\"font-weight: 400\">C++ supports inheritance.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">There is no direct support for exception handling in C.<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u00a0This supports Exception Handling.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">C contains 32 keywords.<\/span><\/td>\n<td><span style=\"font-weight: 400\">C++ contains 52 keywords.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">It does not reference variables.<\/span><\/td>\n<td><span style=\"font-weight: 400\">C++ supports the reference variables.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Q.20<\/strong> What is the output of the following program?<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;  \nusing namespace std;  \nint main()  \n{  \nint n=365, reverse=0, rem;    \nwhile(n!=0)    \n{    \nrem=n%10; \t \nreverse=reverse*10+rem;    \nn\/=10;    \n}\ncout&lt;&lt;reverse&lt;&lt;endl;\t \nreturn 0;  \n} \n<\/pre>\n<p><strong>Ans. <\/strong>563<\/p>\n<p><strong>Q.21<\/strong> What is the output of the following program?<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\nusing namespace std;\nint main() {\n    int  *ip = NULL;\n    cout &lt;&lt; ip;\n    return 0;\n}\n<\/pre>\n<p><strong>Ans. <\/strong>0<\/p>\n<p><strong>Q.22<\/strong> What will be the output of the following program?<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\nusing namespace std;\nint main() {\n  int a[] = {2,3,6,9};\n  cout &lt;&lt; (1 + 1)[a] + (a + 2)[1];\n}\n<\/pre>\n<p><strong>Ans. <\/strong>15.<\/p>\n<p>Explanation:- (1+1)[a] is equal to a[2]. And a[2] = 6.<br \/>\nAnd (a+2)[1] is equal to a[3]. And a[3] = 9.<\/p>\n<h3>C++ Language Advance Interview Questions<\/h3>\n<p><strong>Q.23<\/strong> What is the output of the following program?<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;iostream&gt;\nusing namespace std;\nint main()\n{\n  int dec=6, bin[10], i=0;\n  while(dec!=0)\n  {\n    \tbin[i] = dec%2;\n    \ti++;\n    \tdec = dec\/2;\n  }\n  for(i=(i-1); i&gt;=0; i--)\n    \tcout&lt;&lt;bin[i];\n  return 0;\n}\n<\/pre>\n<p><strong>Ans. <\/strong>110<\/p>\n<p><strong>Q.24<\/strong> Spot the error in the following code.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Tech *ptr = 0;\ndelete ptr;\n<\/pre>\n<p><strong>Ans.<\/strong> In the above example, the pointer is a null pointer. It is valid to call delete on a NULL pointer. So, there is nothing wrong in the above program.<\/p>\n<p><strong>Q.25<\/strong> Can you tell me the names of the operators which cannot be overloaded?<br \/>\n<strong>Ans.<\/strong><\/p>\n<ul>\n<li>sizeof:- sizeof operator<\/li>\n<li>. \u2013 Dot operator<\/li>\n<li>.*:- dereferencing operator<\/li>\n<li>-&gt;:- member dereferencing operator<\/li>\n<li>::- scope resolution operator<\/li>\n<li>?: \u2013 conditional operator<\/li>\n<\/ul>\n<p><strong>Q.26<\/strong> Does a derived class inherit or doesn\u2019t inherit?<\/p>\n<p><strong>Ans.<\/strong> The derived class basically inherits all the features and ordinary members of the base class. But a derived class does not inherit the base class\u2019s constructors and destructors.<\/p>\n<p>The derived class also does not inherit the assignment operator of the base class and friends of the class.<\/p>\n<p>For example, suppose the private stuff is:<br \/>\nint i;<br \/>\nand the class has a geti() and seti(). The value of i has to be put somewhere, even if it is private.<\/p>\n<p><strong>Q.27<\/strong> Does C++ support Exception handling?<\/p>\n<p><strong>Ans.<\/strong> Yes, C++ does support Exception handling.<\/p>\n<p>Sometimes when you execute a program, you may face exceptions like run-time abnormal conditions. It arises due to some abnormal conditions such as dividing a number by zero. It arises while a program is running.<br \/>\nIn C++, you can perform exception handling with the help of three keywords such as try, catch and throw.<\/p>\n<ul>\n<li>try:- Mainly used to represent a block of code which might throw an exception.<\/li>\n<li>catch:- block of code inside this keyword will get executed when an exception is thrown.<\/li>\n<li>throw:- Mainly used to throw an exception.<\/li>\n<\/ul>\n<p>When an exception occurs, the compiler will throw it. When an exception is thrown, the compiler has to ensure that it is handled properly. C++ uses three keywords to perform exception handling such as try, catch and throw.<\/p>\n<p><strong>Q.28<\/strong> State the difference between the internal and external iterator?<\/p>\n<p><strong>Ans.<\/strong> Iterator is an object and it points to an element inside the container. With the help of iterators, you can move through the contents of that container.<\/p>\n<p>An iterator which is implemented by the member functions of a class and has the iteration logic is known as internal iterator.<\/p>\n<p>An iterator which is implemented by a separate class and can be attached to the object is known as an external iterator. An external iterator is easy to implement.<\/p>\n<p>A big advantage of an external iterator is that you can make many iterators that can be active simultaneously on the same object.<\/p>\n<p><strong>Q.29<\/strong> What is the output of the following program?<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">main()\n {\nextern int i;\n cout&lt;&lt;i&lt;&lt;endl;\n }\nint i=20;\n<\/pre>\n<p><strong>Ans. <\/strong>20<\/p>\n<p><strong>Q.30<\/strong> Can you get the source code of a C++ program back from the binary file?<\/p>\n<p><strong>Ans.<\/strong> Yes, you can generate the source code from the binary file. It is called reverse engineering. There are many reverse engineering tools available such as ghidra, ida, cutter etc.<\/p>\n<p>You can use a decompiler but don&#8217;t expect it to produce compileable or readable code. If you lost your code and all you have is a binary, you&#8217;re in for a real hassle, sorry to say.<\/p>\n<p>Your best option is a decompiler. Several options, take a look here for a starting point :<\/p>\n<p>You will recover C code to some extent, but there is no way you will get any objects or proper source out of this. You will have to extensively edit the resulting output to get anything useful.<\/p>\n<h3>Summary<\/h3>\n<p>In this tutorial, we discussed some basic to advanced level interview questions. These questions will help you to prepare better for placements and interviews. Also it will help you to improve your basic understanding of the C++ programming language.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The C++ programming language contains vast concepts and useful topics. There are so many basic to advanced level questions from the C++ programming language. In this tutorial, we discussed some basic to advanced level&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":85251,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3405],"tags":[4335,4336,4337,4338],"class_list":["post-84440","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpp","tag-c-interview-questions","tag-c-programming-interview-questions","tag-c-interview-question-answer","tag-c-interview-questions-with-answers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C++ Interview Questions with Answers - TechVidvan<\/title>\n<meta name=\"description\" content=\"Check these C++ Interview Questions with Answers for beginners, intermediate &amp; advance level. These will help you to crack C Interviews.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ Interview Questions with Answers - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Check these C++ Interview Questions with Answers for beginners, intermediate &amp; advance level. These will help you to crack C Interviews.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-05T03:30:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/c-interview-questions.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ Interview Questions with Answers - TechVidvan","description":"Check these C++ Interview Questions with Answers for beginners, intermediate & advance level. These will help you to crack C Interviews.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/","og_locale":"en_US","og_type":"article","og_title":"C++ Interview Questions with Answers - TechVidvan","og_description":"Check these C++ Interview Questions with Answers for beginners, intermediate & advance level. These will help you to crack C Interviews.","og_url":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2021-10-05T03:30:23+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/c-interview-questions.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"C++ Interview Questions with Answers","datePublished":"2021-10-05T03:30:23+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/"},"wordCount":2415,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/c-interview-questions.jpg","keywords":["C Interview Questions","C Programming Interview Questions","C++ Interview Question Answer","C++ Interview Questions with Answers"],"articleSection":["C++ Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/","url":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/","name":"C++ Interview Questions with Answers - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/c-interview-questions.jpg","datePublished":"2021-10-05T03:30:23+00:00","description":"Check these C++ Interview Questions with Answers for beginners, intermediate & advance level. These will help you to crack C Interviews.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/c-interview-questions.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/c-interview-questions.jpg","width":1200,"height":628,"caption":"c++ interview questions"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/cpp-interview-questions-with-answers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"C++ Interview Questions with Answers"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/84440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=84440"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/84440\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/85251"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=84440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=84440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=84440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}