Comprehensive Computer Science Study Notes for Class 12

Chapter 1: Data Basics

  • Data: A collection of facts, figures, and statistics related to an object that can be processed to produce meaningful information. In an organization, data is an asset facilitating effective management operation. It provides a view of past activities and assists in future decision-making, reporting, and graph generation.
  • Information: The manipulated and processed data is called information (e.g., student result percentages). It refers to facts and statistics that are precisely meaningful to people and is considered the output of a specific process.
  • Operations: The manipulation of data (captured from various sources) to achieve required objectives. A series of actions/operations are performed on raw data using software/programs to convert it into meaningful information.
    • Data Capturing: Recording or capturing data in some form (via source documents or input devices) before processing.
    • Data Manipulation:
    • Classifying: Organizing data into groups/classes using numeric, alphabetic, or alphanumeric codes.
    • Calculations: Arithmetic manipulation of data.
    • Sorting: Arranging data in a logical numeric or alphabetic sequence.
    • Summarizing: Reducing masses of data to a concise, usable form.
  • Managing Output Results:
    • Storing and Retrieval: Retaining data for future reference and accessing or fetching it.
    • Communication and Reproduction: Transferring data from one location to another or copying/duplicating it for further processing.

Traditional File System

  • Record: A collection of related fields (facts about something) treated as a single unit. For example, an employee's biographic record includes Employee Number, Name, Grade, Designation, Date of Joining, and Qualification.
  • File (Data Set): A collection of related records treated as a single unit (e.g., the bio-information file of all bank employees).
  • File Types by Usage:
    • Master File: The latest updated files that maintain information remaining constant over long periods. Updated via adding, deleting, or editing records.
    • Transaction File: Used to record data prior to processing. It can be temporary until the master file is updated or permanent for transaction history.
    • Backup File: Permanent files created using specific utilities to protect vital organizational data.
  • File Types by Function:
    • Filenames consist of two parts separated by a dot: name and extension.
    • Program Files: Contain software instructions. Extensions include .com (source) and .exe (executable).
    • Data Files: Created by software. Examples: Word Processor (.doc, .rtf), Spread Sheet (.xls, .wks), Database (.dat, .dbf, .mdb).
    • Other Types: ASCII/Text (.txt), Image (.tif, .jpg, .eps, .gif, .bmp), Audio (.wav, .mid), Video (.avi, .mpg).
  • File Organization (Storage Point of View):
    • Sequential Files: Records are stored and created in the order they are entered. Requires more processing time.
    • Direct or Random Files: Records reside on storage media according to an address calculated from a key field. This can lead to "synonyms."
    • Indexed Sequential: Key fields are stored separately with the record address. Allows both sequential and random processing; faster than pure sequential but requires more storage space.

Databases and DBMS

  • Database: A collection of logically related data sets or files used for specific purposes (e.g., a bank’s database containing separate files for Savings, Auto Loans, and Personal Loans). It provides facilities for:
    • Adding blank files.
    • Inserting, retrieving, updating, and deleting data.
    • Removing files.
  • Database System Components:
    • Data: The information.
    • Hardware: Secondary storage, I/O devices, device controllers, processors, main memory.
    • Software: User/system software, utilities, and programs.
    • Personnel: Programmers/Analysts, End users, and Database Administrators (DBA).
  • Database Objectives:
    • Data Integration: Coordinating information from different files as if they were a single centralized file.
    • Data Integrity: Maintaining consistency by keeping only one copy of data; if a change occurs, it is reflected everywhere.
    • Data Interdependence: Allows program modification without reorganizing data and vice versa.
  • Database Models:
    • Hierarchical Model: Shaped like an organizational chart (Inverted Tree) with a "Root" at the top. Each node has only one parent.
    • Network Model: Similar to Hierarchical but entities may participate in multiple subordinate relationships, providing more flexibility.
    • Relational Model: Consists of simple files/Relations (Entities) without structural or pointer-chain connections. Relationships are based on data content.
  • Database Management System (DBMS): A collection of programs used for storing and manipulating integrated, cross-referenced data to minimize duplication.
    • Objectives: Shareability (simultaneous access), Availability, Evolvability (responsiveness to growth), and Database Integrity.
    • Advantages: Data Independence, Support for Complex Relationships, Sophisticated Security (field-level control), Backup/Recovery (logging changes), and Advanced Reporting/Ad-hoc capabilities.
    • Disadvantages: System Overhead, Staff Training requirements, potential for costly conversion if the wrong model is selected, centralized responsibility, and the need for a Data Dictionary.
  • Features of DBMS:
    • Data Dictionary: Stores definitions/structures (field names, sizes, types).
    • Utilities: For maintenance, backup, and recovery.
    • Query Language: Structured Query Language (SQL) for creating and updating via commands like SELECT, DELETE, CREATE, MODIFY, UPDATE, and INSERT.
    • Report Generator: For designing on-screen or printed formatted documents.
    • Access Security/Backup and Recovery: Assigning privileges and reinstatement after failure.

Chapter 2: Basic Concepts and Terminology of Databases

  • Terminology Shift:
    • Field: Unit of data consisting of characters; referred to as Data Item, Attribute, or Column.
    • Record: Collection of related data items; referred to as Row or Tuple.
    • File: Collection of related records; referred to as Table, Relation, or Data Object.
    • Database: A collection of tables and other data objects.
  • Data Handling in FMS: Records use fixed- or variable-length byte sequences. Field names are used as "name references" in programs, but values flow as memory contents.
  • Table Properties:
    • No duplicate rows exist (requires a unique key).
    • Order of Rows and Columns is insignificant.
    • Columns/Attributes are Elemental (Atomic); intersections must have single values.
  • View: A dynamic, virtual description of relations not stored permanently but constructed as needed via SQL for security and safe access.
  • Indexes: Tables created by developers/DBAs containing key attributes to facilitate fast processing and data association.
  • Keys:
    • Primary Key: Uniquely identifies a row in a relation (e.g., PATNO in a Patient table).
    • Secondary Key: Non-unique field used for alternate scanning or retrieval.
    • Candidate/Alternate Key: Fields that possess the uniqueness property and could serve as a primary key.
    • Composite/Concatenate Key: Consists of two or more attributes to ensure uniqueness.
    • Sort/Control Key: Used to physically sequence stored data.
    • Foreign Key: An attribute in a dependent table that matches a primary key in a parent table; establishing 1:1 or 1:M relationships.
  • Personnel Roles:
    • User: Person using the system for education, tasks, or entertainment.
    • Data Administrator (DA): Responsible for entire organizational data, functional requirements, and standards.
    • Database Administrator (DBA): Responsible for design, implementation, maintenance, security, and intricacies of the DBMS.

Chapter 3: Database Design Process

  • Phase 1: Initial Investigation:
    • Feasibility Study: Area identification, selection, and market analysis.
    • Requirements Analysis: Gathering input/output needs and restrictions.
    • Project Planning: Scheduling, cost factor analysis (salaries, hardware, etc.).
    • Data Analysis: Uses tools like Data Flow Diagrams (DFD), Decision Tables, and Decision Trees.
  • Phase 2: Data Modeling:
    • Identifies data objects (Entities like Teacher, Student), Attributes (Name, Nationality), and Relationships.
    • Cardinality: Expresses the number of occurrences (One-to-One, One-to-Many, Many-to-Many, Recursive, or None).
    • Modality: Defines the nature as Mandatory (1) or Optional (0).
  • Phase 3: Database Design:
    • Conceptual (Logical) Design: Mapping models to structures.
    • Steps: Represent Entities (Primary Key identification), Represent Relationships (Foreign Key placement), Merge Relations (View Integration to remove redundancy), and Normalize.
    • Physical Design: Implementing stored records, files, and recovery mechanisms.
    • Data Distribution Strategy:
      • Centralized: All data at one site; suffers from high communication costs and total failure risk.
      • Partitioned: Divided into fragments at different sites.
      • Replicated: Full copies at multiple sites; ensures access but complicates updates.
      • Hybrid: Critical fragments are replicated; non-critical are stored at only one site.
    • File Organization: Arranging records on secondary storage for fast access, high throughput, and space efficiency.
    • Integrity Constraints: Ensuring correctness via consistency rules.
  • Phase 4: Implementation: Linking servers with thousands of users, often involving Network Administrators and expensive telecommunication links (examples: NADRA, CRICKINFO).

Chapter 4: Data Integrity and Normalization

  • Integrity Constraints:
    • Entity Integrity: Primary key attributes cannot contain null values.
    • Referential Integrity: A foreign key must either match a primary key value in its home relation or be completely null.
  • Normalization: Converting complex data structures into simple, stable ones by analyzing functional dependencies.
    • Functional Dependency: B is functionally dependent on A (A→BA \rightarrow B) if A uniquely determines B.
    • Common Errors: Synonyms (different names for same info), Homonyms (same name for different info), Redundancy (storing same info in different forms), and Mutually Exclusive Data (multiple flags for one category).
  • Normalization Stages:
    • First Normal Form (1 NF): No repeating groups; all domains contain atomic values. Each entity must have a unique key.
    • Second Normal Form (2 NF): In 1 NF and every non-key attribute is fully functionally dependent on the whole primary key (removes partial functional dependencies).
    • Third Normal Form (3 NF): In 2 NF and no transitive dependencies exist (non-key attributes must not depend on other non-key attributes).
  • Anomalies:
    • Insertion Anomaly: Cannot enter a record without providing required keys.
    • Deletion Anomaly: Losing unrelated vital information when a record is deleted.
    • Modification Anomaly: Requiring updates in multiple records for a single change.

Chapter 5: Introduction to Microsoft Access

  • MS Access: A powerful Rational Database Management System (RDBMS).
  • Benefits: Sample databases, Wizards for automated creation, Graphical Relationship Window, integration with MS Office (Word/Excel), Macros for automation, SQL support, and redundancy control.
  • Database Window Objects:
    • Tables: Fundamental objects for data storage in rows (records) and columns (fields).
    • Queries: Stored requests to extract, filter, or calculate data from one or more tables.
    • Forms: User interface for entering, editing, and viewing data.
    • Reports: Presenting retrieved data in a formatted, printable way.
    • Macros/Modules: Automation and VBA programming.

Chapter 6: Table and Query

  • Table Characteristics: Each cell has one value, distinct column names, order of rows/columns is immaterial, and no duplicate rows.
  • Terminology:
    • Degree: Number of fields (columns).
    • Cardinality: Number of records (rows).
  • Data Types:
    • Text: Letters/numbers up to 255 chars.
    • Memo: Descriptive text up to 64,000 chars.
    • Number: For mathematical calculations (Byte: 1-255, Integer: −32,768-32,768 to 32,76732,767, Long Integer: −2,147,483,648-2,147,483,648 to 2,147,483,6472,147,483,647, Single/Double/Decimal types).
    • Date/Time: For dates and times.
    • Currency: Monetary values with signs and decimals.
    • AutoNumber: Unique integers assigned automatically.
    • Yes/No: Binary values (True/False).
    • OLE Object: Sound, pictures, or documents from other programs.
    • Hyperlink: Paths to files or URLs.
  • Field Properties:
    • Format: Custom symbols (e.g., > for uppercase, < for lowercase).
    • Input Mask: Controlling input format (e.g., telephone masks).
    • Validation Rule: Criteria to restrict data entry.
  • Query Types:
    • Select Query: Retrieves data for viewing/updating.
    • Action Queries: Delete, Update, Append.
    • Crosstab/Parameter Queries: Calculation and user-prompted requests.
  • Calculations: Sum, Avg, Min, Max, Count, StDev, Var.

Chapter 7: Microsoft Access-Forms and Reports

  • Form Layouts: Columnar (one record at a time), Tabular (multiple records in rows), Datasheet (worksheet view), Justified (across the screen).
  • Controls: Text boxes (edit data), Labels (field names), Combo/List boxes (finite value choices), Option groups (radio buttons), Command buttons (macro triggers).
  • Subforms: Placed in a main form to show One-to-Many relationships.
  • Reports: Printed output retrieved from tables/queries. Can be Columnar or Tabular.
  • Switchboard: A startup form for application navigation.
  • Shortcuts: CTRL+O (Open), CTRL+S (Save), CTRL+P (Print), ALT+F9 (Compile), F1 (Help).

Chapter 8: Getting Started with C

  • History: Developed by Dennis Ritchie in 1972 at AT&T Bell Labs. Derived from language B (Ken Thompson, 1969-1970).
  • Turbo C++ IDE:
    • Steps: Creating (New), Saving (extension .c), Compiling (Alt+F9 into .obj), Linking (Linker creates .exe), Executing (Ctrl+F9).
  • C Structure:
    • Preprocessor Directives: Commands starting with # for the preprocessor (e.g., #include <stdio.h>, #define PI 3.14).
    • main Function: Entry point void main(void).
    • Delimiters: { } and Statement Terminator: ;.
  • Errors:
    • Syntax Error: Grammar violation detected during compilation.
    • Runtime Error: Illegal operation (e.g., division by zero) during execution.
    • Logical Error: Faulty algorithm; most difficult to detect as the program runs but produces wrong output.

Chapter 9: Elements of C

  • Identifiers: Standard (predefined meanings like printf) and User-defined (memory names). C is case-sensitive.
  • Keywords: 32 reserved words (e.g., int, while).
  • Variables: Named memory locations. Standard data types include:
    • int: 2 bytes (−32,768-32,768 to 32,76732,767).
    • unsigned int: 2 bytes (00 to 65,53565,535).
    • long: 4 bytes (−2,147,483,648-2,147,483,648 to 2,147,483,6472,147,483,647).
    • float: 4 bytes, 6 digits precision.
    • double: 8 bytes, 15 digits precision.
    • long double: 10 bytes, 19 digits precision.
    • char: 1 byte, stored as ASCII codes (e.g., 'A' = 65).
  • Operators:
    • Arithmetic: +, -, *, /, % (modulus returns remainder).
    • Relational: ==, <, >, <=, >=, !=.
    • Logical: && (AND), || (OR), ! (NOT).
    • Assignment: =.
    • Increment/Decrement: ++ (Prefix/Postfix), --.
  • Comments: // (single-line) and /* ... */ (multi-line).

Chapter 10: Input/Output

  • Standard Functions:
    • printf(): Formatted output using format specifiers (%d, %f, %c, %s, %lf).
    • scanf(): Formatted input using the address-of operator & (e.g., &kilometer).
    • getch() / getche(): From conio.h for character input; getche() echoes typed characters.
  • Escape Sequences: \n (newline), \t (tab), \b (backspace), \r (carriage return), \" (double quote), \\ (backslash).

Chapter 11: Decision Constructs

  • Sequence: Default flow of statements.
  • Selection:
    • Simple if: Executes block if condition is true.
    • if-else: Provides two alternative paths.
    • Nested if: An if statement inside another if.
    • if-else if: For multiple continuous alternatives.
  • Switch Statement: Compares expression against case labels (integral or character constants). break exits the switch.
  • Conditional Operator: A ternary operator exp1 ? exp2 : exp3.

Chapter 12: Loop Constructs

  • While Loop: Repeatedly executes if condition is true; checks condition first.
  • Do-While Loop: Executes at least once; checks condition at the end.
  • For Loop: for (initialization; condition; increment).
  • Sentinel-Controlled Loops: Uses a special "sentinel value" (e.g., -1) to stop the loop.
  • Goto Statement: Unconditional transfer to a label.

Chapter 13: Functions in C

  • Modular Programming: Breaking logic into small, manageable self-contained functions.
  • Function Definition: Header (return type, name, params) and Body between braces.
  • Return Statement: Exits function and passes a value (e.g., return n1 + n2;).
  • Function Prototype: Declaration before the function call to inform the compiler (e.g., int Add (int n1, int n2);).
  • Arguments: Actual (passed in call) vs Formal (defined in header).
  • Variable Scopes: Local (within scope of braces) and Global (outside all blocks, visible to all functions).

Chapter 14: File Handling in C

  • Streams: Text Stream (sequence of characters with translations) and Binary Stream (byte-for-byte correspondence).
  • File Operations:
    • fopen(): Opens file with modes "r" (read), "w" (write), "a" (append), "r+", "w+", "a+".
    • fclose(): Closes the stream.
    • getc() / putc(): Read/Write characters.
    • fputs() / fgets(): Read/Write strings.
    • fprintf() / fscanf(): Formatted file I/O.
  • String Implementation: Array of characters terminating with a null character \0.