←Back to Subject
Notes
Notes
Study material and explanations
Diagrams
Diagrams
Visualize concepts easily
Mnemonics
Mnemonics
Tricks to remember faster
One Night Prep
One Night Prep
Short and focused revision
Revision
Revision
Quick summary and key points
Important Questions
Important Questions
Practice most relevant questions
Diagrams

Diagrams

Visual representations for Unit 1

Key Qualities of a Good Program

Key Qualities of a Good Program
1. Correctness & Accuracy
It must give 100% correct output for all valid inputs and handle edge cases properly.
2. Efficiency (Speed & RAM)
It should run fast (low CPU usage) and take as little memory (RAM) as possible.
3. Readability & Clean Code
Uses meaningful variable names, proper indentation, and comments so anyone can understand it easily.
4. Robustness (No Crashing)
Handles wrong user inputs (like typing text when a number is expected) without crashing suddenly.
Explanation
  • A correct program gives the required results for its supported inputs.
  • Clear structure and meaningful names help later readers check and change it.
Detailed Notes →Quick Revision →

The 6 Stages of Program Development

The 6 Stages of Program Development
Stage 1
Problem Definition
→
Stage 2
Algorithm & Flowchart
→
Stage 3
Coding / Writing Code
Stage 4
Compiling & Debugging
→
Stage 5
Testing & Verification
→
Stage 6
Documentation & Maintenance
Explanation
  • Define the problem and design a solution before coding it.
  • Test the result with representative inputs, then maintain it as needs change.
Detailed Notes →Quick Revision →

Standard Flowchart Symbols & Their Purpose

Standard Flowchart Symbols & Their Purpose
Oval / Rounded Box (Terminal)
Used for the START or STOP / END of the program.
Parallelogram (Input / Output)
Used for reading data from the user (INPUT A) or printing results (PRINT Sum).
Rectangle (Process)
Used for calculations and assigning values to variables (Sum = A + B).
Diamond (Decision / Condition)
Used for checking conditions (Is A > B?). It has two branch paths: YES or NO.
Arrows (Flowlines)
Shows the direction in which the program moves (usually top-to-bottom or left-to-right).
Small Circle (Connector)
Connects different parts of a big flowchart on the same page without crossing lines.
Explanation
  • The oval marks a start or end and the rectangle marks a processing step.
  • A diamond asks a question, with labelled arrows showing the possible outcomes.
Detailed Notes →Quick Revision →

Decision Flowchart: Finding the Largest of Three Numbers

Decision Flowchart: Finding the Largest of Three Numbers
01
Start & Input
Accept inputs A, B, and C
➔
02
Check A > B
Branch YES (test A vs C) or NO (test B vs C)
➔
03
Compare with C
Evaluate surviving candidate against C
➔
04
Print Largest & Stop
Output maximum value and terminate
Explanation
  • Compare the input values and follow the branch whose condition holds.
  • When values tie for the maximum, the reported maximum should still equal that shared value.
Detailed Notes →Quick Revision →

Milestones in the Evolution of C++

Milestones in the Evolution of C++
1979: 'C with Classes'
The first version was created by adding classes and basic inheritance to the standard C language.
1983: Renamed to C++
Rick Mascitti suggested the name C++. In C, ++ is the increment operator, meaning "C is upgraded to its next level!"
1985: First Release
First public version released along with Bjarne's famous textbook: 'The C++ Programming Language'.
1998 to Present
Standardized by ISO (C++98), followed by modern versions like C++11, C++14, C++17, and C++20.
Explanation
  • C++ grew from work that added class-based programming to C.
  • Later standards expanded the language and its standard library.
Detailed Notes →Quick Revision →

C++ Build Pipeline

C++ Build Pipeline
Source Code (.cpp)
Your original code
── Preprocessor ──▶
Expanded Code (.i)
Headers added, comments removed
── Compiler ──▶
Object Code (.obj / .o)
Machine code in binary
── Linker ──▶
Executable (.exe)
Ready to run program
Explanation
  • Preprocessing and compilation translate each source unit towards object code.
  • The linker resolves references and combines the required units into the program.
Detailed Notes →Quick Revision →

The 6 Categories of C++ Tokens

The 6 Categories of C++ Tokens
1. Keywords
Reserved words with fixed meanings that you cannot change (int, class, return, for).
2. Identifiers
Names that you give to variables, functions, and classes (rollNo, totalMarks, Student).
3. Constants (Literals)
Fixed values that never change during program execution (10, 3.14, 'A').
4. Strings
A sequence of characters written inside double quotes ("Hello Indore", "CampusNotes").
5. Operators
Symbols that perform calculations or comparisons (+, -, *, ==, ::).
6. Punctuators / Delimiters
Punctuation marks used to structure code (;, {, }, (, ), [, ]).
Explanation
  • The compiler reads tokens such as keywords, names, literals and operators.
  • Punctuation separates or groups those tokens into valid statements.
Detailed Notes →Quick Revision →

Classification of C++ Data Types

Classification of C++ Data Types
1. Basic (Built-in) Types int, char, float, double, void, bool (Primitive core system types).
2. User-Defined Types struct, union, enum, class, typedef (Custom structures designed by developers).
3. Derived Types Arrays ([]), Functions, Pointers (*), References (&) built on base types.
Explanation
  • Fundamental types represent basic values and compound types combine or refer to other types.
  • Classes and enumerations let a programmer define types suited to the problem.
Detailed Notes →Quick Revision →

Four Key Roles of the Scope Resolution Operator (::)

Four Key Roles of the Scope Resolution Operator (::)
1. Access Global Variables
Accesses a global variable when a local variable has the same name (::count).
2. Define Functions Outside Class
Tells C++ which class a member function belongs to (void Student::display()).
3. Access Static Class Members
Calls static variables or functions without creating an object (Math::pi).
4. Namespace Resolution
Tells the compiler which library namespace to use (std::cout).
Explanation
  • The scope operator identifies the scope where a name should be looked up.
  • It can qualify class members, namespace members or a global name hidden locally.
Detailed Notes →Quick Revision →

Control Flow Categories in C++

Control Flow Categories in C++
1. Selection (Decision-Making)
Runs a specific block of code based on whether a condition is true or false (if, if-else, switch).
2. Iteration (Loops)
Repeats a block of code multiple times until a condition becomes false (for, while, do-while).
3. Jump Statements
Jumps directly to another part of the program (break, continue, return).
Explanation
  • Sequence runs statements in order and selection chooses a branch.
  • Iteration repeats a block while its controlling rule allows it.
Detailed Notes →Quick Revision →

Loop Categorization by Condition Check Point

Loop Categorization by Condition Check Point
Entry-Controlled (Pre-Test) Loops
The condition is checked BEFORE entering the loop body. If the condition is false at the start, the loop runs 0 times.
• while loop
• for loop
Exit-Controlled (Post-Test) Loops
The condition is checked AFTER the loop body runs. Even if the condition is false, the loop runs at least once!
• do-while loop
Explanation
  • Entry-controlled loops test before running the body.
  • An exit-controlled do-while loop executes the body at least once.
Detailed Notes →Quick Revision →

Loop Control Flow: Break vs Continue

Loop Control Flow: Break vs Continue

break Statement

  • Terminates the loop immediately upon evaluation.
  • Jumps completely past the loop's closing curly brace }.
  • Remaining iterations are canceled.

continue Statement

  • Skips only the remaining statements in the current iteration.
  • Directly triggers the increment step and next condition check.
  • The overall loop continues executing.
Explanation
  • Break leaves the nearest enclosing loop or switch.
  • Continue skips the rest of the current loop iteration and proceeds towards the next test.
Detailed Notes →Quick Revision →