0% found this document useful (0 votes)
9 views

CPP Viva

Uploaded by

nitishrdx8136
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

CPP Viva

Uploaded by

nitishrdx8136
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

C++ Short Revision Notes

1. Who developed C++ language?

C++ was developed by Bjarne Stroustrup in 1979.

2. What are the rules of variables?

Variables must start with a letter or underscore, cannot use keywords, and must only contain

alphanumeric characters or underscores.

3. Name three unary operators.

Three unary operators are: ++ (increment), -- (decrement), and ! (logical NOT).

4. What is controlled loops and its type?

Controlled loops execute a block of code repeatedly. Types are: for, while, and do-while loops.

5. What is function overloading with a small example?

Function overloading allows multiple functions with the same name but different parameters.

Example:

int add(int a, int b) { return a + b; }

double add(double x, double y) { return x + y; }

6. What is recursion?

Recursion is a function calling itself to solve smaller instances of a problem.

7. What is inheritance? And its type.

Inheritance allows one class to acquire properties of another. Types: Single, Multiple, Multilevel,

Hierarchical, and Hybrid.

8. What is a class in C++?

A class is a blueprint for creating objects, encapsulating data and functions.


9. Why do we need C++?

C++ is needed for its efficiency, support for object-oriented programming, and system-level features.

10. What are access specifiers?

Access specifiers define the scope of class members. Types: public, private, and protected.

11. What are constructors and destructors?

Constructors initialize objects. Destructors clean up resources when an object is destroyed.

12. What is a friend function?

A friend function can access private and protected members of a class.

13. Different techniques for passing arguments in a function.

Techniques: Pass by Value, Pass by Reference, Pass by Pointer.

14. What is polymorphism, abstraction, and encapsulation?

Polymorphism: Using the same interface for different data types.

Abstraction: Hiding implementation details and showing only functionality.

Encapsulation: Binding data and functions together in a class.

15. Explain derived data types.

Derived data types are built from basic types. Examples: Arrays, Pointers, References.

16. What are operators in C++?

Operators are symbols for operations. Types: Arithmetic, Relational, Logical, Bitwise, Assignment,

etc.

17. What are strings and string data types?

Strings store sequences of characters. C++ provides std::string for string manipulation.

18. What are manipulators and common manipulators?


Manipulators adjust input/output. Common ones: endl, setw, setprecision.

You might also like