C++ Introduction Questions & Answers
1. Introduction to C++
Q: What is C++?
C++ is a general-purpose, object-oriented programming language that extends C with features like classes, inheritance, polymorphism, and templates. It combines low-level memory control with high-level abstractions, making it suitable for system programming, game development, and efficient DSA implementations.
Q: What is the history of C++?
- Developed in 1979: Created by Bjarne Stroustrup at Bell Labs as "C with Classes".
- Renamed C++ in 1983: The
++reflects incrementing C's capabilities. - Standardization:
- C++98: First ISO standard.
- C++11: Introduced
auto, lambdas, smart pointers. - Later standards: C++14, C++17, C++20, C++23.
Q: Can you give an example of a basic C++ program?
#include <iostream>
using namespace std;
int main() {
cout << "Welcome-to-Code-Verse!" << endl;
return 0;
}
Output:
Welcome-to-Code-Verse!
Frequently asked questions
What is C++?
C++ is a general-purpose, object-oriented programming language that extends C with classes, inheritance, polymorphism, and templates.
Why is C++ popular for DSA and competitive programming?
C++ is fast, offers low-level control, and provides the Standard Template Library (STL) which simplifies implementation of data structures and algorithms.