CoolInterview.com - 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
COOLINTERVIEW.COM PROGRAMMING LANGUAGES INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS 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: CoolInterview.com
Question: What are the main underlying concepts of object orientation?

Answer:
Objects, messages, class, inheritance and polymorphism are the main concepts of object orientation.
Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
Question: Describe Stacks and name a couple of places where stacks are useful.


Answer:
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: CoolInterview.com
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: CoolInterview.com
Question: STL Containers - What are the types of STL containers?

Answer:

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: CoolInterview.com
Question: What are the differences between a C++ struct and C++ class?




Answer: The default member and base-class access specifiers are different. Source: CoolInterview.com
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: CoolInterview.com
Question: What are the differences between a C++ struct and C++ class?


Answer: The default member and base-class access specifies are different.
This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifies, member functions, overloaded operators, and so on. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defau Source: CoolInterview.com
Question: What is a conversion constructor?


Answer: A constructor that accepts one argument of a different type. Source: CoolInterview.com
Question: State the methods through which parameters can be passed?

Answer: Parameters can be passed by using any one of the following mechanism.
Value: -They are sometimes called in or out parameters; therefore, the data can be transferred into the method but cannot be transferred out.
Reference: -Are sometimes called in or out parameters, therefore, the data can be transferred into the method and out again.
Output: -Are sometimes called out parameters, data can be transferred out of the method. Source: CoolInterview.com
Question: How can you tell what shell you are running on UNIX system?

Answer:

You can do the Echo $RANDOM. It will return a undefined variable if you are from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -l and look for the shell with the highest PID. Source: CoolInterview.com
Question: What is the difference between an object and a class?


Answer:
Classes and objects are separate but related concepts. Every object belongs to a class and every class contains one or more related objects.
- A Class is static. All of the attributes of a class are fixed before, during, and after the execution of a program. The attributes of a class don't change.
- The class to which an object belongs is also (usually) static. If a particular object belongs to a certain class at the time that it is created then it almost certainly will still belon Source: CoolInterview.com
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: CoolInterview.com
Question: What is a dangling pointer?



Answer:
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
{
public:
int *ptr;
Sample(int i)
{
ptr Source: CoolInterview.com
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: CoolInterview.com
Question: Assignment Operator - What is the diffrence between a "assignment operator" and a "copy constructor"?




Answer:
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: CoolInterview.com

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.390869 Seconds