By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Q 1. What is C++ & why it is used? C++ is an object-oriented programming language. It is a middle-level programming language designed by Bjarne Stroustrup in the year 1979 in Bell Laboratories. As an object-oriented language, C++ has features like Inheritance, Polymorphism, Encapsulation, and Abstraction.
C++ is used to teach the graphics libraries in high-level applications and the applications that are used to communicate with devices over the network.
When C++ was developed its name was C with classes, and it was built as an extension to the C language, but later it was named C++ in 1983 which means the increment of C by 1.
Q 2. What is the latest version on C++? The latest version of C++ is ISO/IEC 14882:2017 which is also known as C++17. This is the fifth edition.
Q 3. Explain the difference between C & C++. C Programming Language Vs C++ Programming Language
1. C is a procedural programming language - C++ is a procedural and object-oriented programming language2. The data and functions are different entities - C++ data and functions both are encapsulated together into an object3. Functions cannot be defined inside the structures - Functions can be described inside the structures4. The information cannot remain hidden so that it can be manipulated by another code - Encapsulation hides the data thus protecting the data to get used by another code
Q 4. What are the advantages of C++? Explain. The benefits of C++ language are:
Faster compared to high-level languages. can be executed on many devices and is easily portable. very good in individual bit changes, so it is perfect for hardware device drivers. great function Library fast and quick language Allows the function overloading.
Q 5. Why is C++ called OOPs? Explain. C++ is called OOPs because it supports Object-oriented Programming which means C++ looks into the problem regarding objects rather than the procedure for doing that problem.
Q 6. What is oops and list its features in C++? OOPS stands for Object-Oriented Programming.OOPS refers to the programming in which programming is based on the objects that can contain data and code rather than based on the functions and procedures.
Features of OOP: Object Class Data Hiding and Encapsulation Dynamic Binding Message Passing Inheritance Polymorphism
Q 7. Please explain Class & Object in C++. Class: Class is the collection of the same type of objects and objects are the variables of the type Class and once the Class has been defined any number of objects can be added to that same class. For examples Eagle, Sparrow, Pigeon, Crow are the objects of the Class Bird
Objects: Object is the collection of the entities, and the objects occupy the space in the memory. An object contains data and code. When any program is executed the objects interact with each other by sending the messages without knowing their data and code.
Q 8. What is polymorphism & list its types in C++? The simple meaning of polymorphism is more than one form. In C++ a program can have more than one function with the same name that can perform different activities
Types of polymorphism in C++:
ad-hoc polymorphism parametric polymorphism subtype polymorphism
Q 9. What is namespace & why it is used in C++?
A namespace is a declarative region that provides a scope to the identifiers (the names of types, functions, variables, etc) inside it. Namespaces are used to organize code into logical groups and to prevent name collisions that can occur especially when your code base includes multiple libraries.
Q 10. What is a Loop? What are different types of loops in C++? In C++ loop is used to perform specific repetitive tasks until a condition is satisfied.
Types Of Loops:
1.FOR LOOP for ( variable initialization; condition; variable update ) { // Code to execute while the condition is true }
2. WHILE LOOP while ( condition ) { // Code to execute while the situation is true };
3. DO-WHILE LOOP do { } while ( condition );
Q 11. Please explain the reference variable in C++. Reference variable in C++ is used to give the alternative name to the already defined variable. There is one condition that the reference variable must be initialized at the time of declaration. The reference variables are declared by putting '&' in the constitution
Q 12. What are member functions used in C++? A member function of a class in C++ is a function that has its definition or its prototype within the class like any other variable. Member function operates on an object of the quality of which it is a member, and it has access to all the members of a class for that object.
A member function can be defined inside the class and outside the class.
Q 13. What do you mean by public protected and private in C++?
In C++, there are three access specifiers: public - members are accessible from outside the class. private - members cannot be accessed (or viewed) from outside the class. protected - members cannot be accessed from outside the class, however, they can be accessed in inherited classes.
Q 14. What do you mean by 'this' pointer? In C++ every object can access its address through this pointer, in other words, it holds the address of the current object or points to the current object.
Q 15. Explain the difference between class and struct in C++.
Class Vs Structure1. Members of Class are Private - Members of Class are Public2. Declared as Class - Declared as Struct3. Used for a more significant amount of Data - Used for a smaller amount of Data4. Supports Inheritance - Does not support Inheritance5. The object is created on the Heap memory - The objective is formed on the Stack Memory
Other useful C++ interview questions:
Q 16. What do you mean by volatile and mutable keywords used in C++?
Q 17. What is a storage class used in C++?
Q 18. What do you mean by inline function in C++?
Q 19. What do you mean by overhead in C++?
Q 20. Explain the difference between realloc() and free() in C++?
Q 21. What do you mean by inheritance in C++? Explain its types.
Q 22. What is constructor and destructor in C++?
Q 23. Explain the difference between new() and malloc() in C++?
Q 24. What do you mean by friend class & friend function in C++?
Q 25. What do you mean by function overriding & function overloading in C++?
Q 26. What is copy constructor? Can we make copy constructor private in C++?
Q 27. Explain the difference between Abstract class and Interface in C++?
Q 28. What do you mean by Vtable and VPTR in C++?
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.