COMP SCIENCE REVISION PDF
Document Details
Uploaded by SaneCreativity474
Tags
Summary
This document provides a revision resource for computer science covering topics such as computer systems architecture, software development methodologies, and data representation. It's a useful resource for students studying computer science concepts.
Full Transcript
1.1 Computer Systems 1.1.1 Structure and Function of the Processor Key Components: 1. Control Unit: Manages the execution of instructions by coordinating data flow and operations within the CPU. 2. Arithmetic Logic Unit (ALU): Executes arithmetic (e.g., addition, s...
1.1 Computer Systems 1.1.1 Structure and Function of the Processor Key Components: 1. Control Unit: Manages the execution of instructions by coordinating data flow and operations within the CPU. 2. Arithmetic Logic Unit (ALU): Executes arithmetic (e.g., addition, subtraction) and logical (e.g., AND, OR) operations. 3. Registers: Small, high-speed storage locations for intermediate data (e.g., Program Counter for tracking instructions, Accumulator for storing results of operations). 4. Cache: High-speed storage that stores frequently accessed instructions or data, reducing latency. 5. Buses: Data Bus: Transfers data. Address Bus: Carries memory addresses for read/write operations. Control Bus: Sends control signals to coordinate actions. Fetch-Decode-Execute Cycle: 1. Fetch: Instruction is fetched from memory using the Program Counter. 2. Decode: Instruction is interpreted into control signals. 3. Execute: Instruction is carried out (e.g., calculation, data movement). 1.1.2 Types of Processor CISC (Complex Instruction Set Computing): ○ Large set of instructions, some performing complex tasks. ○ Easier for programmers but slower execution due to more cycles per instruction. RISC (Reduced Instruction Set Computing): ○ Simplified instruction set; each instruction executes in one clock cycle. ○ Requires more instructions but is faster and more power-efficient. Parallel Processing: ○ Uses multiple cores or processors to perform tasks simultaneously, enhancing performance for multi-threaded applications. 1.1.3 Input, Output, and Storage Input Devices: Convert user input into digital signals (e.g., keyboards, microphones, sensors). Output Devices: Present processed data to users (e.g., monitors, speakers, printers). Primary Storage: ○ RAM: Volatile memory used for temporary data storage during processing. ○ ROM: Non-volatile memory storing permanent data like the BIOS. Secondary Storage: ○ HDD: Magnetic storage, slower but cost-effective for large capacities. ○ SSD: Flash-based storage, faster and more durable but more expensive per GB. Tertiary Storage: ○ Used for archiving and backups (e.g., optical discs, magnetic tape). 1.2 Software Development 1.2.1 Systems Software Operating Systems (OS): ○ Provides an interface between hardware and software. ○ Key Functions: Memory Management: Allocates and deallocates memory. Multitasking: Manages multiple programs simultaneously. File System Handling: Organizes and retrieves files from storage. ○ Examples: Windows, macOS, Linux. Utility Software: ○ Performs maintenance tasks (e.g., antivirus scans, disk defragmentation, file compression). 1.2.2 Applications Generation Types of Applications: ○ Custom: Built for a specific user or task (e.g., bespoke business software). ○ Off-the-Shelf: Pre-made, generic solutions (e.g., Microsoft Office). ○ Open Source: Free to use and modify (e.g., LibreOffice). ○ Proprietary: Licensed, closed-source software (e.g., Adobe Photoshop). 1.2.3 Software Development Stages: ○ Analysis: Determine user requirements and constraints. ○ Design: Create diagrams (e.g., flowcharts, UML) and pseudocode to plan solutions. ○ Implementation: Write code in a suitable programming language. ○ Testing: White-box: Tests internal logic. Black-box: Tests inputs and expected outputs. ○ Maintenance: Corrective: Fix bugs. Adaptive: Modify for new environments. Perfective: Improve performance or features. Methodologies: ○ Waterfall: Linear and sequential, good for small, well-defined projects. ○ Agile: Iterative and collaborative, better for dynamic requirements. 1.2.4 Types of Programming Language Low-Level Languages: ○ Machine Code: Binary instructions directly executed by the CPU. ○ Assembly Language: Human-readable mnemonics translated into machine code. High-Level Languages: ○ Easier to code and debug (e.g., Python, Java). ○ Portable across systems. Declarative Languages: ○ Focus on the desired outcome, not the process (e.g., SQL for databases). Imperative Languages: ○ Specify step-by-step instructions for solving problems. 1.3 Data Representation and Networks 1.3.1 Compression, Encryption, and Hashing Compression: ○ Lossless: Reconstructs original data perfectly (e.g., PNG, ZIP). ○ Lossy: Discards non-essential data for smaller file sizes (e.g., MP3, JPEG). Encryption: ○ Symmetric: Uses the same key for encryption and decryption; faster but less secure. ○ Asymmetric: Uses a pair of keys (public and private) for secure communication (e.g., HTTPS). ○ Applications: Securing online transactions, emails. Hashing: ○ Converts input data into fixed-size hashes (e.g., SHA-256). ○ Used for password storage, data integrity checks. 1.3.2 Databases Key Concepts: ○ Primary Key: Unique identifier for a record. ○ Foreign Key: Ensures referential integrity by linking tables. ○ Normalization: 1NF: Eliminate repeating groups. 2NF: Remove partial dependencies. 3NF: Remove transitive dependencies. ○ SQL Commands: SELECT, INSERT, UPDATE, DELETE for data manipulation. CREATE, ALTER, DROP for structure definition. 1.3.3 Networks Network Types: ○ LAN: Connects devices in a limited area (e.g., office). ○ WAN: Connects devices over large areas (e.g., the internet). Topologies: ○ Star: Devices connect to a central hub. ○ Mesh: Devices connect to each other directly, offering redundancy. Protocols: ○ HTTP/HTTPS: Web communication. ○ FTP: File transfer. ○ SMTP: Email communication. Network Security: ○ Firewalls: Block unauthorized access. ○ VPNs: Secure remote access. ○ MAC Address Filtering: Restricts network access to authorized devices. 1.4 Computational Thinking and Programming 1.4 Data Types Common Types: ○ Integer, Real/Float, Boolean, Character, String. ○ Casting: Explicitly converting between data types (e.g., int to string). 1.4.2 Data Structures Arrays: Contiguous memory locations; fast for indexed access. Records: Structured grouping of related data. Stacks: LIFO; useful for backtracking, recursion. Queues: FIFO; used in scheduling, buffering. Linked Lists: Dynamic memory allocation; efficient insertion/deletion. Graphs: Represent networks; nodes connected by edges. Trees: Hierarchical; binary trees commonly used in searching. SLR 14: Data Structures Binary trees: Enable efficient searching and sorting. Hash tables: Map keys to values for quick lookups (e.g., dictionaries in Python). SLR 8: Introduction to Programming Key Concepts: ○ Variables, constants, and data types. ○ Iteration: Loops (for, while). ○ Selection: Conditional statements (if-else). ○ Functions: Modularize code for reusability and clarity. ○ Recursion: Solve problems by defining smaller instances of the same problem.