Programming Fundamentals
Table of Contents
1 Week 1: 4
1.1 Intro to Problem Solving 4
1.1.1 Intro to Problem Solving 4
1.2 Von-Neumann architecture: 4
1.3 Intro to Programming: 4
2 Week 2 5
2.1 Intro to Programming (Continued) 5
2.2 Compiler and Linker: 5
2.3 Introduction to Algorithms: 5
3 Week 3 6
3.1 Variables and Data Types 6
3.2 Operators 6
3.3 Conditional Statements: 6
4 Week 4 7
4.1 Nested Conditional Statements: 7
4.2 Repetitive Statements: 7
4.3 Pretest loops in c++: 7
5 Week 5 8
5.1 Nested Pretest Loops in c++: 8
5.2 Posttest Loops: 8
5.3 Quiz 1 (Conditional and Repetitive Statements) 8
6 Week 6 9
6.1 List Data Structure: 9
6.2 List Data Structure (Continued): 9
6.3 Dimensional Arrays: 9
7 Week 7 10
7.1 Dimensional Arrays (Continued): 10
7.2 Modular Programming: 10
7.3 Functions and Basic Modules: 10
8 Week 8 11
8.1 Organising Code into Multiple Files: 11
8.2 Quiz 2 (Arrays and Functions): 11
8.3 Stacks and Programming Stack Management: 11
9 Week 9 12
9.1 The Call Stack: 12
9.2 Stack Overflow and Infinite Executions: 12
9.3 Characters in c++: 12
10 Week 10 13
10.1 C-style Strings 13
10.2 C++ String Class (std::string): 13
10.3 Working with std::string: 13
11 Week 11 14
11.1 Working with std::string (Continued) 14
11.2 String Manipulation: 14
11.3 String Comparisons: 14
12 Week 12 15
12.1 String Conversion 15
12.2 Pointers: 15
12.3 Quiz 3 (Characters and Strings) 15
13 Week 13 16
13.1 Pointers (Continued): 16
13.2 References 16
13.3 Pointers vs Arrays: 16
14 Week 14 17
14.1 Dynamic Memory Allocation: 17
14.2 Static Memory Allocation 17
14.3 Quiz 4 (Pointers and Dynamic Memory Allocation) 17
15 Week 15 18
15.1 Intro to File I/O: 18
15.2 Working With Text Files: 18
15.3 Reading from Text Files: 18
16 Week 16 19
16.1 Writing to Text Files: 19
16.2 Error Handling in File Operations: 19
16.3 File Management Operations: 19
1 Week 1:
1.1 Intro to Problem Solving
1.1.1 Intro to Problem Solving
● What is problem solving
● Why is it important?
● How do we approach a problem?
● Divide and Conquer
● How is problem solving attached to programming?
1.2 Von-Neumann architecture:
● Computer Organisation
● Fixed Program computers, Stored program computers
● Von-Neumann architecture and Modern Computers
● Basic Structure of Von-Neumann Architecture
● CPU
● Control Unit
● Arithmetic and Logic Unit
● Registers
● Buses
● Input output devices
● Von Neumann bottleneck
1.3 Intro to Programming:
● Introduction to Programming Languages
● What is a programming language?
● How does a programming language work?
● CPU and programming language
● Hierarchy of Programming Language
● Key Features of Programming Languages
● Basic Example of a code
2 Week 2
2.1 Intro to Programming (Continued)
● Characteristics of Programming Languages
● Basic Terminologies in programming
● Advantages of programming
● Introduction to pseudocode
● Problem solving in pseudocode
● Examples of problems solved in pseudocode
● Approaching a problem before programming
2.2 Compiler and Linker:
● Hierarchy of Programming Language
● Source Code
● Executable Generation
● High and Low Level programming Languages
● Basic Intro to Assembly
● Compiler
● Assembler
● Linker
● Loader
● Role of Executable Generation Flow
2.3 Introduction to Algorithms:
● Intro to Algos
● Algos and pseudocode
● Flow of problem solution in pseudo code
● Introduction to c++
● Intro to text editors and IDEs
● Installation of c++ and c++ compilers (g++/gcc)
● Installation of Code blocks (IDE)
3 Week 3
3.1 Variables and Data Types
● Intro to data types
● Data Types Properties
● Data Types Usage
● Variables and Memory
● Code Execution Flow
● Performing Basic Arithmetic Operations
● Program Input Output
● Running Code in c++
● Examples and Usage
3.2 Operators
● Logical Operators
● Arithmetic Operators
● Comparative Operators
● Creating a Basic Calculator (Example + practical)
● Celsius to Fahrenheit Conversion (Example + Practical)
3.3 Conditional Statements:
● Overview of Conditions
● If statements
● Conditional Operators
● else statements
● else if statements
● Difference between if if and if, else if statements
4 Week 4
4.1 Nested Conditional Statements:
● What is nesting?
● Nested conditional statements
● Handling Nesting conditional statements
4.2 Repetitive Statements:
● What are repetitive statements
● Flow of repetitive statements
● Usage of repetitive statements
● pseudo logic of how it works
● Repetitive Structure and code blocks
● Types of Repetition Structures
● Loops
● Pretest Loop and Posttest Loop
● Conditioning and Counter control in loops
4.3 Pretest loops in c++:
● While Loop in c++
● Counter controlled while loops
● Sentinel-Controlled while Loops
● Flag-Controlled while Loops:
5 Week 5
5.1 Nested Pretest Loops in c++:
● Nested While loops
● Flow control of nested loops
● For loops in c++
● Nested for loops in c++
5.2 Posttest Loops:
● do while loop in c++
● Conditioning for do while loops
● Alter Loop flow
● Break and Continue Statements
5.3 Quiz 1 (Conditional and Repetitive Statements)
6 Week 6
6.1 List Data Structure:
● Memory Organization
● How does a program manages memory
● Memory Allocation and deallocation
● Arrays in c++
● Memory Management of arrays
● Array Initialisation
● Adding elements in an array
6.2 List Data Structure (Continued):
● Elements removal in an array
● Array deletion
● Array Length and Looping through an Array
● Practice problems on array
6.3 Dimensional Arrays:
● Types of arrays
● One dimensional arrays
● Two dimensional arrays
● Initialisation and assignment of 2d-arrays
● Accessing elements from 2d-arrays
7 Week 7
7.1 Dimensional Arrays (Continued):
● Element addition/deletion in 2d-arrays
● Looping through a 2d-array
● Basic overview of multi-dimensional arrays
● Why multi-dimensional arrays
7.2 Modular Programming:
● Definition and concept
● Advantages of modular programming
● Code reusability.
● Easier maintenance
● Improved readability
● Simplified debugging
● Comparing monolithic vs. modular approaches
7.3 Functions and Basic Modules:
● Function declaration and definition
● Function prototypes
● Function parameters and return values
● Scope and lifetime of variables
● Pass by value vs. pass by reference
8 Week 8
8.1 Organising Code into Multiple Files:
● Header files (.h)
● Purpose and structure
● Source files (.cpp)
● Compiling and linking multiple files
● Avoiding naming conflicts
8.2 Quiz 2 (Arrays and Functions):
8.3 Stacks and Programming Stack Management:
● What is a stack
● Real world examples
● LIFO principle
● Push pop peek and empty stack
● Visualizing stack operations
9 Week 9
9.1 The Call Stack:
● Definition and purpose
● How functions use the call stack
● Stack frames: local variables and return addresses
● Tracing a simple program's execution
● Drawing stack frames for nested function calls
● Stack Rolling and Unrolling
9.2 Stack Overflow and Infinite Executions:
● Recap of Stacks
● What causes stack overflow
● Example of infinite recursion causing stack overflow
● Importance of base cases
9.3 Characters in c++:
● Introduction to the char data type\
● Definition and size
● ASCII values
● Character literals and escape sequences
● Basic character operations
● Input/output of characters
● Character comparison
10 Week 10
10.1 C-style Strings
● Definition of C-style strings
● Null-terminated character arrays
● Declaring and initializing C-style strings
● Common pitfalls and limitations
● Basic operations on C-style strings
● 1. Reading and writing
● 2. Finding string length (strlen())
● 3. Copying strings (strcpy())
● 4. Concatenating strings (strcat())
● 5. Comparing strings (strcmp())
10.2 C++ String Class (std::string):
● Introduction to the string class
● Advantages over C-style strings
● Including the <string> header
10.3 Working with std::string:
● Declaring and initializing strings
● Basic string operations
● Accessing individual characters ([] operator)
● Finding string length (length() or size())
● Concatenation (+ operator and append())
11 Week 11
11.1 Working with std::string (Continued)
● Substring extraction (substr())
● Finding substrings (find())
● Input and output with strings
● Using cin and cout
11.2 String Manipulation:
● Modifying strings
● Inserting (insert())
● Erasing (erase())
● Replacing (replace())
● Transforming strings
● Changing case (toupper(), tolower())
● Trimming whitespace
11.3 String Comparisons:
● Comparing strings (==, !=, <, >, etc.)
● Case-sensitive vs. case-insensitive comparison
12 Week 12
12.1 String Conversion
● Converting between C-style strings and std::string
● Converting numbers to strings (to_string())
● Converting strings to numbers (stoi(), stod(), etc.)
12.2 Pointers:
● Brief overview of RAM
● Concept of memory addresses
● Variables and memory locations
● What is a pointer?
● Definition and purpose
● Pointer declaration syntax
● Address-of operator (&)
● Dereferencing operator (*)
12.3 Quiz 3 (Characters and Strings)
13 Week 13
13.1 Pointers (Continued):
● Null pointers and their importance
● Pointer arithmetic (brief introduction)
● Common pointer errors and how to avoid them
● Intro to References
13.2 References
● Definition and purpose
● Reference declaration syntax
● Differences between pointers and references
● When to use references vs. pointers
● Recap of Pass by Reference to function
13.3 Pointers vs Arrays:
● Relationship between arrays and pointers
● Array decay to pointers
● Pointer arithmetic with arrays
14 Week 14
14.1 Dynamic Memory Allocation:
● Stack vs. Heap memory
● The 'new' operator
● Allocating single objects
● Allocating arrays
● The 'delete' operator
● Deallocating single objects
● Deallocating arrays (delete[])
● Common dynamic memory errors
● Memory leaks
● Dangling pointers
14.2 Static Memory Allocation
● Definition and characteristics
● Static variables in functions
● Static class members
● Pros and cons of static allocation
14.3 Quiz 4 (Pointers and Dynamic Memory Allocation)
15 Week 15
15.1 Intro to File I/O:
● Importance of file operations in programming
● Types of files (text vs. binary)
● File streams in C++
● ifstream (input file stream)
● ofstream (output file stream)
● fstream (input/output file stream)
15.2 Working With Text Files:
● Opening a file
● Using constructors
● Using open() function
● Closing a file (close() function)
● Checking file open status (is_open())
● File modes (ios::in, ios::out, ios::app, etc.)
15.3 Reading from Text Files:
● Reading character by character (get())
● Reading word by word (>>)
● Reading line by line (getline())
● Reading until end-of-file
● Error handling while reading
16 Week 16
16.1 Writing to Text Files:
● Writing using insertion operator (<<)
● Formatting output (setw, setprecision, etc.)
● Writing line by line
16.2 Error Handling in File Operations:
● Checking for successful open/close operations
● Handling read/write errors
● Using exceptions with file streams
16.3 File Management Operations:
● Checking if a file exists
● Renaming files
● Deleting files