C++ Interview Questions and Answers for Freshers - 2
Question: 6
What is the difference between a copy constructor and an overloaded assignment operator?
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.
Question: 7
What is a modifier?
A modifier, also called a modifying function is a member function that changes the value of at least one data member.
In other words, an operation that modifies the state of an object. Modifies are also known as ‘mutators’.
Question: 8
What is function overloading and operator overloading?
Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This capability is called function overloading. When an overloaded function is called, the C++ compiler selects the proper function by examining the number, types and order to the arguments in the call. Function overloading is commonly used to create several functions of the same name that perform similar tasks but on different data types.
Operator overloading – allows existing C++ operators to be preferred so that they work on objects of user defined classes. Overloaded operators are syntactic sugar for equivalent function calls. They form a pleasant façade that doesn’t add anything fundamental to the language (but they can improve understandability and reduce maintenance costs).
Question: 9
Explain Copy Constructor?
It is a constructor which initializes its object member variable with another object of the same class.
If you don’t implement a copy constructor in your class, the compiler automatically does it.
Question: 10
What is the type of ‘this’ pointer?
It is a constant pointer type. It gets created when a non static member function of a class is called.
- C++ Interview Questions and Answers for Experienced
- Top 200+ C++ Interview Questions and Answers
- C++ Interview Questions and Answers for Freshers
- Advanced C++ Programming Interview Questions and Answers
- C++ Language Interview Questions for Experienced Pdf
- C++ Programs Asked in Interview for Freshers
- C++ Interview Questions and Answers Pdf
- C++ Language Interview Questions and Answers for Freshers Pdf
- C++ Questions and Answers
- Top 250+ C++ Constructor and Destructor Programming Interview Questions
- C++ basic interview questions and answers pdf
- C++ Programming Interview Questions and Answers
- C++ Technical Interview Questions and Answers
- Top 200+ Advanced C++ Interview Questions 2020-2021
- C++ Lab Viva-Practical Exams Questions and Answers
- C++ Coding Interview Questions and Answers
Agricultural Engineering MCQ Questions & Answers Pdf More
Surveying and Levelling Agricultural Engineering MCQ Questions More
Electromagnetic Induction Questions & Answers Pdf More
A.C. Basics and Networks Quiz Questions & Answers Pdf More
Signals and Systems Quiz Questions and Answers Pdf More
Scientific Instruments Quiz Pdf More
Top 200+ Advanced C# Interview Questions 2019-2020 More
100+ SBI Computer Knowledge Questions and Answers Pdf More
Top 101+ Puzzle Test Questions and Answers pdf More
1000+ Banking Previous Year Question Paper Pdf More