Informatics Practices cheat sheet

8 chapters. In each, the formulas come first, then the key facts. The number beside a line is the NCERT page it is printed on.

8 chapters · 18 formulas · 330 key facts

Covers every formula so you can recall it first.
  1. 1Start hereComputer SystemInformatics Practices · 10 formulas · 41 key factsRead
  2. 2Emerging TrendsInformatics Practices · 42 key factsRead
  3. 3Brief Overview of PythonInformatics Practices · 42 key factsRead
  4. 4Working with Lists and DictionariesInformatics Practices · 38 key factsRead
  5. 5Understanding DataInformatics Practices · 3 formulas · 38 key factsRead
  6. 6Introduction to NumPyInformatics Practices · 5 formulas · 42 key factsRead
  7. 7Database ConceptsInformatics Practices · 44 key factsRead
  8. 8Introduction to Structured Query Language (SQL)Informatics Practices · 43 key factsRead
Informatics Practices · Chapter 1

Computer System

4 topics · 10 formulas · 41 facts

  1. 1Introduction to Computer System
  2. 2Evolution of Computer
  3. 3Computer Memory
  4. 4Software
Formulas10 in this chapter
  • Nibblep.6
  • Bytep.6
  • Kilobyte (KB)p.6
  • Megabyte (MB)p.6
  • Gigabyte (GB)p.6
  • Terabyte (TB)p.6
  • Petabyte (PB)p.6
  • Exabyte (EB)p.6
  • Zettabyte (ZB)p.6
  • Yottabyte (YB)p.6
Key facts
  1. A computer is an electronic device that can be programmed to accept data as input, process it, and generate results as output.

    p.1
  2. A computer system primarily comprises a central processing unit, memory, input/output devices, and storage devices that function together as a single unit.

    p.1
  3. The Central Processing Unit carries out actual data processing and is placed on one or more integrated circuit microchips made of semiconductor materials.

    p.2
  4. The CPU fetches instructions and data from memory, performs arithmetic and logical operations, and stores the resulting data back into memory.

    p.2
  5. Registers are high-speed local memory units on the CPU chip, limited in size and number, used to store data, instructions, or intermediate results during processing.

    p.2
  6. The Arithmetic Logic Unit (ALU) performs all arithmetic and logical operations required as per program instructions.

    p.2
  7. The Control Unit (CU) interprets instructions, controls sequential instruction execution, and guides data flow through computer memory, ALU, and input or output devices.

    p.2
  8. Input devices send control signals to the computer and convert incoming data into a digital form acceptable by the computer system.

    p.2
  9. Output devices receive digital data from a computer system and convert it into human-understandable visual, auditory, or physical form.

    p.3
  10. A braille display monitor assists visually challenged individuals in understanding textual output generated by a computer.

    p.3
  11. Three commonly used physical output printers are inkjet, laserjet, and dot matrix, while 3D printers build physical replicas of digital three-dimensional designs.

    p.3
  12. The Von Neumann architecture consists of a Central Processing Unit (CPU), memory to store data and programs, input/output devices, and communication channels.

    p.3
  13. Electronic Numerical Integrator And Computer (ENIAC) was the first binary programmable computer built based on the Von Neumann architecture.

    p.3
  14. Blaise Pascal invented the Pascaline mechanical calculator in 1642 to perform addition and subtraction directly, and multiplication and division through repeated additions or subtractions.

    p.4
  15. Charles Babbage designed the Analytical Engine in 1834 as a mechanical computing device for inputting, processing, storing, and displaying output, which forms the basis of modern computers.

    p.4
  16. Herman Hollerith designed the tabulating machine in 1890 to summarize data stored on punched cards, marking the first step towards programming.

    p.4
  17. In 1947, vacuum tubes were replaced by transistors developed at Bell Labs using semiconductor materials, significantly increasing computer reliability and reducing size.

    p.4
  18. Large Scale Integration (LSI) in the 1970s allowed the integration of an entire CPU on a single silicon microchip, known as a microprocessor.

    p.4
  19. Moore’s Law predicted that the number of transistors on a microchip would double approximately every two years while the cost would be halved.

    p.4
  20. In the 1980s, Very Large Scale Integration (VLSI) integrated around 3 million components on a small-sized chip, followed by Super Large Scale Integration (SLSI).

    p.4
  21. Binary digits 0 and 1, known as bits, are the basic units of computer memory used to store and process data.

    p.5
  22. Primary memory is directly accessible by the CPU for read and write operations and is divided into Random Access Memory (RAM) and Read Only Memory (ROM).

    p.6
  23. RAM is volatile main memory that holds programs and data temporarily while the computer is operating, losing all stored contents when power is turned off.

    p.6
  24. ROM is non-volatile permanent memory that retains startup programs, such as the boot loader that loads the operating system into RAM, even when power is lost.

    p.6
  25. Cache memory is a very high-speed memory placed between the CPU and primary memory that stores copies of frequently accessed data to reduce memory access time.

    p.7
  26. Secondary memory is non-volatile, cheaper, and has larger capacity than primary memory, but its contents must be transferred to main memory before CPU processing.

    p.7
  27. Solid-State Drives (SSDs) support significantly faster data transfer speeds compared to traditional magnetic Hard Disk Drives (HDDs).

    p.7
  28. When data is deleted, its address entry is marked as free without wiping data at the bit level, allowing the space to be reported as empty to the user.

    p.8
  29. Recovery of deleted data from secondary storage is possible only if the physical memory space marked as deleted has not been overwritten by new data.

    p.8
  30. To prevent unauthorized data recovery and protect confidentiality, data shredding tools must be used before disposing of faulty or old storage devices.

    p.9
  31. Hardware comprises the physical components of a computer that can be touched, whereas software comprises sets of instructions and data that make the hardware functional.

    p.9
  32. Software acts as an interface between human users and the hardware, making the computer hardware operational and enabling components to communicate.

    p.10
  33. System software interacts directly with computer hardware to provide core operational capabilities and services for users and other application programs.

    p.10
  34. An operating system is the essential system software that operates the computer, manages application programs, and provides security and user access control.

    p.10
  35. System utilities are programs designed for computer maintenance and performance optimization, such as disk defragmenters, disk cleaners, and antivirus tools.

    p.10
  36. A device driver acts as a mediator and translator between the operating system and an attached peripheral device, managing its hardware-level operations.

    p.11
  37. A computer system can work in the absence of application software, but it cannot operate without system software like an operating system.

    p.11
  38. General purpose software consists of pre-packaged application programs developed for generic tasks to cater to a broad audience, such as LibreOffice Calc and web browsers.

    p.11
  39. Customized software is tailor-made application software developed specifically to fulfill the unique requirements of a particular individual or organization.

    p.12
  40. Free and Open Source Software (FOSS) permits users to freely execute, study, modify, and distribute the software along with its source code.

    p.12
  41. Freeware is distributed free of cost for use without access to its source code, whereas proprietary software requires purchase from a copyright holder.

    p.12
Informatics Practices · Chapter 3

Brief Overview of Python

12 topics · 42 facts

  1. 1Introduction to Python
  2. 2Python Keywords and Identifiers
  3. 3Variables
  4. 4Data Types
  5. 5Operators
  6. 6Expressions
  7. 7Input and Output
  8. 8Debugging
  9. 9Functions
  10. 10If..else Statements
  11. 11For Loop
  12. 12Nested Loops
Key facts
  1. Python is a high-level, interpreter-based programming language created by Guido van Rossum in 1991 for general-purpose programming, web development, and scientific computing.

    p.31
  2. In interactive mode, the Python interpreter executes statements typed directly at the prompt >>> immediately and displays results, but it cannot save statements for future use.

    p.32
  3. In script mode, Python programs are saved in files with a .py extension and executed by the interpreter, allowing multi-line programs to be permanently saved and reused.

    p.33
  4. Keywords are reserved words that carry specific predefined meanings to the Python interpreter and must be written strictly in the specified case because Python is case-sensitive.

    p.34
  5. An identifier must begin with an uppercase or lowercase letter or an underscore (_), followed by letters, digits, or underscores, and it cannot begin with a digit.

    p.34
  6. Identifiers can be of any length but cannot contain special symbols such as !, @, #, $, or %, and cannot be a Python keyword.

    p.34
  7. A variable is a named identifier that refers to a value that can change during program execution, and each variable name must be unique within a program.

    p.34
  8. Variables must always be assigned a value using an assignment statement before they are used in an expression, otherwise an error occurs.

    p.35
  9. In Python, a single-line comment begins with a hash sign (#) and everything following it until the end of that line is ignored by the interpreter.

    p.35
  10. Python classifies numbers into three distinct types: int for integers, float for floating-point real numbers, and complex for complex numbers.

    p.36
  11. The bool data type is a subtype of integer consisting of two constants: True (representing non-zero) and False (representing zero).

    p.36
  12. A sequence is an ordered collection of items indexed by integers, which includes immutable strings, mutable lists, and immutable tuples.

    p.36
  13. Lists are enclosed in square brackets [] and can hold mutable elements of different data types, whereas tuples are enclosed in parentheses () and are immutable once created.

    p.37
  14. A tuple is an ordered sequence of comma-separated items enclosed in parentheses () whose elements cannot be changed once created.

    p.37
  15. A dictionary is an unordered mapping of key-value pairs enclosed in curly brackets {}, where values are accessed using their corresponding keys in square brackets [].

    p.38
  16. The addition operator (+) concatenates two sequences, while the multiplication operator (*) replicates a sequence when multiplied by an integer.

    p.38
  17. The floor division operator (//) divides operands and returns the quotient by removing the decimal part, while the modulus operator (%) returns the remainder.

    p.39
  18. The exponentiation operator (**) raises the base operand to the power of the exponent operand.

    p.39
  19. Relational operators compare operand values and evaluate to either True or False, comparing strings lexicographically using their ASCII values.

    p.40
  20. Python supports three logical operators written strictly in lowercase: and, or, and not.

    p.40
  21. The membership operators in and not in test whether a given value exists within a sequence, returning True or False accordingly.

    p.41
  22. An expression is a valid combination of constants, variables, and operators that always evaluates to a single value, whereas a standalone operator is not an expression.

    p.41
  23. Operators with higher precedence are evaluated before lower precedence operators, but parentheses () can be used to override operator precedence.

    p.42
  24. The input() function prompts the user for keyboard input and always returns the entered data as a string.

    p.43
  25. To use user input in mathematical operations, the string returned by input() must be explicitly typecast to a numeric type using int() or float().

    p.43
  26. The print() function evaluates the expressions passed to it and displays the resulting output on the standard output device.

    p.43
  27. Debugging is the process of identifying and removing errors from a computer program to ensure it executes correctly.

    p.44
  28. A syntax error occurs when code violates Python grammatical rules, causing the interpreter to show an error message and immediately stop execution.

    p.44
  29. A logical error (semantic error) occurs when a program executes successfully without stopping but produces incorrect or undesired output.

    p.44
  30. A runtime error occurs when a syntactically correct statement fails during execution due to an invalid operation, such as division by zero.

    p.44
  31. A function is a named set of instructions that performs a specific task, which can be defined once and reused at multiple places by calling its name.

    p.44
  32. A module is a Python file containing grouped functions that can be imported and reused in another program using the import statement.

    p.45
  33. Arguments are values passed to a function within parentheses during a function call, and the function can return one or more results to the calling point.

    p.45
  34. Built-in type conversion functions include int(), float(), str(), bool(), chr(), ord(), list(), tuple(), dict(), and set().

    p.46
  35. The if statement evaluates a test condition and executes the statements in its indented body only if the condition evaluates to True.

    p.46
  36. In an if..else statement, the if block executes when the condition is True, and the else block executes when the condition is False.

    p.47
  37. The if..elif..else construct evaluates conditions sequentially, executing only the block of the first condition that evaluates to True and terminating the construct.

    p.47
  38. Python associates statements into code blocks strictly using indentation (leading whitespace), and inconsistent indentation produces syntax errors.

    p.47
  39. The for loop iterates over items of a sequence or range of values, executing the loop body once for each item until all items are exhausted.

    p.48
  40. The range([start], stop[, step]) function generates a sequence of integers from start up to but excluding stop, incrementing by step.

    p.49
  41. In range(), start defaults to 0 and step defaults to 1, while step can be any positive or negative integer excluding zero.

    p.49
  42. A nested loop is a loop placed inside another loop, wherein the inner loop executes all its iterations for every single iteration of the outer loop.

    p.50
Informatics Practices · Chapter 4

Working with Lists and Dictionaries

9 topics · 38 facts

  1. 1Introduction to List
  2. 2List Operations
  3. 3Traversing a List
  4. 4List Methods and Built-in Functions
  5. 5List Manipulation
  6. 6Introduction to Dictionaries
  7. 7Traversing a Dictionary
  8. 8Dictionary Methods and Built-in Functions
  9. 9Manipulating Dictionaries
Key facts
  1. In Python, a list is an ordered mutable sequence of elements enclosed in square brackets and separated by commas, capable of holding mixed data types including numbers, strings, tuples, or other lists.

    p.55
  2. List elements are accessed using zero-based indexing for forward access and negative indexing starting at -1 for backward access, where -n refers to the first element in a list of length n.

    p.56
  3. Attempting to access a list element using an index that is outside the valid index range raises an IndexError.

    p.56
  4. Lists are mutable in Python, meaning existing elements can be modified, replaced, or updated in-place using index assignment without creating a new list object.

    p.57
  5. The concatenation operator + joins two or more lists into a new list without altering the original lists, and concatenating a list with a non-list operand raises a TypeError.

    p.57
  6. The repetition operator * replicates the elements of a list a specified number of times to produce a new list without modifying the original list.

    p.58
  7. The membership operator in evaluates to True if a specified element is present in the list and False otherwise, while not in evaluates to True if the element is absent.

    p.58
  8. List slicing creates a new list from an existing list; if the stop index exceeds the list length, it truncates safely at the end of the list rather than raising an IndexError.

    p.58
  9. Using a negative step size such as list[::-1] in a slice operation creates a new list with elements arranged in reverse order.

    p.59
  10. Traversing a list involves visiting each of its elements sequentially, which can be accomplished using a for loop iterating directly over the items.

    p.59
  11. A list can also be traversed by index using a for loop combined with range(len(list1)), where range(n) generates integers from 0 to n-1.

    p.59
  12. The append() method adds a single element to the end of a list in-place, whereas extend() iterates through an iterable passed as an argument and appends each of its elements individually.

    p.60
  13. The insert(index, element) method places an element at the specified index position, shifting subsequent elements to the right without overwriting them.

    p.60
  14. The index() method returns the index of the first occurrence of a specified element in a list, raising a ValueError if the element is not found.

    p.61
  15. The remove(x) method deletes the first occurrence of value x from the list in-place, raising a ValueError if x is not present.

    p.61
  16. The pop() method removes and returns the element at the specified index, or removes and returns the last element of the list if no index argument is provided.

    p.61
  17. The sort() method sorts elements of a list in-place in ascending order or descending order with reverse=True, modifying the original list and returning None.

    p.61
  18. The built-in sorted() function returns a new sorted list from an iterable without modifying the original list, whereas min(), max(), and sum() return the smallest, largest, and total of list items.

    p.62
  19. In menu-driven list manipulation, an existing element at index i can be updated by direct assignment myList[i] = newElement provided that index i is within the bounds of the list.

    p.63
  20. To delete an element safely by value in a program, the membership operator in can verify its existence before invoking remove() to prevent a ValueError runtime crash.

    p.64
  21. In list accumulation algorithms, an empty list initialized as [] dynamically stores input values using append(), allowing aggregate calculations such as total sum and average.

    p.65
  22. Linear search on a list sequentially compares each element against the target value across the index range 0 to len(list1)-1 to determine its presence and position.

    p.66
  23. A Python dictionary is a mapping data type consisting of key-value pairs called items enclosed in curly braces {}, where each key is separated from its value by a colon.

    p.67
  24. Dictionary keys must be unique and belong to immutable data types such as strings, numbers, or tuples, while values can be duplicated and of any arbitrary data type.

    p.67
  25. Accessing a dictionary value using square bracket notation with a non-existent key raises a KeyError.

    p.68
  26. Membership operators in and not in test for the presence or absence of a specified key in a dictionary, not its values.

    p.68
  27. Dictionaries are mutable, allowing new key-value pairs to be added using assignment syntax dict1[new_key] = value after the dictionary has been created.

    p.68
  28. Assigning a value to an existing key in a dictionary overwrites the previous value mapped to that key in-place without creating a duplicate key.

    p.69
  29. Iterating over a dictionary directly with a for loop yields each key in insertion order, from which corresponding values can be retrieved using dict[key].

    p.69
  30. A dictionary can be traversed simultaneously for both keys and values using a for loop with dict.items(), which yields key-value tuple pairs on each iteration.

    p.69
  31. The built-in len(dict) function returns the total number of key-value pairs or items contained within the dictionary.

    p.69
  32. The get(key) method returns the value mapped to a given key, or None if the key does not exist in the dictionary, avoiding a KeyError exception.

    p.70
  33. The keys(), values(), and items() methods return view objects displaying all keys, all values, and all (key, value) tuple pairs of the dictionary respectively.

    p.70
  34. The update() method merges key-value pairs from another dictionary into the target dictionary, inserting new keys and overwriting values of existing keys.

    p.70
  35. The del statement deletes a specific key-value pair from a dictionary using del dict[key], or removes the entire dictionary object from memory when applied as del dict_name.

    p.71
  36. User-supplied tabular records such as employee names and salaries can be stored in a dictionary by reading inputs and assigning each unique name as a key mapped to its salary.

    p.72
  37. Character frequency in a string can be counted using a dictionary by checking if each character is in the dictionary: incrementing its count if present, or initializing it to 1 if absent.

    p.73
  38. A digit-to-word conversion program maps integer digits 0 through 9 to their word equivalents using a dictionary, retrieving words by indexing numberNames with int(ch).

    p.73
Informatics Practices · Chapter 5

Understanding Data

5 topics · 3 formulas · 38 facts

  1. 1Introduction to Data
  2. 2Data Collection
  3. 3Data Storage
  4. 4Data Processing
  5. 5Statistical Techniques for Data Processing
Formulas3 in this chapter
  • Arithmetic Meanp.88
  • Rangep.90
  • Standard Deviationp.90
Key facts
  1. Governments systematically collect and record data about the population through census, which provides valuable information for planning and formulating policies.

    p.81
  2. Data is defined as a collection of characters, numbers, and symbols that represents values of variables or situations, where data is plural and datum is singular.

    p.82
  3. Using computers, data are stored in electronic forms because automated data processing is faster and easier compared to manual data processing done by humans.

    p.82
  4. A knowledge base is a store of information consisting of facts, assumptions, and rules which an artificial intelligence system uses for decision making.

    p.82
  5. Processing large volumes of data using computers reveals hidden patterns and behavioral traits that are otherwise not visible to human observers.

    p.83
  6. Dynamic pricing systems in airlines and transport apps adjust fares automatically based on the relationship between demand and supply at a particular time.

    p.83
  7. Electronic voting machines record votes cast and aggregate voting data across machines to declare election results in a shorter time than manual paper counting.

    p.83
  8. Structured data is organised data recorded in a well-defined format, typically stored in computers in a tabular format of rows and columns.

    p.84
  9. In a structured data table, each column represents a particular parameter termed an attribute, characteristic, or variable, while each row represents an observation.

    p.84
  10. Spreadsheets and database systems perform calculations on structured tabular data, such as summing inventory quantities or multiplying unit prices by item quantities.

    p.84
  11. Unstructured data refers to data that does not follow a traditional row and column structure, including newspapers, web pages, text documents, and multimedia.

    p.85
  12. Metadata is defined as data about data, providing descriptive context such as subject, sender, and attachments in emails, or file size and resolution in images.

    p.85
  13. Data collection is the process of identifying already available data or gathering data from appropriate sources prior to digital storage and processing.

    p.85
  14. When sales data is maintained manually in paper diaries or registers, it must be digitised by entering it into spreadsheet software for computer processing.

    p.85
  15. Data collection can ingest existing digital datasets stored in standardized plain-text formats such as CSV (comma-separated values) files.

    p.85
  16. Custom software applications written in programming languages like Python can automate the collection, storage, and retrieval of data from CSV files and databases.

    p.86
  17. Analysing transaction data collected by shopping malls enables business owners to identify items frequently purchased together and optimize store displays.

    p.86
  18. Data storage is the process of storing gathered and processed data on digital storage devices so that the data can be retrieved for future use.

    p.86
  19. Digital storage devices used to store data include Hard Disk Drives (HDD), Solid State Drives (SSD), CD/DVD, Tape Drives, Pen Drives, and Memory Cards.

    p.86
  20. Data files such as images, documents, and videos stored on computers face file-processing limitations that can be overcome by Database Management Systems (DBMS).

    p.86
  21. Data processing converts raw data in the form of numbers, text, or images into meaningful information presented as tables, charts, or text for decision making.

    p.87
  22. The data processing cycle consists of three basic stages: input (collection, preparation, entry), processing (store, retrieve, classify, update), and output.

    p.87
  23. Automated data processing systems validate submitted input details, verify business rules or account balances, update records, and generate formatted outputs.

    p.87
  24. A measure of central tendency is a single summary value, such as the mean, median, or mode, that provides an overview of the central distribution of a dataset.

    p.88
  25. Mean is the average of the numeric values of an attribute, computed by dividing the sum of all observed values by the total number of observations.

    p.88
  26. An outlier is an exceptionally large or small value relative to the rest of the data that acts as an error and distorts the mean and other calculations.

    p.88
  27. Median is the middle value of an attribute when all values are sorted in ascending or descending order, dividing the dataset into two equal halves.

    p.89
  28. When a dataset contains an odd number of values, the median is the value at the middle position; when even, it is the average of the two middle values.

    p.89
  29. Mode is the value that appears most frequently in a dataset, and it can be computed for both numerical and non-numerical (categorical) data attributes.

    p.89
  30. A dataset has no mode if every value occurs exactly once, and it may have multiple modes if two or more distinct values share the highest frequency.

    p.89
  31. Measures of variability or dispersion indicate the degree of diversity, spread, or difference of data values around their central mean value.

    p.89
  32. Two different datasets can have identical mean, median, and mode values while exhibiting entirely different degrees of variation or dispersion.

    p.89
  33. Range is a measure of dispersion computed as the difference between the maximum and minimum values in numerical data, indicating coverage of data values.

    p.90
  34. Because Range is calculated exclusively from the two extreme values, the presence of any outlier in the dataset severely influences the result.

    p.90
  35. Standard deviation measures data dispersion by considering all values, calculated as the positive square root of the average squared difference from the mean.

    p.90
  36. A smaller standard deviation indicates that data points are clustered closely around the mean, whereas a larger standard deviation indicates wider dispersion.

    p.90
  37. Python programming provides specialized libraries designed for data processing and analysis that implement standard statistical techniques.

    p.91
  38. Summarizing data using statistical techniques aids in revealing data characteristics and patterns that facilitate effective comprehension and decision making.

    p.92
Informatics Practices · Chapter 6

Introduction to NumPy

10 topics · 5 formulas · 42 facts

  1. 1Array
  2. 2NumPy Array
  3. 3Indexing and Slicing
  4. 4Operations on Arrays
  5. 5Concatenating Arrays
  6. 6Reshaping Arrays
  7. 7Splitting Arrays
  8. 8Statistical Operations on Arrays
  9. 9Loading Arrays from Files
  10. 10Saving NumPy Arrays in Files on Disk
Formulas5 in this chapter
  • Byte to bits unit conversionp.99
  • Itemsize of an array element in bytesp.99
  • Total elements in a two-dimensional arrayp.99
  • Arithmetic mean of array elementsp.108
  • Standard deviation of array elementsp.108
Key facts
  1. An array is a data type that stores an ordered collection of elements of the same data type using a single identifier.

    p.96
  2. Array elements are allocated contiguously in memory, which makes operations on arrays fast.

    p.96
  3. Each element in an array is uniquely referenced using zero-based indexing, where the first element has index 0 and the last element in an n-element array has index n-1.

    p.96
  4. A NumPy ndarray takes up less space in memory than a Python list because it does not require storing separate datatype information for each element.

    p.97
  5. NumPy arrays support element-wise operations directly across their elements, whereas core Python lists do not support element-wise operations.

    p.97
  6. When creating an array from a list containing mixed data types, all integer and floating-point values are automatically promoted to strings.

    p.98
  7. The ndarray.ndim attribute gives the number of dimensions or axes of an array, which is also referred to as the array rank.

    p.98
  8. In a two-dimensional NumPy array, the row axis is designated as axis-0 and the column axis is designated as axis-1.

    p.98
  9. The ndarray.shape attribute returns a tuple of integers indicating the size of the array along each dimension.

    p.98
  10. The ndarray.size attribute gives the total number of elements of an array, which is equal to the product of the elements of shape.

    p.99
  11. The ndarray.itemsize attribute specifies the memory size in bytes of each element, occupying 4 bytes for int32 and 8 bytes for float64.

    p.99
  12. The np.zeros() and np.ones() functions create arrays with all elements initialised to 0 and 1 respectively, having float as their default data type.

    p.100
  13. The np.arange() function creates a one-dimensional array containing numbers in a given range and sequence analogous to the range() function in Python.

    p.100
  14. Elements in a two-dimensional array are referenced using two indices array[i, j], where i is the row index and j is the column index starting from 0.

    p.100
  15. Attempting to access an index outside the boundaries of an array dimension results in an IndexError stating the index is out of bounds.

    p.101
  16. In array slicing using the syntax [start:end], the value at the start index is included whereas the value at the end index is excluded.

    p.101
  17. Specifying a negative step size in slicing syntax [::-1] reverses the sequence of elements in an array.

    p.101
  18. Omitting slice indices for a dimension by writing a colon selects all elements along that row or column axis.

    p.102
  19. Basic arithmetic operators perform element-wise addition, subtraction, multiplication, and division on corresponding pairs of elements in NumPy arrays.

    p.102
  20. Matrix multiplication between two NumPy arrays is executed using the @ operator.

    p.103
  21. Performing element-wise arithmetic operations between two arrays requires both arrays to have the exact same shape.

    p.103
  22. The transpose() method turns rows into columns and columns into rows while leaving the original array unchanged.

    p.104
  23. The sort() method sorts array elements in ascending order in place, performing row-wise sorting along axis=1 by default on a two-dimensional array.

    p.104
  24. Specifying axis=0 in the sort() method sorts elements column-wise in ascending order within each column of a two-dimensional array.

    p.104
  25. The np.concatenate() function joins two or more arrays along a specified axis, defaulting to concatenation along axis=0.

    p.104
  26. All dimensions of arrays to be concatenated must match exactly except for the dimension along which they are joined, or else a ValueError occurs.

    p.105
  27. The reshape() function modifies the dimensions of an array without changing its total number of elements.

    p.105
  28. Attempting to reshape an array into dimensions that do not match the original total number of elements results in an error.

    p.105
  29. The np.split() function divides an array into two or more subarrays along a specified axis, defaulting to axis=0.

    p.106
  30. An array can be split by passing a sequence of index values marking split positions or by passing an integer indicating the number of equal parts.

    p.106
  31. Specifying axis=1 in np.split() splits a two-dimensional array along its columns into vertical subarrays.

    p.107
  32. The sum(), max(), and min() functions calculate the total sum, maximum value, and minimum value of array elements respectively, optionally along an axis.

    p.108
  33. The mean() function calculates the arithmetic average of elements across an entire array or along a designated axis.

    p.108
  34. The std() function computes the standard deviation of array elements across the whole array or along a specified axis.

    p.108
  35. To load data from a text file into a NumPy array, each row in the file must contain the exact same number of values.

    p.109
  36. The skiprows parameter in np.loadtxt() indicates how many initial rows, such as table headers, to skip while loading data.

    p.110
  37. Setting unpack=True in np.loadtxt() transposes the loaded array, allowing data columns to be extracted directly into separate variables.

    p.110
  38. The np.genfromtxt() function handles missing and non-numeric values in files by converting missing entries into nan by default.

    p.111
  39. The filling_values parameter in np.genfromtxt() replaces missing or non-numeric entries in data files with a specified default value.

    p.111
  40. The np.savetxt() function saves a NumPy array to a text file on disk using a specified delimiter character.

    p.112
  41. The fmt parameter in np.savetxt() specifies the formatting of saved values, which defaults to floating-point representation.

    p.112
  42. Once created, a NumPy array occupies a fixed memory allocation and cannot be dynamically resized or extended.

    p.112
Informatics Practices · Chapter 7

Database Concepts

4 topics · 44 facts

  1. 1File System
  2. 2Database Management System
  3. 3Relational Data Model
  4. 4Keys in a Relational Database
Key facts
  1. A computer file serves as a container on a storage device to store data such as plain text, program code, or comma separated values.

    p.124
  2. Accessing and searching data stored in files through software applications requires writing custom computer programs.

    p.125
  3. File systems lack internal retrieval mechanisms, making it difficult to access data in unexpected formats without developing new application programs.

    p.126
  4. Data redundancy occurs when the same data is duplicated across different files, which wastes storage space and can lead to data inconsistency.

    p.126
  5. Data inconsistency occurs when redundant copies of the same data stored in different files are updated mismatchingly or omitted in some files.

    p.126
  6. Data isolation occurs in a file system because there is no link or mapping between related files, requiring separate application programs to access each file.

    p.127
  7. Data dependence means that changing the file structure or format requires modifying all application programs that access that file.

    p.127
  8. File systems cannot easily enforce granular access control, such as granting read-only permissions to certain users while allowing others to modify data.

    p.127
  9. A Database Management System (DBMS) is software used to create, manage, store, update, and retrieve logically related data from a database.

    p.127
  10. A DBMS provides an abstract view of data by hiding physical storage details and internal structures from end users and application programs.

    p.128
  11. Retrieving data from a database using specialized commands is referred to as querying the database.

    p.128
  12. Tables in a relational database are linked and related through one or more common fields to eliminate data redundancy.

    p.128
  13. Splitting a single large file into multiple related tables eliminates duplicate storage of repeated entities such as guardian details.

    p.129
  14. An artificial unique column like a guardian ID is introduced when natural attributes like names or phone numbers can duplicate or change over time.

    p.129
  15. Transitioning from a file system to a DBMS incurs high costs for purchasing hardware and software, training users, and performing regular backup and recovery.

    p.129
  16. A DBMS maintains a single centralized repository of data that can be accessed and manipulated concurrently by multiple users.

    p.130
  17. Database schema is the visual or logical architecture that defines table structures, column data types, constraints, and relationships.

    p.130
  18. Data constraints are limitations placed on table columns to enforce data accuracy, consistency, and reliability within the database.

    p.131
  19. Metadata is data about data, encompassing the database schema and constraints stored in the DBMS database catalog or data dictionary.

    p.131
  20. A database instance is the actual operational state or snapshot of a database populated with data at a specific point in time.

    p.131
  21. While a database schema remains static, a database instance changes dynamically whenever data manipulation operations take place.

    p.132
  22. Data manipulation in a database consists of three fundamental operations: insertion of new records, deletion of existing records, and update of stored values.

    p.132
  23. A database engine is the underlying component of a DBMS that executes queries and handles data retrieval and manipulation.

    p.132
  24. Using a DBMS increases complexity in maintaining security and integrity, and centralizing data increases data vulnerability in case of hardware or software failure.

    p.132
  25. A data model describes the structure of a database, including how data are defined and represented, relationships among data, and constraints.

    p.132
  26. In the relational data model, tables are known as relations, where each row represents a related set of values and relations are linked by common attributes.

    p.133
  27. An attribute is a named characteristic or column in a relation that stores values for a specific field across all tuples.

    p.134
  28. A tuple is a single row in a relation representing an association of related values corresponding to a real-world entity.

    p.134
  29. A domain is the set of permissible values from which an attribute can draw its values, typically specified by a data type.

    p.134
  30. The degree of a relation is the total number of attributes or columns it contains.

    p.135
  31. The cardinality of a relation is the total number of tuples or rows it contains.

    p.135
  32. Property 1 of a relation establishes that each attribute must have a unique name within the relation and the sequence of attributes is immaterial.

    p.135
  33. Property 2 of a relation states that each tuple must be distinct and uniquely identifiable, and the sequence of tuples is immaterial.

    p.135
  34. Property 3 of a relation requires that all attribute values must be atomic, indivisible, drawn from the same domain, and single-valued per tuple.

    p.135
  35. The special value NULL is used in relational tables to represent values that are unknown, missing, or not applicable for an attribute.

    p.135
  36. Relational tables require that no two tuples have identical values across all attributes, ensuring each tuple is uniquely distinguishable.

    p.136
  37. A candidate key is any attribute or minimal set of attributes that takes unique, distinct values and can uniquely identify each tuple in a relation.

    p.136
  38. A primary key is the specific candidate key selected by the database designer to uniquely identify the tuples of a relation.

    p.136
  39. An alternate key is any candidate key in a relation that was not chosen as the primary key.

    p.136
  40. A composite primary key is a primary key formed by combining two or more attributes together when no single attribute can uniquely distinguish tuples.

    p.136
  41. A foreign key is an attribute in a referencing relation whose value is derived from and refers to the primary key of another referenced relation.

    p.137
  42. The relation containing the foreign key is the foreign or referencing relation, whereas the relation with the referenced primary key is the master or primary relation.

    p.137
  43. A foreign key can store a NULL value if it is not defined as part of the primary key in the referencing relation.

    p.137
  44. In relational schema diagrams, a foreign key is represented as a directed arc pointing from the foreign key attribute to the referenced primary key attribute.

    p.137
Informatics Practices · Chapter 8

Introduction to Structured Query Language (SQL)

6 topics · 43 facts

  1. 1Structured Query Language (SQL)
  2. 2Data Types and Constraints in MySQL
  3. 3SQL for Data Definition
  4. 4SQL for Data Manipulation
  5. 5SQL for Data Query
  6. 6Data Updation and Deletion
Key facts
  1. Structured Query Language (SQL) is the standard query language used by relational database management systems such as MySQL, Oracle, and SQL Server to access, manipulate, and define data.

    p.144
  2. SQL statements are case insensitive, meaning uppercase and lowercase keywords or identifiers are treated identically.

    p.144
  3. SQL is non-procedural because the user specifies what data is to be retrieved rather than specifying the procedural steps of how to retrieve it.

    p.144
  4. Every SQL statement in MySQL must terminate with a semicolon (;), and pressing Enter without a semicolon continues the statement to the next line with a -> prompt.

    p.144
  5. The CHAR(n) data type specifies a fixed-length string of length n from 0 to 255 characters, and MySQL right-pads unused spaces with blanks.

    p.145
  6. The VARCHAR(n) data type specifies a variable-length string of up to n characters from 0 to 65535, allocating only the storage bytes needed for entered characters.

    p.145
  7. The INT data type occupies 4 bytes of storage for integers ranging from -2147483648 to 2147483647, whereas values larger than that require BIGINT occupying 8 bytes.

    p.146
  8. The DATE data type stores calendar dates in YYYY-MM-DD format with a supported range from 1000-01-01 to 9999-12-31.

    p.146
  9. The NOT NULL constraint ensures that a column cannot have NULL values, where NULL represents missing, unknown, or not applicable data.

    p.146
  10. The UNIQUE constraint ensures that all values in a column are distinct.

    p.146
  11. A PRIMARY KEY constraint uniquely identifies each row in a table, whereas a FOREIGN KEY refers to the primary key attribute of another table.

    p.146
  12. Data Definition Language (DDL) commands are used to define, alter, and delete database structures including schemas, tables, and constraints.

    p.146
  13. The CREATE DATABASE statement creates a new database, while the USE statement sets an existing database as the active database for subsequent operations.

    p.146
  14. The SHOW TABLES statement lists the names of all existing tables within the currently selected database.

    p.147
  15. In a CREATE TABLE statement, every attribute can take NULL values by default unless explicitly restricted by a PRIMARY KEY or NOT NULL constraint.

    p.147
  16. The DESCRIBE statement, or its abbreviated form DESC, displays the schema structure, column types, nullability, keys, and default values of a table.

    p.149
  17. The ALTER TABLE statement modifies the structure of an existing table by adding columns, modifying data types, or adding and dropping constraints.

    p.149
  18. A foreign key added to a relation requires that the referenced table and attribute exist, and the referenced and referencing attributes share identical data type and size.

    p.150
  19. The ALTER TABLE MODIFY clause changes the data type, size, NOT NULL constraint, or default value of an existing column.

    p.151
  20. The ALTER TABLE DROP clause removes an attribute or drops a primary key constraint from an existing table.

    p.152
  21. The DROP TABLE statement permanently deletes a table and its records, while DROP DATABASE permanently removes the entire database and all contained tables.

    p.153
  22. Data Manipulation Language (DML) statements perform insertion of new data, retrieval of existing data, modification of existing data, and deletion of records.

    p.153
  23. The INSERT INTO statement adds new records to a table using VALUES corresponding to the defined column order.

    p.153
  24. Column names can be omitted in an INSERT INTO statement only when values are supplied for all attributes in exact schema sequence.

    p.153
  25. When inserting values for only selected columns, attribute names must be explicitly specified in the INSERT INTO clause in the same order as the supplied values.

    p.154
  26. String and date literals must be enclosed in single quotation marks when entered in SQL statements.

    p.155
  27. Populating records with a foreign key requires that corresponding referenced records already exist in the referenced parent table.

    p.153
  28. The SELECT statement retrieves data from one or more tables and presents the result in tabular form.

    p.157
  29. In a SELECT query, the FROM clause specifies the source table, while the optional WHERE clause filters rows that satisfy given conditions.

    p.157
  30. Using an asterisk (*) in the SELECT clause retrieves all columns for the matching records.

    p.158
  31. The AS keyword assigns an alias to rename an output column header in the query result without changing the underlying table column name.

    p.159
  32. The DISTINCT clause eliminates duplicate rows from the query output to display only unique values.

    p.160
  33. The BETWEEN operator defines an inclusive range of values to filter records in a WHERE clause.

    p.162
  34. The IN operator compares an attribute value against a parenthesized list of values and returns true if a match is found.

    p.162
  35. The ORDER BY clause arranges query results in ascending order by default, and in descending order when the DESC keyword is appended.

    p.163
  36. SQL uses NULL to represent missing or unknown values, and any arithmetic operation performed with NULL produces NULL.

    p.164
  37. Checking for the presence or absence of NULL values in a query requires the IS NULL or IS NOT NULL operator instead of the equality operator.

    p.164
  38. The LIKE operator performs pattern matching using percent (%) for zero or more characters and underscore (_) for exactly one character.

    p.165
  39. The UPDATE statement modifies values in existing table records using the SET clause.

    p.166
  40. Omitting the WHERE clause from an UPDATE statement results in modifying the specified column values across all records in the table.

    p.167
  41. An UPDATE statement can update multiple columns simultaneously by separating column assignments with commas in the SET clause.

    p.167
  42. The DELETE statement removes one or more records satisfying a WHERE condition from a table.

    p.167
  43. Omitting the WHERE clause from a DELETE statement removes all records from the table while retaining the table structure.

    p.168