- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
C++ Interview Questions & Answers - Learning Mode

C++ Interview Questions & Answers - Learning Mode

C++ is an object oriented programming (OOP) language, developed by Bjarne Stroustrup, and is an extension of C language. It is therefore possible to code C++ in a "C style" or "object-oriented style." It has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation. It was designed with a bias toward system programming and embedded, resource-constrained and large systems, with performance, efficiency and flexibility of use as its design highlights.

Try C++ Interview Questions & Answers - Exam Mode
Subcategories for C++ Interview Questions & Answers - Learning Mode

Following are sub categories for which Interview Questions & Answers are available under C++ Interview Questions & Answers - Learning Mode. Please select the appropriate sub-category:-

Arrays, Strings, Pointers and References in C++ Interview Questions & Answers (48) Learning Mode | Exam Mode

C++ Basics Interview Questions & Answers (66) Learning Mode | Exam Mode

Control Flow in C++ Interview Questions & Answers (3) Learning Mode | Exam Mode

Exceptions in C++ Interview Questions & Answers (5) Learning Mode | Exam Mode

Functions in C++ Interview Questions & Answers (27) Learning Mode | Exam Mode

Inheritance in C++ Interview Questions & Answers (30) Learning Mode | Exam Mode

Input and Output Operations in C++ Interview Questions & Answers (12) Learning Mode | Exam Mode

Object Oriented Programming in C++ Interview Questions & Answers (42) Learning Mode | Exam Mode

Operator Overloading in C++ Interview Questions & Answers (18) Learning Mode | Exam Mode

Operators in C++ Interview Questions & Answers (24) Learning Mode | Exam Mode

Templates in C++ Interview Questions & Answers (12) Learning Mode | Exam Mode

Variables in C++ Interview Questions & Answers (13) Learning Mode | Exam Mode

Virtual Functions in C++ Interview Questions & Answers (26) Learning Mode | Exam Mode

1 2 3 4 5 6 7 8 9 10 11 12 Next

Sort By : Latest First | Oldest First | By Rating

C++ Interview Questions & Answers - Learning Mode
Try C++ Interview Questions & Answers - Exam Mode
Question: What are the advantages of operator overloading?

Answer: Operator overloading is used to provide some extra features, behaviors and abilities to the users of a particular class. This feature in C++ helps in controlling the functions performed by an operator and reduces the chance of occurrence of errors in a program. Source:
Question: What are the advantages of using cin and cout compared to scanf(...) and printf(...), respectively?

Answer: Compared to the standard C functions printf() and scanf(), the usage of the cin and cout is more type safe.
The format strings, which are used with printf() and scanf() can define wrong format specifies for their arguments, for which the compiler does not warn.
In contrast, argument checking with c in and cout is performed by the compiler.
C in and Cout are stream classes that could be used to receive and print objects respectively. Source:
Question: What are the main underlying concepts of object orientation?

Objects, messages, class, inheritance and polymorphism are the main concepts of object orientation.
Question: What is the difference between a copy constructor and an overloaded assignment operator?

Answer: A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class. Source:
Question: Why are arrays usually processed with for loop?

Answer: he real power of arrays comes from their facility of using an index variable to traverse the array, accessing each element with the same expression a[i]. All the is needed to make this work is a iterated statement in which the variable i serves as a counter, incrementing from 0 to a.length -1. That is exactly what a loop does. Source:
Question: What?s the auto keyword good for?

Answer: Not much. It declares an object with automatic storage duration. Which means the object will be destroyed at the end of the objects scope. All variables in functions that are not declared as static and not dynamically allocated have automatic storage duration by default.

For example
int main()
int a; //this is the same as writing ?auto int a;?
} Source:
Question: Anything wrong with this code?
T *p = 0;
delete p;

Answer: Yes, the program will crash in an attempt to delete a null pointer. Source:
Question: Describe Stacks and name a couple of places where stacks are useful.

A Stack is a linear structure in which insertions and deletions are always made at one end, called the top. This updating policy is called last in, first out (LIFO). It is useful when we need to check some syntex errors, such as missing parentheses. Source:
Question: STL Containers - What are the types of STL containers?


There are 3 types of STL containers:

1. Adaptive containers like queue, stack
2. Associative containers like set, map
3. Sequence containers like vector, deque Source:
Question: What is difference between template and macro ?

Answer: A template can be used to create a family of classes or function.A template describes a set of related classes or set of related functions in which a list of parameters in the declaration describe how the members of the set vary.
Identifiers that represent statements or expressions are called macros. Source:
Question: What are the advantages and disadvantages of B-star trees over Binary trees?


B-star trees have better data structure and are faster in search than Binary trees, but it?s harder to write codes for B-start trees.

The major difference between B-tree and binary tres is that B-tree is a external data structure and binary tree is a main memory data structure. The computational complexity of binary tree is counted by the number of comparison operations at each node, while the computational complexity of B-tree is determined by the disk I/O, that is, the numbe Source:
Question: What is polymorphism?

Answer: Polymorphism is the idea that a base class can be inherited by several classes. A base class pointer can point to its child class and a base class array can store different child class objects. Source:
Question: What do you mean by Stack unwinding?

It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught. Source:
Question: What is a conversion constructor?

Answer: A constructor that accepts one argument of a different type. Source:
Question: What is the difference between class and structure?

Answer: Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. The major difference is that all declarations inside a structure are by default public.
Class: Class is a successor of Structure. By default all the members inside the class are private. Source:
Question: What are the differences between a C++ struct and C++ class?

Answer: The default member and base-class access specifiers are different. Source:
Question: Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

Answer: Merge sort always makes recursive calls to sort sub arrays that are about half size of the original array, resulting in O(n log n) time. Source:
Question: What is a dangling pointer?

A dangling pointer arises when you use
the address of an object after
its lifetime is over. This may occur
in situations like returning
addresses of the automatic variables
from a function or using the
address of the memory block after
it is freed. The following
code snippet shows this:

class Sample
int *ptr;
Sample(int i)
ptr Source:
Question: Assignment Operator - What is the diffrence between a "assignment operator" and a "copy constructor"?

In assignment operator, you are assigning a value to an existing object. But in copy constructor, you are creating a new object and then assigning a value to that object. For example:

complex c1,c2;
c1=c2; //this is assignment
complex c3=c2; //copy constructor Source:
Question: What happens when a function throws an exception that was not specified by an exception specification for this function?

Answer: Unexpected() is called, which, by default, will eventually trigger abort(). Source:

1 2 3 4 5 6 7 8 9 10 11 12 Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.40625 Seconds