UNIT I
1. Procedural vs OOP Programming
Procedural
Aspect OOP (Object-Oriented Programming)
Programming
Approach Top-down Bottom-up
Focus Functions Objects and Classes
Data Access Global access Controlled via access specifiers
More (through inheritance &
Reusability Less
polymorphism)
Example
C C++, Java
Language
2. Keywords vs Identifiers
Keywords Identifiers
Reserved by language User-defined names
Cannot be used as names Can be used to name variables, etc.
Example: int, return Example: age, sum, Student
3. Constants vs Variables
Constants Variables
Value cannot change Value can change
Declared using const Declared normally
Example: const int x = 5; Example: int y = 10;
4. Types of Operators
Operator Type Example Description
Arithmetic +, - Math operations
Relational >, == Comparison between values
Logical &&, `
5. while vs do-while vs for loop
Loop Type Entry/Exit Check Use Case
while Entry-controlled Unknown iterations
Loop Type Entry/Exit Check Use Case
do-while Exit-controlled At least one execution guaranteed
for Entry-controlled Known/fixed number of iterations
UNIT II
6. 1D vs 2D Arrays
1D Array 2D Array
Single row of elements Table-like (rows × columns)
int arr[5]; int arr[3][4];
7. Encapsulation vs Information Hiding
Encapsulation Information Hiding
Binding data and functions Hiding internal details from user
Achieved using private/protected
Achieved through classes
access
8. Class Scope vs Scope Resolution Operator
Class Scope Scope Resolution Operator (::)
Used to access class or global
Lifetime and visibility of members
members
Defined by access specifiers Used outside the class
UNIT III
9. Call by Value vs Call by Reference
Call by Value Call by Reference
Address (reference) is
Copy of data is passed
passed
Changes affect original
Original data remains unchanged
data
void fun(int x) void fun(int &x)
10. Function Overloading vs Overriding
Function Overloading Function Overriding
Same name & parameters, in derived
Same name, different parameters
class
Within same class Across base and derived classes
11. Inline vs Virtual Functions
Inline Function Virtual Function
Late binding (runtime call
Code is expanded at call
resolution)
Reduces function call overhead Supports polymorphism
12. Automatic vs Static vs External Variables
Storage
Type Lifetime Scope
Location
Automatic Function/block Stack Local to block
Static Entire program Static storage Local but retains value
External Entire program Global memory Across multiple files
UNIT IV
13. Constructor vs Destructor
Constructor Destructor
Cleans up when object is
Initializes object
destroyed
Has same name as class Prefixed with ~
Can be overloaded Cannot be overloaded
14. Default vs Copy vs Parameterized Constructor
Constructor Type Description
Default No arguments
Copy Copies another object
Parameterized Takes arguments to initialize data members
15. Single Inheritance vs Multiple Inheritance
Single Inheritance Multiple Inheritance
One base class More than one base class
Simple hierarchy Complex hierarchy, possible ambiguity
16. Constructor Overloading vs Function Overloading
Constructor Overloading Function Overloading
Multiple functions with same
Multiple constructors with parameters
name
Used for object creation Used for code flexibility
9. Class vs Object
Class Object
Blueprint/template Instance of a class
Defines structure Represents actual data
No memory allocated Memory allocated when object is created
Example: class Car { ... }; Example: Car c1;