Dear User,if you are preparing for interviews looking for most asked c++ interview question,so you landed on right platform.
here we will provide you top 50+ question which help you to crack any interviews easily.
1) What is C++ language?
C++ is an object oriented programming language which is superset of c .
it support all feature of OOPS like Inheritance,Abstraction,polymorphism etc.
2) Who is the founder of C++ language?
3) when it was developed?
4) what are the key feature of C++ programming?
feature of C++ progamming:
1-it is object oriented programming language that mean it support feature like abstraction,encapsulation,polymorphism etc.
2-it support data hiding ,so that program will become secure.
3-it support the feature of reusability.
4-it is platform independent that mean program can run only platform .
5) what are the advantages of c++?
it has various advantages:
1-it has standard template library ,which provide lots of premium data structure like vector,map.
2-it is easier to manage with the help of classes and object.
3-it supports OOPS concept,which provide feature like Inheritance,Polymorphism,Abstraction,Encapsulation.
6) What is the difference between C and C++?
|1-it is procedural language.||1-it is object oriented language.|
|2-it was developed by dennis ritchie.||2-it was developed by bjarne stroustrop.|
|3-it does not support data hiding.||3-it support data hiding|
|4-scanf and printf is used for input and output.||4-cin and cout is used for input and output.|
7) define class?
class is a user defined data type which is blueprint of object.
it is declared with class keyword.
8) define object?
Object is an abstract data type which is instance of class.
.9) What are C++ access specifiers ?
access specifiers is used to define accessibility of class.by default variable and function are declared private.
there are three access specifier:
1-public: member which declare public are accessible outside the class.
2-private:member which declared private are only accessible within class.
3-protected:member which declare protected are acccessible in derived class.
10)what is OOPS?
OOPS stand for Object oriented programming which provide the feature of abstraction,encapsulation,polymorphism,inheritance.
11)explain encapsulation.with real life example?
Encapsulation is a process in which data and their function are bind together to form a single unit.
A mobile number stores the contact detail in digital format and convert it into human readable form.and we dont know how mobile number is stored .and how it is converted in human readable form.
12)explain polymorphism.with real life example?
polymorphism is a process which has the ability to keep same thing in multiple form.
A person is a son of his father ,husband of his wives and at the same time he is employee of company.that mean a person can exist in many form in a same time.
13)explain inheritance.with real life example?
Inheritance is a process in which a class derived the properties from another class or parent class.
like in our family ,our parent are super class and we are the child class because we are inheriting properties from our parent.
14 explain abstraction.with real life example?
Abstraction is a process in which we hide the implementation detail of the code and we are showing only the important detail to the end user.
if we take a example of motor bike,we know when we increase the accelerator then speed automatically increase but we dont know how it is happening .this is when abstraction come in play it hide the background detail and show only important info.
15)difference between malloc and new?
|1-malloc is an function||1-new is an operator|
|2-return void||2-return datatype|
16)difference between delete and free?
|1-delete is an operator.||1-free is an function|
|2-delete call destructor||2-free does not calll destructor.|
17)what is inline function?
The inline function in c++ is used to increase the execution time of program.
18)what is virtual function?
Virtual function is a function which is declared in base class and overriden by the derived class.
19)what is constructor?
constructor is a member function which initialize when object is created.
20)what is copy constructor?
copy constructor is a constructor which initialise the object by another object of the same class.
21)what is default constructor?
default constructor is a constructor which has no arguments.
22)what is parametrized constructor?
parametrized constructor is a constructor which has argument .
23)what is friend function?
when any function is declared as friend,it can access private and protected member of the class.
A function start with friend keyword is known as friend function.
24)what is friend class?
friend class is a class which start with the friend keywords . it can acess private and protected member of the class.
25)what are the type of polymorphism?
there are two type of polymorphism.
1-static polymorphism .
2-run time polymorphism.
26)what are runtime polymorphism?
Runtime polymorphism are the polymorphism which resolved at runtime.
overriding is an example of static polymorphism.
27)what are static polymorphism?
static polymorphism are the polymorphism which resolved at compile time.
overloading is an example of static polymorphism.
28)what is function overloading?
when function with same name but with different argument are there then it is called function overloading.
29)what is operator overloading?
operator overloading allow to define new data type from the builtin data type.
30)difference between overloading and overriding?
In overloading, we define two or more method in the same class by same name but diffrent argument is called overloading.
In overriding,if the method name and parameter are same in super class and the child class is called overriding.
31)can we make copy constructor private?
yes,we can make copy constructor.
33)define namespace in c++?
namespace is a region which provide scope to identifier.
34)what is full form of stl?
STL stands for standard template library.
35)when should we use multiple inheritance?
when we have to inherit the property from more than one class theen we use multiple inheritance.
36)what is destructor?
destructor is a function which automatically invokes to destroy object.
37)explain this pointer?
this pointer refer to the own address of the object of class.
38)what is scope of variable?
A scope of variable refer to the visibility of program .there are basically two type of scope of variables ,one is global scope variable which is accessed throughout the program. and another is local scope variabe which is accessed inside a particular block or function.
39)What is the difference between delete and delete?
delete operator is used to delete non array object where delete operator is used to delete array object.
40)What is a pure virtual function?
A pure virtual function is a function which is declared 0.
41)what is volatile keyword?
volatile keyword applies on variable,which tells the compiler that value may change at any time.
42))difference between structure and class in c++?
|1-struct keyword used||1-class keyword used.|
|2-it is a data type which store the various data type.||2-it is blueprint of object|
|3-by default member are public.||3-by default member are private.|
43)what is pointer
Pointer is a variable which store the address of another variable.The variable that store the address value is known as pointer.
44)what is dangling pointer?
A pointer which point to a memory location that is already deleted by some other pointer is called dangling pointer.
45)What is a Reference Variable in C++?
reference variable is another variable having the same name.
46)What is a Storage Class? Mention the Storage Classes in C++.
Storage classes describe the properties of variables and function.
type of storage class:
47)What is the keyword auto for?
The keyword auto tells that the particular variable will not be accessible outside the function,all the local variables are called as auto variable because they are not accessible outside the block.
48)What is a template?
template are present in c++,which provide us a feature to write a generic program.
49)What is Exception Handling? Does C++ support Exception Handling?
Exception Handling is defined as the process in which we handle exception /error while executing the program.
yes c++ support exception handling.
try ,throw and catch block is used to handle exception in c++.
50) What is a Standard Template Library (STL)?
STL stands for standard template library.it is a library in c++ which provide various data structure and function like vector,list,map,deque,set.
51)What are the various types of STL Containers?
There are various type of STL Container-
3-Unordered Associative container