1. Networking Definition Connecting two or more computing devices to share resources (data, hardware) and exchange information. 2. Distributed Computing A system where components located on networked computers communicate and coordinate their actions by passing messages. Goal: achieve a common task. 3. LAN vs. WAN Feature LAN (Local Area Network) WAN (Wide Area Network) Scope Small geographical area (e.g., office, home) Large geographical area (e.g., cities, countries) Speed Higher Lower (comparatively) Ownership Private Private or Public (ISP) Technology Ethernet, Wi-Fi DSL, Fiber, Satellite 4. Client/Server Network A network architecture where clients (end-user devices) request services or resources from servers (powerful computers providing resources). 5. Centralized Computing All processing, data storage, and management occur on a single, powerful central computer. Terminals connect to this central machine. 6. Applications of Networking Resource Sharing: Printers, files, internet connection. Communication: Email, instant messaging, video conferencing. Data Sharing: Databases, shared documents. E-commerce: Online shopping, banking. Entertainment: Online gaming, streaming. 7. Protocol A set of rules governing the exchange of data between devices in a network. Examples: TCP/IP, HTTP, FTP. 8. C++ Data Types Primary (Built-in) int : Integers (e.g., $5, -10$). char : Single characters (e.g., $'A', 'z'$). float : Single-precision floating-point numbers (e.g., $3.14f, -0.5f$). double : Double-precision floating-point numbers (e.g., $3.14159, 0.001$). bool : Boolean values ($true, false$). void : Absence of type. Derived Arrays, Pointers, References. User-Defined Structures, Unions, Classes, Enums. 9. Integer and Real Constants Integer Constant A fixed whole number without a fractional part. Decimal: $123, -456$ Octal (prefix $0$): $012$ (decimal $10$) Hexadecimal (prefix $0x$): $0xA$ (decimal $10$) Real Constant (Floating-point) A fixed number with a fractional part. Standard: $3.14, -0.001$ Exponential: $2.5e-3$ (means $2.5 \times 10^{-3}$) 10. Define Variable A named memory location used to store data. Its value can change during program execution. 11. Variable Declaration Specifying the data type and name of a variable before its first use. int age; float price; char grade; Initialization (optional) int count = 10; double pi = 3.14159; 12. Keywords in C++ Reserved words that have special meaning to the compiler and cannot be used as identifiers (variable names, function names, etc.). Examples: int , float , if , else , while , for , class , public , private . 13. Structure of a C++ Program // Header files #include <iostream> // For input/output operations // Global declarations (optional) const double PI = 3.14; // main function - entry point of program int main() { // Variable declarations int number = 10; // Executable statements std::cout << "Hello, C++!" << std::endl; std::cout << "Number: " << number << std::endl; // Return statement return 0; // Indicates successful execution } 14. Insertion and Extraction Operators Insertion Operator ($<<$) Used with cout to send data to the standard output stream (e.g., console). std::cout << "Value: " << 10; Extraction Operator ($>>$) Used with cin to read data from the standard input stream (e.g., keyboard) into a variable. int x; std::cin >> x; 15. Operators and Types Operator: A symbol that performs an operation on one or more operands. Types Arithmetic: $+, -, *, /, \%, ++, --$ Relational: $==, !=, >, <, >=, <=$ Logical: $&& (AND), || (OR), ! (NOT)$ Bitwise: $&, |, \wedge, \sim, <<, >>$ Assignment: $=, +=, -=, *=, /=, \%=$ Conditional (Ternary): $? :$ 16. Increment and Decrement Operators Increment ($++$) Increases the value of an operand by 1. Prefix: $++a$ (increments, then uses value) Postfix: $a++$ (uses value, then increments) int x = 5; int y = ++x; // x is 6, y is 6 int z = x++; // x is 7, z is 6 Decrement ($--$) Decreases the value of an operand by 1. Prefix: $--a$ Postfix: $a--$ 17. Control Structure Statements that alter the normal sequential flow of execution in a program. Types Sequence: Statements executed one after another. Selection (Decision): if , if-else , switch . Iteration (Looping): for , while , do-while . 18. If and If-Else Statement if statement Executes a block of code if a condition is true. if (condition) { // code to execute if condition is true } Example: int score = 85; if (score > 70) { std::cout << "Pass" << std::endl; } if-else statement Executes one block if condition is true, another if false. if (condition) { // code if true } else { // code if false } Example: int age = 16; if (age >= 18) { std::cout << "Eligible to vote" << std::endl; } else { std::cout << "Not eligible to vote" << std::endl; } 19. Switch Statement Allows a variable to be tested for equality against a list of values (cases). switch (expression) { case value1: // code block 1 break; case value2: // code block 2 break; // ... default: // code block if no match } 20. Break and Continue Statement break : Terminates the innermost loop ( for , while , do-while ) or switch statement and transfers control to the statement immediately following the loop/switch. continue : Skips the rest of the current iteration of the innermost loop and proceeds to the next iteration. 21. Scope Resolution Operator ( :: ) Used to define a function outside a class or to access a global variable when there is a local variable with the same name. int count = 10; // Global variable void func() { int count = 5; // Local variable std::cout << "Local count: " << count << std::endl; std::cout << "Global count: " << ::count << std::endl; } // Class method definition outside class class MyClass { public: void display(); }; void MyClass::display() { // ... } 22. Characteristics of Algorithm Unambiguous: Each step must be clear and have only one meaning. Input: Zero or more well-defined inputs. Output: One or more well-defined outputs. Finiteness: Must terminate after a finite number of steps. Feasibility: Must be able to be executed with available resources. Independence: Steps should be independent of any programming language. 23. Algorithm for Swapping Two Numbers START Read two numbers, say $A$ and $B$. Declare a temporary variable, say $TEMP$. Assign $TEMP = A$. Assign $A = B$. Assign $B = TEMP$. Print $A$ and $B$. STOP 24. Algorithm to Check if a Number is Prime START Read a number, say $N$. If $N \le 1$, print "$N$ is not prime" and go to step 8. Initialize $i = 2$. While $i \times i \le N$: If $N \pmod i == 0$, print "$N$ is not prime" and go to step 8. Increment $i$ by $1$. Print "$N$ is prime". STOP 25. Define Flowchart and Symbols Flowchart: A graphical representation of an algorithm or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows.