Computer Science cheat sheet

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

11 chapters · 19 formulas · 455 key facts

Covers every formula so you can recall it first.
  1. 1Start hereComputer SystemComputer Science · 10 formulas · 41 key factsRead
  2. 2Encoding Schemes and Number SystemComputer Science · 6 formulas · 41 key factsRead
  3. 3Emerging TrendsComputer Science · 36 key factsRead
  4. 4Introduction to Problem SolvingComputer Science · 42 key factsRead
  5. 5Getting Started with PythonComputer Science · 37 key factsRead
  6. 6Flow of ControlComputer Science · 44 key factsRead
  7. 7FunctionsComputer Science · 43 key factsRead
  8. 8StringsComputer Science · 3 formulas · 43 key factsRead
  9. 9ListsComputer Science · 42 key factsRead
  10. 10Tuples and DictionariesComputer Science · 44 key factsRead
  11. 11Societal ImpactComputer Science · 42 key factsRead
Computer Science · Chapter 1

Computer System

8 topics · 10 formulas · 41 facts

  1. 1Introduction to Computer System
  2. 2Evolution of Computer
  3. 3Computer Memory
  4. 4Data Transfer between Memory and CPU
  5. 5Microprocessors
  6. 6Data and Information
  7. 7Software
  8. 8Operating System
Formulas10 in this chapter
  • Nibblep.5
  • Bytep.5
  • 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 system primarily comprises a central processing unit (CPU), memory, input/output devices, and storage devices functioning together as a single unit.

    p.1
  2. The central processing unit is the electronic circuitry of a computer that carries out data processing and is placed on integrated circuits made of semiconductor materials.

    p.1
  3. Registers are high-speed local memory units located directly on the CPU chip used to temporarily hold instructions, data, and intermediate results during processing.

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

    p.2
  5. Input devices convert incoming data into digital form acceptable to the computer, temporarily storing it in primary memory (RAM) for processing.

    p.2
  6. Output devices convert digital information from the computer system into human-understandable visual, audio, or physical form.

    p.2
  7. Charles Babbage designed the Analytical Engine in 1834 as a mechanical computing device for inputting, processing, storing, and displaying output, forming the basis of modern computers.

    p.3
  8. John Von Neumann introduced the stored-program computer concept in 1945 where both data and programs are stored together in the same memory.

    p.3
  9. The Von Neumann architecture consists of a CPU for processing instructions, a memory for data and programs, input/output devices, and communication channels.

    p.4
  10. Moore’s Law predicted that the number of transistors that could be assembled in a single microchip would double every two years while the costs would be halved.

    p.4
  11. Large Scale Integration (LSI) in the 1970s enabled the integration of an entire CPU on a single microchip, creating the microprocessor.

    p.4
  12. The basic unit of computer memory is the bit (binary digit 0 or 1), where four bits make a nibble and eight bits make a byte.

    p.5
  13. Primary memory interacts directly with the CPU for read and write operations and is divided into volatile RAM and non-volatile ROM.

    p.6
  14. RAM is volatile memory that temporarily stores data and programs during operation, losing its contents as soon as power is turned off.

    p.6
  15. ROM is non-volatile memory that retains its contents without power, permanently storing critical startup routines like the boot loader.

    p.6
  16. Cache memory is a very high-speed memory placed between the CPU and primary memory to store frequently accessed data and minimize memory access latency.

    p.6
  17. When the CPU requires data, it first checks cache memory; if found, it is read from cache, and only otherwise is primary memory accessed.

    p.7
  18. Secondary memory cannot be accessed directly by the CPU, so its contents must first be transferred into main memory for processing.

    p.7
  19. Data are transferred between different components of a computer system using physical communication channels called buses.

    p.7
  20. The system bus consists of a data bus to transfer data, an address bus to specify memory locations, and a control bus to communicate control signals.

    p.7
  21. A CPU implemented entirely on a single microchip is called a microprocessor, built on an integrated circuit comprising millions of transistors, resistors, and diodes.

    p.8
  22. The data bus is bidirectional because the CPU reads and writes data, whereas the address bus and control bus are unidirectional.

    p.8
  23. A dedicated hardware component called the memory controller manages and coordinates the flow of data into and out of the computer’s main memory.

    p.8
  24. Word size is the maximum number of bits that a microprocessor can process at a time, ranging from 16 bits to 64 bits in modern processors.

    p.9
  25. Clock speed indicates the number of pulses generated per second by the internal clock, determining the speed at which instructions are executed.

    p.9
  26. Raw and unorganised facts provided to a computer system constitute data, which is processed to generate meaningful information.

    p.10
  27. Structured data follows a strict record structure organized in pre-specified tabular rows and columns that can easily be sorted and queried.

    p.11
  28. Semi-structured data lacks a rigid tabular structure but maintains internal tags or markers to separate data elements, as seen in HTML and CSV files.

    p.12
  29. Unstructured data does not follow any pre-defined record format, including multimedia files such as audio, video, graphics, and text documents.

    p.12
  30. Data retrieval involves fetching stored digital data from storage devices or databases for processing according to user requirements.

    p.13
  31. Software comprises the set of instructions and data that operates computer hardware to complete desired computational tasks.

    p.14
  32. Software acts as an interface between human users and computer hardware, broadly categorized into system software, programming tools, and application software.

    p.15
  33. A device driver acts as a mediator between an attached peripheral device and the operating system, handling hardware-level device operations.

    p.16
  34. A compiler translates entire high-level source code into machine code at once, whereas an interpreter translates and executes code line by line.

    p.18
  35. Free and Open Source Software (FOSS) provides users with the executable software as well as full access to the source code to modify and improve.

    p.19
  36. The operating system functions as a resource manager that supervises hardware resources including CPU, RAM, and I/O devices while supporting application execution.

    p.20
  37. A command-based interface requires users to enter textual commands using a keyboard and typically executes only a single program at a time, as in MS-DOS.

    p.21
  38. A Graphical User Interface (GUI) enables users to run programs and give instructions using visual elements such as icons, menus, and windows.

    p.21
  39. Process management in an operating system schedules active processes, allocates CPU time among them, and manages inter-process communication.

    p.22
  40. Memory management dynamically allocates and reclaims main memory space for running processes while tracking free and occupied memory locations.

    p.22
  41. File management handles the creation, updating, deletion, and access protection of files stored in secondary memory to prevent unauthorized access.

    p.23
Computer Science · Chapter 2

Encoding Schemes and Number System

2 topics · 6 formulas · 41 facts

  1. 1Number System
  2. 2Conversion between Number Systems
Formulas6 in this chapter
  • Number of characters in 7-bit ASCIIp.28
  • Number of characters in 8-bit ISCIIp.29
  • Octal base as power of twop.33
  • Four-bit representation for hexadecimal symbolsp.33
  • Three-bit binary combinations for octalp.38
  • Hexadecimal base as power of twop.39
Key facts
  1. When a keyboard key is pressed, it is internally mapped to a unique code value which is then converted into binary digits for the computer to understand.

    p.27
  2. Encoding is the mechanism of converting human-recognisable data into an equivalent cipher using a specific code.

    p.27
  3. ASCII was developed in the early 1960s to standardise character representation across different computer systems.

    p.28
  4. Standard 7-bit ASCII uses 7 bits to represent up to 128 unique characters and can encode only the character set of the English language.

    p.28
  5. In the ASCII code table, printable characters begin with Space at decimal value 32, uppercase letter A at decimal value 65, and lowercase letter a at decimal value 97.

    p.28
  6. ISCII is an 8-bit encoding scheme developed in India during the mid-1980s to facilitate the use of Indian languages on computers, representing up to 256 characters.

    p.29
  7. ISCII retains all 128 ASCII codes and assigns the remaining 128 codes, specifically the upper region 160 to 255, to the aksharas of Indian languages.

    p.29
  8. UNICODE was developed to incorporate all characters of every written language of the world by providing a unique number for every character across all devices, operating systems, and applications.

    p.29
  9. Commonly used UNICODE encodings are UTF-8, UTF-16, and UTF-32, which form a superset of ASCII where code values 0 to 128 represent the same characters as in ASCII.

    p.30
  10. Every number system has a set of unique characters or literals, whose total count is called the radix or base of the number system.

    p.30
  11. In a positional number system, the symbol at the rightmost position in the integer part has position 0, and position values increase from right to left by 1.

    p.31
  12. In the fractional part of a positional number, the first symbol has position number -1, which decreases by 1 while reading from left to right.

    p.31
  13. The positional value of each symbol in a number is computed by raising the base value of the number system to the power of that symbol position number.

    p.31
  14. The decimal number system is a base-10 system using digits 0 to 9, where a number is represented by both symbol values and power-of-10 positional values.

    p.32
  15. The binary number system is a base-2 system using digits 0 and 1, representing the OFF/low and ON/high electronic states of transistors in integrated circuits.

    p.32
  16. The octal number system is a base-8 system comprising eight digits from 0 to 7, devised to provide a compact representation for large binary numbers.

    p.32
  17. Three binary digits are sufficient to represent any octal digit because 2 raised to the power 3 equals 8.

    p.33
  18. The hexadecimal number system is a base-16 system consisting of 16 symbols, where digits 0 to 9 represent decimal 0 to 9 and letters A to F represent decimal 10 to 15.

    p.33
  19. Each alphanumeric digit in the hexadecimal system is represented as a group of 4 binary digits because 2 raised to the power 4 equals 16.

    p.33
  20. Hexadecimal and octal notations are used to simplify 16-bit or 32-bit computer memory address representations, making them easier to handle than long binary strings.

    p.34
  21. RGB colour codes on web pages use 24 bits with 8 bits each for red, green, and blue, representing a palette of 16 million colours compactly written in hexadecimal form.

    p.34
  22. Digital systems understand only binary numbers, whereas octal and hexadecimal number systems are used to simplify binary representations for humans.

    p.34
  23. To convert a decimal number to another number system with base b, repeatedly divide the quotient by b and record the remainders until the quotient is zero.

    p.35
  24. The equivalent number in the target base is obtained by collecting the noted division remainders in reverse order, from bottom to top.

    p.35
  25. Decimal to octal conversion is performed by repeatedly dividing the decimal number by 8 and collecting the remainders from bottom to top.

    p.36
  26. Decimal to hexadecimal conversion involves repeatedly dividing the decimal number by 16, replacing remainders 10 through 15 with symbols A through F, and reading from bottom to top.

    p.36
  27. To convert any number with base b to decimal, multiply each symbol by base b raised to its position number and compute the sum of all terms.

    p.37
  28. A binary number is converted to decimal by adding the products of each binary digit and its corresponding power of 2 positional value.

    p.38
  29. An octal number is converted to decimal by multiplying each octal digit by 8 raised to its position number and summing the products.

    p.38
  30. A hexadecimal number is converted to decimal by multiplying each digit or letter value by 16 raised to its position number and adding the results.

    p.38
  31. An integer binary number is converted to octal by partitioning bits into 3-bit groups from right to left and replacing each group with its octal digit.

    p.39
  32. If the number of bits in a binary number is not a multiple of 3, required zeros are added to the most significant position before grouping for octal conversion.

    p.39
  33. An octal number is converted to binary by substituting each octal digit with its equivalent 3-digit binary number and concatenating them.

    p.39
  34. An integer binary number is converted to hexadecimal by forming 4-bit groups from right to left and substituting each group with its hexadecimal symbol.

    p.39
  35. A hexadecimal number is converted to binary by substituting each hexadecimal symbol with its equivalent 4-bit binary group and combining them.

    p.40
  36. To convert a decimal fraction to another base b, repeatedly multiply the fractional part by b, recording the integer part of each product from top to bottom.

    p.40
  37. Successive multiplication of a decimal fractional part terminates when the fractional part reaches zero, starts repeating, or attains required precision.

    p.40
  38. In converting fractional decimal numbers to another base, the integer parts obtained from successive multiplications are arranged from top to bottom.

    p.41
  39. A non-decimal number with a fractional part is converted to decimal by adding products of digits and their positional values with negative powers of the base.

    p.42
  40. To convert a fractional binary number to octal or hexadecimal, form 3-bit or 4-bit groups from right to left for the integer part and from left to right for the fractional part.

    p.42
  41. Zeros are appended to the right of the fractional part of a binary number if needed to form a complete 3-bit or 4-bit group during conversion.

    p.42
Computer Science · Chapter 4

Introduction to Problem Solving

8 topics · 42 facts

  1. 1Steps for Problem Solving
  2. 2Algorithm
  3. 3Representation of Algorithms
  4. 4Flow of Control
  5. 5Verifying Algorithms
  6. 6Comparison of Algorithm
  7. 7Coding
  8. 8Decomposition
Key facts
  1. Problem solving using a computer begins with the precise identification of the problem and concludes with a complete working software solution.

    p.62
  2. The GIGO principle (Garbage In, Garbage Out) states that the correctness of the output produced by a computer directly depends on the correctness of the input provided.

    p.62
  3. Analysing a problem requires determining the core functionalities of the solution and identifying the required inputs and expected outputs.

    p.62
  4. An algorithm is a set of exact, step-by-step instructions devised in natural language to accomplish a task before programming begins.

    p.62
  5. Coding converts the finalised algorithm into a computer-readable program using a high-level programming language.

    p.63
  6. In the presence of syntactical errors, no program output is generated, whereas incorrect output signals the presence of logical errors in the program.

    p.63
  7. Standard software development methodologies employ unit testing, integration testing, system testing, and acceptance testing to systematically verify and debug applications.

    p.63
  8. An algorithm is a finite sequence of steps required to achieve the desired output in a finite amount of time, having a definite beginning and end.

    p.64
  9. The term algorithm originates from the Latin translation Algorithmi of the 9th-century Persian astronomer and mathematician Abu Abdullah Muhammad ibn Musa Al-Khwarizmi.

    p.64
  10. A programmer prepares an algorithm as a roadmap before writing code to clearly visualise instructions and avoid developing non-functional software.

    p.64
  11. A good algorithm must exhibit precision in its steps, uniqueness of each step result, finiteness to terminate after finite steps, and well-defined input and output.

    p.65
  12. Flowcharts and pseudocode are the two common methods for representing algorithms, showcasing solution logic without including implementation details.

    p.66
  13. In a flowchart, an oval terminator represents start or end, a rectangle represents a process, a diamond represents a decision branch, and a parallelogram represents data input or output.

    p.66
  14. Flowchart arrows act as connectors that explicitly indicate the sequence of operations and direction of flow of control between shapes.

    p.66
  15. Pseudocode is an informal, human-readable algorithmic notation that cannot be executed directly by a computer and has no rigid standard syntax.

    p.68
  16. Standard pseudocode keywords frequently include INPUT, COMPUTE, PRINT, INCREMENT, DECREMENT, IF/ELSE, and WHILE.

    p.68
  17. Writing pseudocode safeguards the programmer against omitting essential steps and allows non-programmers to review and verify proposed program logic.

    p.69
  18. Flow of control represents the execution sequence of program events, which can proceed in a linear sequence, branch upon selection, or iterate via repetition.

    p.70
  19. In a sequence control structure, algorithm steps execute strictly one after another without branching or conditional jumps.

    p.70
  20. Selection structures rely on conditionals evaluating to binary values of true or false to choose among alternative paths of action.

    p.71
  21. In programming languages, two-way conditional selection is represented using an if-else block, executing the else branch whenever the tested condition evaluates to false.

    p.72
  22. Repetition, also termed iteration or looping, executes a block of statements repeatedly until a specified condition is satisfied.

    p.75
  23. A loop counter variable tracks the number of executed iterations and increments until it reaches the repetition limit specified in the loop condition.

    p.75
  24. The WHILE construct handles iterative tasks when the required number of repetitions is not known beforehand and depends on dynamic input values.

    p.76
  25. Algorithm verification ensures that every component is checked and verified across all possible situations to prevent fatal software failures.

    p.77
  26. A dry run is the manual simulation of an algorithm using sample input values to uncover missing details and detect incorrect steps.

    p.77
  27. Testing an algorithm requires selecting representative input cases including boundary values, as untested scenarios can cause software to fail.

    p.77
  28. Algorithm simulation on varied test cases reveals constraints such as boundary conditions, allowing logic adjustments before coding.

    p.78
  29. Verifying an algorithm prior to software development is essential because the effort required to identify and fix flaws in an algorithm is minimal compared to debugging implemented software.

    p.79
  30. Multiple distinct algorithms can exist to solve the same computational problem, necessitating comparison to determine the most efficient approach.

    p.79
  31. Time complexity is the amount of processing time an algorithm requires to run to completion.

    p.80
  32. Space complexity is the amount of computer memory an algorithm requires during its execution.

    p.80
  33. Choosing an optimal algorithm involves evaluating trade-offs between processing time requirements (time complexity) and memory consumption (space complexity).

    p.80
  34. In prime number testing, checking divisors up to the square root of the dividend significantly reduces computational operations compared to testing all numbers up to the dividend.

    p.80
  35. Coding is the step of translating a finalised algorithm into a high-level programming language according to its established syntax rules.

    p.80
  36. Syntax is the formal grammatical rules governing statement formulation in a programming language, specifying spelling, word order, and punctuation.

    p.80
  37. Low-level machine language consisting of 0s and 1s executes directly on hardware without translation, but is machine-dependent and difficult for humans to write and maintain.

    p.80
  38. High-level programming languages are close to natural languages and portable across different computing platforms, requiring compilers or interpreters to translate source code into machine language.

    p.81
  39. Embedded systems such as digital watches, traffic signals, and smart medical devices often require specialised programming tools or assembly language code.

    p.81
  40. Decomposition is the problem-solving strategy of breaking down a complex problem into smaller, simpler, and relatively manageable sub-problems.

    p.81
  41. Decomposition follows the divide-and-conquer principle, enabling sub-problems to be examined in detail and developed independently by specialized teams.

    p.82
  42. Once decomposed sub-problems are independently solved, each component must be verified for correctness before integrating them into the final comprehensive solution.

    p.82
Computer Science · Chapter 5

Getting Started with Python

12 topics · 37 facts

  1. 1Introduction to Python
  2. 2Python Keywords and Identifiers
  3. 3Variables
  4. 4Comments
  5. 5Everything is an Object
  6. 6Data Types
  7. 7Operators
  8. 8Expressions
  9. 9Statement
  10. 10Input and Output
  11. 11Type Conversion
  12. 12Debugging
Key facts
  1. Python uses an interpreter to process program statements one by one by first translating and then executing, stopping execution if an error is encountered.

    p.87
  2. Python is a case-sensitive high-level language that uses indentation instead of curly brackets or keywords to define blocks and nested blocks of code.

    p.88
  3. In script mode, Python instructions are written and saved in a file with a .py extension for future execution, whereas interactive mode executes statements instantaneously without saving.

    p.89
  4. Python keywords are reserved words that carry a specific meaning for the interpreter and must be written exactly in lowercase, except True, False, and None.

    p.90
  5. An identifier must begin with an uppercase or lowercase letter or an underscore, cannot start with a digit, and cannot contain special symbols or keywords.

    p.91
  6. A variable in Python refers to an object stored in memory and is created and assigned a value using an assignment statement.

    p.91
  7. Variable declaration is implicit in Python, meaning variables are automatically declared upon their first assignment and must be assigned a value before use in expressions.

    p.92
  8. Comments are non-executable remarks added to source code to document the purpose and input-output requirements of a program for human programmers.

    p.92
  9. In Python, a comment starts with a hash sign (#), and everything following the hash symbol until the end of that line is ignored by the interpreter.

    p.93
  10. Python treats every value or data item as an object that can be bound to a variable name or passed to a function as an argument.

    p.93
  11. Every Python object is assigned a unique identifier corresponding to its memory address that remains constant for its lifetime, retrieved using the id() function.

    p.93
  12. Boolean (bool) is a subtype of integer consisting of True and False, where True is non-zero, non-null, and non-empty, while False is zero.

    p.94
  13. A Python sequence is an ordered collection of items indexed by integers, encompassing strings, lists, and tuples.

    p.95
  14. Lists are mutable ordered sequences enclosed in square brackets, whereas tuples are immutable sequences enclosed in parentheses whose elements cannot be changed once created.

    p.96
  15. A set is an unordered collection of unique elements enclosed in curly brackets that cannot contain duplicate values and whose elements cannot be modified once created.

    p.96
  16. None is a special data type with a single value used to signify the absence of a value, and it is distinct from both False and numeric zero.

    p.97
  17. A dictionary is a mapping data type that stores unordered key-value pairs in curly brackets, where each key is separated from its value by a colon for fast lookup.

    p.97
  18. Mutable data types like lists, sets, and dictionaries allow modifying their values in place, whereas immutable types like numbers, strings, and tuples cannot be modified once created.

    p.98
  19. The floor division operator // returns the quotient by truncating the decimal part, whereas the modulus operator % returns the remainder of dividing the left operand by the right.

    p.100
  20. The addition operator + concatenates two strings, while the multiplication operator * repeats a string by a specified integer count.

    p.100
  21. Relational operators compare values on either side and return True or False, comparing string characters lexicographically using their ASCII values.

    p.101
  22. Augmented assignment operators like += and -= combine an arithmetic operation with assignment such that x += y behaves identically to x = x + y.

    p.102
  23. Logical operators and, or, and not evaluate truth values where every operand is considered True except None, False, numeric zero, and empty sequences or collections.

    p.103
  24. The identity operator is returns True if two operands refer to the exact same memory object, whereas the membership operator in tests whether an element exists in a sequence.

    p.104
  25. An expression is a combination of constants, variables, and operators that always evaluates to a single value, whereas a standalone operator cannot form an expression.

    p.104
  26. Unary operators have higher precedence than binary operators, and the exponentiation operator ** has the highest precedence among all arithmetic operators.

    p.105
  27. Parentheses override standard operator precedence, and operators sharing the same precedence level are evaluated from left to right.

    p.105
  28. In Python, a statement is an executable unit of code processed by the interpreter, including assignment statements and print statements.

    p.106
  29. The input() function optionally displays a prompt string, accepts all user keyboard input terminated by the enter key, and always returns the input as a string.

    p.107
  30. The print() function evaluates expressions before displaying them on the screen and automatically appends a newline by default to advance to the next line.

    p.107
  31. In the print() function, the sep argument defines the separator between values with a default single space, and end specifies the trailing string with a default newline character.

    p.108
  32. Explicit type conversion, or type casting, occurs when a programmer forces a type change using functions like int() or float(), which risks information loss by discarding decimal digits.

    p.109
  33. Python does not implicitly convert integers to strings during concatenation with the plus operator, raising a TypeError unless the integer is explicitly converted via str().

    p.111
  34. Implicit type conversion, or coercion, is performed automatically by Python through type promotion, converting narrower data types to wider-sized types to avoid information loss.

    p.112
  35. Debugging is the process of identifying and removing bugs or errors from a computer program to ensure it runs correctly and produces expected results.

    p.112
  36. Syntax errors violate language grammar rules and stop execution immediately, whereas logical or semantic errors allow the program to run to completion but yield incorrect output.

    p.113
  37. Runtime errors occur during program execution when a syntactically correct statement attempts an illegal operation such as division by zero, causing abnormal termination.

    p.113
Computer Science · Chapter 6

Flow of Control

5 topics · 44 facts

  1. 1Selection
  2. 2Indentation
  3. 3Repetition
  4. 4Break and Continue Statement
  5. 5Nested Loops
Key facts
  1. The order of execution of statements in a program is known as flow of control, which Python implements using two types of control structures: selection and repetition.

    p.121
  2. In programming, selection or decision making involves choosing from two or more possible options based on a condition, and is implemented in Python using if statements.

    p.122
  3. In an if statement, the indented block of statements is executed only if the test condition evaluates to true; otherwise, execution is bypassed.

    p.123
  4. There is no limit on the number of statements that can appear as an indented block under an if statement.

    p.123
  5. The if..else statement provides two alternative execution paths, executing the if block when the condition is true and the else block when the condition is false.

    p.123
  6. When multiple conditions must be checked, conditions can be chained sequentially using the if..elif construct, where elif stands for else..if.

    p.123
  7. The syntax of a multi-way selection structure uses if followed by one or more elif statements and concludes with an optional else block.

    p.124
  8. In an if..elif ladder, conditions are evaluated sequentially from top to bottom; as soon as one condition evaluates to true, its indented block executes and the if statement terminates.

    p.125
  9. The number of elif clauses in a selection structure is dependent on the number of alternative conditions to be evaluated.

    p.125
  10. Python uses indentation rather than curly brackets to define blocks and nested block structures.

    p.126
  11. Leading whitespace consisting of spaces and tabs at the beginning of a statement is called indentation.

    p.126
  12. In Python, statements sharing the same level of indentation are grouped together into a single block of code.

    p.126
  13. The Python interpreter strictly checks indentation levels and raises a syntax error if indentation is improper or inconsistent.

    p.126
  14. It is a common programming practice in Python to use a single tab or consistent whitespace for each level of indentation.

    p.126
  15. Repetition of a set of statements in a program is called iteration and is implemented using looping constructs.

    p.127
  16. Statements in a loop execute repeatedly as long as a logical condition tested on the loop's control variable remains true.

    p.128
  17. When the loop control condition evaluates to false, the loop terminates and control transfers to the statement immediately following the loop.

    p.128
  18. The programmer must ensure that the loop condition eventually becomes false to provide an exit condition and avoid an infinite loop.

    p.128
  19. Python provides two looping constructs: the for loop, used when the number of iterations is known in advance, and the while loop.

    p.128
  20. The for statement is used to iterate over a range of values or elements of a sequence such as a string, list, or tuple.

    p.128
  21. The syntax of a for loop is 'for <control-variable> in <sequence/items in range>:' followed by an indented body of statements.

    p.128
  22. In each iteration of a for loop, the control variable is assigned the next item from the sequence until all items are exhausted.

    p.129
  23. The built-in range([start], stop[, step]) function generates a sequence of integers from start up to, but excluding, the stop value.

    p.130
  24. In the range() function, start and step are optional parameters that default to 0 and 1, respectively.

    p.130
  25. All parameters of the range() function must be integers, and passing non-integer values causes a TypeError.

    p.130
  26. The step parameter of range() can be a positive or negative integer, but it cannot be zero, which raises a ValueError.

    p.130
  27. A negative step parameter in range() generates a decreasing sequence of integers where start must be greater than stop.

    p.130
  28. The while statement executes its body of code repeatedly as long as its control condition evaluates to true.

    p.131
  29. In a while loop, the control condition is evaluated before any statement in the loop body is executed.

    p.131
  30. If the test condition of a while loop is initially false, the body of the loop is not executed even once.

    p.131
  31. Statements within the body of a while loop must update the control variable so that the loop condition eventually evaluates to false.

    p.131
  32. The break and continue statements in Python provide programmer flexibility to alter the normal execution flow of loops.

    p.132
  33. The break statement terminates the current loop immediately and resumes execution at the statement directly following that loop.

    p.133
  34. When a break statement is executed inside a loop, all remaining statements in the loop body for that iteration are skipped.

    p.133
  35. A 'while True:' loop executes indefinitely until an internal condition triggers a break statement to exit the loop.

    p.134
  36. In search algorithms or prime-testing routines, executing break terminates the loop as soon as a target is found, avoiding redundant checks.

    p.134
  37. When continue is encountered, control skips the remaining statements in the loop body for the current iteration and jumps to the next iteration.

    p.135
  38. After continue executes, if the loop condition remains true, the next iteration begins; otherwise, the loop terminates.

    p.135
  39. A loop contained inside another loop is called a nested loop.

    p.136
  40. In nested loops, for each single iteration of the outer loop, the inner loop executes through all its iterations from beginning to end.

    p.136
  41. Python does not impose any restriction on how many loops can be nested inside a loop or on the levels of nesting.

    p.137
  42. Any type of loop, whether for or while, can be freely nested within any other type of loop.

    p.137
  43. Loops can be nested inside conditional blocks such as if-else ladders, and conditional statements can be nested inside loop bodies.

    p.138
  44. When a break statement is executed inside an inner nested loop, it terminates only that inner loop, and execution resumes in the outer loop.

    p.138
Computer Science · Chapter 7

Functions

4 topics · 43 facts

  1. 1Functions
  2. 2User Defined Functions
  3. 3Scope of a Variable
  4. 4Python Standard Library
Key facts
  1. Modular programming is the process of dividing a computer program into separate independent blocks of code or sub-problems with distinct names and specific functionalities.

    p.145
  2. A function is a named group of instructions that accomplishes a specific task when invoked, providing program modularity and code reusability.

    p.145
  3. Once defined, a function can be called repeatedly from different locations in a program or from inside another function by specifying its name and passing required arguments.

    p.145
  4. Using functions reduces overall code length and simplifies debugging by eliminating the need to write identical blocks of code at multiple places in a program.

    p.146
  5. Functions facilitate collaborative programming by allowing complex projects to be divided into independent modules that team members can develop in parallel.

    p.146
  6. A user-defined function is a custom function written by a programmer to accomplish a specific task according to program requirements.

    p.146
  7. A function definition begins with the def keyword, followed by the function name and optional parameters enclosed in parentheses, ending with a colon.

    p.147
  8. Function names must follow the standard rules for naming Python identifiers and should be unique within their scope.

    p.147
  9. Statements belonging to a function body must be indented uniformly under the function header, and unindented statements are treated as outside the function.

    p.147
  10. A function is executed by calling it using its name followed by parentheses containing any required arguments.

    p.148
  11. An argument is a value or expression passed during a function call, which is received by the corresponding parameter variable defined in the function header.

    p.148
  12. At the time of a function call, the argument and its corresponding parameter initially refer to the same object in memory, sharing the same identity returned by id().

    p.149
  13. When an immutable argument such as an integer is modified inside a function, Python binds the parameter to a new memory address while the original caller variable remains unchanged.

    p.149
  14. An argument variable in the calling scope and a parameter in the function header can share the same identifier name without conflict.

    p.150
  15. A default parameter is assigned a predefined fallback value in the function header, which is used when the caller omits the corresponding argument.

    p.152
  16. Passing an explicit argument during a function call overwrites the default parameter value defined in the function header.

    p.153
  17. Default parameters must be trailing parameters in the function header, meaning every parameter to the right of a parameter with a default value must also have a default value.

    p.153
  18. Function arguments can be expressions, which Python evaluates to compute a concrete value before passing it to the function.

    p.153
  19. A function that performs calculations or displays output without returning an explicit value is called a void function, and it implicitly returns None.

    p.154
  20. The return statement immediately terminates execution of a called function, transfers control back to the caller, and optionally passes back a result.

    p.154
  21. Statements inside a function definition are executed only when the function is invoked, rather than when the interpreter encounters the def statement.

    p.155
  22. A function must be defined before it is called in the flow of execution, otherwise the Python interpreter raises a NameError.

    p.155
  23. When a function returns multiple comma-separated values, Python packages them into a single tuple that can be unpacked into individual variables by the caller.

    p.156
  24. The scope of a variable is the region of a computer program where that variable is recognized, accessible, and valid.

    p.158
  25. A global variable is defined outside all functions or blocks, is accessible throughout the program, and modifications to it affect all functions that reference it.

    p.158
  26. A local variable is defined inside a function or block, is accessible only within that specific function or block, and exists only while the function is executing.

    p.158
  27. If a variable defined inside a function shares the same name as a global variable, the local variable hides the global variable within that function scope.

    p.159
  28. To modify the value of a global variable from inside a function, the variable must be declared inside the function using the global keyword.

    p.159
  29. The Python Standard Library is an extensive collection of built-in functions and modules that facilitates rapid program development.

    p.160
  30. Built-in functions are ready-made functions built directly into the Python interpreter that can be called without importing any external module.

    p.160
  31. The built-in divmod(x, y) function takes two numeric arguments and returns a tuple containing their quotient and remainder: (x // y, x % y).

    p.161
  32. The built-in pow(x, y, z) function computes x raised to the power y modulo z, which evaluates to (x**y) % z.

    p.162
  33. The built-in sum(x, num) function returns the sum of all elements in numeric sequence x added to the optional starting value num, which defaults to 0.

    p.162
  34. A module is a Python file with a .py extension that contains definitions of multiple related functions and statements.

    p.162
  35. When a module is loaded via import modulename, its functions must be accessed using dot notation in the format modulename.functionname().

    p.163
  36. In the math module, math.ceil(x) returns the smallest integer greater than or equal to x, whereas math.floor(x) returns the largest integer less than or equal to x.

    p.163
  37. The random.random() function takes no arguments and returns a pseudo-random floating-point number in the range from 0.0 up to, but not including, 1.0.

    p.164
  38. The random.randint(x, y) function generates a random integer N such that x <= N <= y, including both endpoint integers.

    p.165
  39. The random.randrange(x, y) function generates a random integer from start value x up to, but excluding, stop value y.

    p.165
  40. Regardless of how many times an import statement is executed in a program, the Python interpreter loads the specified module into memory only once.

    p.165
  41. The from modulename import functionname statement imports specific functions into the current namespace, allowing them to be called directly without the module name prefix.

    p.166
  42. Function composition is a programming technique where functions are nested so that the output of one function serves as the argument to another function.

    p.167
  43. A docstring is a multiline string enclosed in triple quotes at the start of a module or function that documents its behavior, accessible via the __doc__ attribute.

    p.168
Computer Science · Chapter 8

Strings

5 topics · 3 formulas · 43 facts

  1. 1Strings
  2. 2String Operations
  3. 3Traversing a String
  4. 4String Methods and Built-in Functions
  5. 5Handling Strings
Formulas3 in this chapter
  • Positive index of last character in stringp.176
  • Negative index of first character in stringp.176
  • Number of characters in substring slicep.179
Key facts
  1. A string is an immutable sequence composed of one or more Unicode characters enclosed in single, double, or triple quotes.

    p.175
  2. Triple-quoted strings can span across multiple lines, whereas strings enclosed in single or double quotes cannot.

    p.175
  3. Python does not have a separate character data type; an individual character is treated as a string of length one.

    p.176
  4. Individual characters in a string are accessed via indexing in square brackets, with positive indices starting at 0 for the leftmost character.

    p.176
  5. Negative indices access string characters from right to left, where the rightmost character has index -1 and the leftmost has index -n.

    p.176
  6. Specifying a string index outside the valid range of 0 to n-1 (or -n to -1) causes Python to raise an IndexError.

    p.176
  7. String indices must be integers or expressions evaluating to integers; providing a floating-point index raises a TypeError.

    p.176
  8. The built-in len() function accepts a string as a parameter and returns the total number of characters it contains.

    p.177
  9. Strings are immutable in Python, so attempting to modify or replace an existing character using item assignment raises a TypeError.

    p.177
  10. The concatenation operator (+) joins two operand strings to produce a new string while keeping the original strings unchanged.

    p.177
  11. The repetition operator (*) repeats a string a specified number of times without altering the original string variable.

    p.178
  12. The membership operator in evaluates to True if the first string is present as a substring within the second string, and False otherwise.

    p.178
  13. The membership operator not in evaluates to True if the first string is not present as a substring within the second string, and False otherwise.

    p.178
  14. The slice str1[n:m] returns a substring starting at index n (inclusive) and ending at index m (exclusive), yielding m-n characters.

    p.179
  15. In string slicing, an end index that exceeds the length of the string is automatically truncated to the end without raising an IndexError.

    p.179
  16. When slicing with a positive step, if the first index is greater than or equal to the second index, Python returns an empty string.

    p.179
  17. Omitting the first index in str1[:m] starts the slice from index 0, whereas omitting the second index in str1[n:] slices through the end of the string.

    p.179
  18. The third index in slice str1[n:m:k] specifies the step size k, extracting every kth character starting from index n up to m-1.

    p.179
  19. Specifying a step size of -1 with omitted start and stop indices as str1[::-1] returns a copy of the string in reverse order.

    p.180
  20. Traversing a string means accessing each character sequentially from beginning to end using either a for loop or a while loop.

    p.180
  21. In for loop traversal, iteration begins at the first character and automatically terminates once the last character of the string is processed.

    p.180
  22. In while loop traversal, an explicit index variable is initialized to 0 and incremented on each iteration until it reaches len(str1).

    p.180
  23. The title() method returns a string in which the first letter of every word is converted to uppercase and all remaining letters are lowercase.

    p.180
  24. The lower() and upper() methods return copies of the string with all cased characters converted to lowercase and uppercase, respectively.

    p.181
  25. The count(str, start, end) method returns the number of non-overlapping occurrences of substring str within the optional start and end index bounds.

    p.181
  26. The find(str, start, end) method returns the lowest index where substring str begins, or returns -1 if the substring is not present.

    p.181
  27. The index() method operates identically to find(), but raises a ValueError exception when the specified substring is not found.

    p.181
  28. The startswith() and endswith() methods return True if the string begins or ends with the supplied substring, respectively, and False otherwise.

    p.181
  29. The isalnum() method returns True if all characters in the string are alphanumeric (letters or numbers) and the string is non-empty.

    p.182
  30. The islower() and isupper() methods return True if a non-empty string contains at least one cased letter and all cased letters are lowercase or uppercase.

    p.182
  31. The isspace() method returns True if a non-empty string contains only whitespace characters such as blanks, tabs, newlines, and carriage returns.

    p.183
  32. The istitle() method returns True if the string is non-empty and formatted in title case with each word capitalized and the rest lowercase.

    p.183
  33. The lstrip(), rstrip(), and strip() methods return new strings with leading, trailing, or both leading and trailing whitespace characters removed.

    p.183
  34. The replace(oldstr, newstr) method returns a copy of the string with all occurrences of substring oldstr replaced by newstr.

    p.183
  35. The separator.join(str1) method concatenates the characters of str1, inserting the calling separator string between each character.

    p.183
  36. The partition(sep) method splits the string at the first occurrence of sep, returning a 3-tuple of (part_before, separator, part_after).

    p.184
  37. If the separator is not found, partition(sep) returns a 3-tuple containing the full original string followed by two empty strings.

    p.184
  38. The split() method breaks a string into a list of substrings delimited by the specified separator, defaulting to whitespace when omitted.

    p.184
  39. A user-defined function can count occurrences of a specific character by traversing each character with a for loop and incrementing a counter variable.

    p.184
  40. Because strings cannot be modified in place, replacing specific characters requires constructing and accumulating characters into a new string.

    p.185
  41. A string can be displayed in reverse without creating a new string by iterating backward with range(-1, -len(st)-1, -1) and printing each indexed character.

    p.185
  42. A palindrome is a string that reads the same forwards and backwards, which can be verified by comparing characters from both ends moving towards the center.

    p.186
  43. In a two-pointer palindrome check, indices i and j start at 0 and len(st)-1 respectively, checking character equality while i is less than or equal to j.

    p.186
Computer Science · Chapter 9

Lists

8 topics · 42 facts

  1. 1Introduction to List
  2. 2List Operations
  3. 3Traversing a List
  4. 4List Methods and Built-in Functions
  5. 5Nested Lists
  6. 6Copying Lists
  7. 7List as Argument to a Function
  8. 8List Manipulation
Key facts
  1. In Python, a list is an ordered sequence of mutable elements enclosed in square brackets and separated by commas.

    p.189
  2. Unlike a string which consists only of characters, a list can contain elements of different data types including integers, floats, strings, tuples, and other lists.

    p.189
  3. List elements are indexed starting from 0 for forward indexing and from -1 for backward indexing, where -n accesses the first element of a list of length n.

    p.190
  4. Attempting to access a list element using an index that is outside the range of valid indices raises an IndexError.

    p.190
  5. Lists are mutable in Python, allowing individual elements to be modified or replaced in-place after creation using index assignment.

    p.190
  6. The concatenation operator + joins two or more lists together into a new list without modifying the original lists.

    p.190
  7. The concatenation operator + requires both operands to be lists; attempting to concatenate a list with a different data type raises a TypeError.

    p.191
  8. The repetition operator * replicates the elements of a list a specified integer number of times to produce a new list.

    p.191
  9. The membership operator in evaluates to True if an element exists in the list and False otherwise, while not in returns True if the element is absent.

    p.191
  10. List slicing extracts a sublist using the syntax list[start:stop:step], returning elements from index start up to but not including index stop.

    p.192
  11. When slicing a list, specifying a stop index beyond the list length does not raise an IndexError; Python simply truncates the slice at the end of the list.

    p.192
  12. When start is greater than or equal to stop with a positive step size, the slice operation results in an empty list [].

    p.192
  13. A slice with a negative step of -1 and omitted start and stop indices, written as list[::-1], returns the entire list in reverse order.

    p.192
  14. Traversing a list involves accessing each of its elements sequentially, which can be accomplished using either a for loop or a while loop.

    p.192
  15. A list can be traversed by element directly using the loop header for item in myList, or by index using range(len(myList)) to access myList[i].

    p.193
  16. When traversing a list using a while loop, an explicit index variable must be initialized to 0 and incremented on each iteration while it is less than len(myList).

    p.193
  17. The built-in function len(list) returns the total number of elements present in the list passed as an argument.

    p.193
  18. The list() function creates an empty list when called without arguments and converts any iterable sequence passed to it into a list.

    p.194
  19. The append() method adds a single element to the end of a list in-place; if passed a list as an argument, it adds that list as a single nested element.

    p.194
  20. The extend() method appends each element of the iterable passed as an argument individually to the end of the existing list.

    p.194
  21. The insert(index, element) method inserts an element at the specified index, shifting existing elements at and after that position to the right.

    p.194
  22. The count(element) method returns the number of times a specified element appears in the list, returning 0 if it is not found.

    p.194
  23. The index(element) method returns the index of the first occurrence of an element in the list and raises a ValueError if the element is not found.

    p.194
  24. The remove(element) method removes the first occurrence of a specified value from the list and generates a ValueError if the value does not exist.

    p.194
  25. The pop([index]) method removes and returns the element at the specified index, or removes and returns the last element of the list if no index is passed.

    p.194
  26. The reverse() method reverses the order of elements in the given list in-place and does not create a new list.

    p.195
  27. The sort() method sorts elements of a list in-place in ascending order by default, or descending order if reverse=True is specified.

    p.195
  28. The built-in function sorted(list) creates and returns a new sorted list consisting of the same elements, leaving the original list unmodified.

    p.195
  29. The built-in functions min(), max(), and sum() return the smallest element, largest element, and total sum of the elements in a numerical list, respectively.

    p.195
  30. A nested list is a list that contains another list as one of its elements.

    p.195
  31. Elements in a nested list are accessed using two indices myList[i][j], where index i accesses the inner sublist and index j accesses the element within that sublist.

    p.196
  32. Assigning one list variable to another using list2 = list1 does not create a new list but creates an alias, meaning both variables reference the exact same list object.

    p.196
  33. Because list aliasing shares a single underlying object, any modifications made through one variable are immediately reflected in the aliased variable.

    p.196
  34. A distinct clone of a list can be created using full slice notation newList = oldList[:] or by calling the list constructor newList = list(oldList).

    p.196
  35. A distinct copy of an existing list can be created by importing the copy module and calling copy.copy(oldList).

    p.197
  36. When a list is passed as an argument to a function, Python passes a reference to the list object, retaining the same object id inside the function.

    p.197
  37. Modifying the elements of a passed list inside a function directly mutates the original list object, reflecting the changes in the caller.

    p.198
  38. If a list parameter is assigned a new list inside a function, it references a new local object, and subsequent modifications do not affect the original list in the caller.

    p.198
  39. Before modifying an element at index i using myList[i] = newElement or deleting it with pop(i), a program should check that i is less than len(myList) to avoid an IndexError.

    p.200
  40. Before deleting an element by value using remove(element), checking if element in myList prevents the program from crashing with a ValueError.

    p.200
  41. To calculate the average of numerical items in a list, a function iterates through the list to accumulate the total sum and then divides it by the total count n.

    p.202
  42. In a linear search, each element is compared with the target value sequentially from index 0; if a match is found, its position is returned, otherwise None is returned.

    p.203
Computer Science · Chapter 10

Tuples and Dictionaries

12 topics · 44 facts

  1. 1Introduction to Tuples
  2. 2Tuple Operations
  3. 3Tuple Methods and Built-in Functions
  4. 4Tuple Assignment
  5. 5Nested Tuples
  6. 6Tuple Handling
  7. 7Introduction to Dictionaries
  8. 8Dictionaries are Mutable
  9. 9Dictionary Operations
  10. 10Traversing a Dictionary
  11. 11Dictionary Methods and Built-in Functions
  12. 12Manipulating Dictionaries
Key facts
  1. A tuple is an ordered sequence of elements of different data types, enclosed in parentheses (round brackets) and separated by commas.

    p.207
  2. If a tuple contains only a single element, the element must be followed by a comma, otherwise Python treats it as a standard integer or string.

    p.207
  3. A sequence of comma-separated elements without parentheses is treated as a tuple by default in Python.

    p.208
  4. Elements of a tuple can be accessed using zero-based positive indexing or negative indexing from -1, and out-of-range indexing raises an IndexError.

    p.208
  5. Tuples are immutable, meaning their elements cannot be changed after creation, and attempting item assignment raises a TypeError.

    p.208
  6. Although a tuple is immutable, an element within a tuple that is of a mutable type, such as a list, can be modified in-place.

    p.209
  7. Because tuples are immutable, iterating through a tuple is faster compared to iterating through a mutable list.

    p.209
  8. The concatenation operator + joins two tuples into a new tuple, and attempting to concatenate a tuple with a non-tuple causes a TypeError.

    p.209
  9. The repetition operator * creates a new tuple by repeating the tuple elements, requiring the first operand to be a tuple and the second to be an integer.

    p.210
  10. The membership operator in returns True if an element is present in the tuple, while not in returns True if the element is absent.

    p.210
  11. Tuple slicing using tuple[start:end] extracts elements from index start up to end minus one into a new tuple.

    p.210
  12. The built-in len() function returns the number of elements in a tuple, while tuple() creates an empty tuple or converts a sequence into a tuple.

    p.211
  13. The tuple count() method returns the number of times a specified element appears in the tuple, returning 0 if the element is not found.

    p.211
  14. The tuple index() method returns the index of the first occurrence of an element in a tuple, and raises a ValueError if the element is absent.

    p.211
  15. Tuple assignment allows a tuple of variables on the left of an assignment operator to be assigned respective values from a tuple on the right in one step.

    p.212
  16. In tuple assignment, the number of variables on the left must equal the number of elements in the tuple on the right, otherwise a ValueError is raised.

    p.212
  17. If expressions appear on the right side of a tuple assignment, all expressions are evaluated first before values are assigned to the left-side variables.

    p.212
  18. A tuple nested inside another tuple is called a nested tuple, and its inner elements are accessed using consecutive indexing brackets.

    p.213
  19. The escape characters \t and \n can be used within output strings to insert horizontal tabs and newline breaks respectively.

    p.213
  20. Tuple assignment enables swapping the values of two variables without using a temporary variable via the statement (num1, num2) = (num2, num1).

    p.213
  21. A Python function can return multiple values by returning them as a tuple, which the caller can unpack into separate variables.

    p.214
  22. A tuple can be constructed incrementally by repeatedly concatenating each new element as a single-element tuple using the + operator.

    p.214
  23. A dictionary is a mapping data type consisting of key-value pairs called items, where each key is separated from its value by a colon.

    p.215
  24. Dictionary keys must be unique and must belong to an immutable data type such as a number, string, or tuple, while values can be of any data type.

    p.215
  25. An empty dictionary is created using empty curly braces {} or by calling the built-in dict() function without arguments.

    p.215
  26. Items in a dictionary are ordered, meaning key-value pairs are preserved and returned in the order in which they were initially entered.

    p.215
  27. Dictionary items are accessed via keys rather than numeric indices, and attempting to access a key not present in the dictionary raises a KeyError.

    p.216
  28. Dictionaries are mutable data structures, allowing their key-value pairs to be modified, added, or deleted after the dictionary has been created.

    p.216
  29. A new item is added to a dictionary by assigning a value to a new key using the assignment syntax dict1[new_key] = value.

    p.216
  30. An existing dictionary item is modified by assigning a new value to an existing key, which overwrites the previous value mapped to that key.

    p.216
  31. The membership operator in checks if a key is present in the dictionary and returns True if found, otherwise False.

    p.217
  32. The membership operator not in returns True if a specified key does not exist in the dictionary, and returns False if the key is present.

    p.217
  33. Dictionary membership operators in and not in evaluate membership exclusively for keys, not for dictionary values.

    p.217
  34. Traversing a dictionary using a for key in dict loop iterates over each key, allowing corresponding values to be accessed via dict[key].

    p.217
  35. Traversing a dictionary using for key, value in dict.items() iterates over key-value pairs as tuples, accessing keys and values simultaneously.

    p.217
  36. The built-in len() function returns the total number of key-value pairs stored in the dictionary passed as an argument.

    p.218
  37. The dict() constructor creates a new dictionary from an iterable sequence of key-value pairs, such as a list of two-element tuples.

    p.218
  38. The keys(), values(), and items() dictionary methods return view objects containing all keys, all values, and all (key, value) tuples respectively.

    p.218
  39. The dict.get() method returns the value for a given key, and returns None instead of raising a KeyError if the key is absent.

    p.219
  40. The dict.update() method appends key-value pairs from one dictionary into another, overwriting values for any duplicate keys.

    p.219
  41. The del statement removes a key-value item with del dict[key], or completely deletes the entire dictionary variable from memory with del dict.

    p.219
  42. The dict.clear() method removes all items from a dictionary, leaving it as an empty dictionary {}.

    p.219
  43. Frequencies of elements in a sequence can be determined with a dictionary by checking if each item is in the dictionary to increment its count or initialise it to 1.

    p.221
  44. A dictionary can serve as a lookup table to map discrete input values to replacement values, such as mapping numeric digits to number names.

    p.222
Computer Science · Chapter 11

Societal Impact

6 topics · 42 facts

  1. 1Digital Footprints
  2. 2Digital Society and Netizen
  3. 3Data Protection
  4. 4Cyber Crime
  5. 5Indian Information Technology Act (IT Act)
  6. 6Impact on Health
Key facts
  1. A digital footprint is the trail of data reflecting the activities performed by an individual online whenever they surf the Internet using digital devices.

    p.230
  2. Active digital footprints encompass data that a user intentionally submits online, such as emails written, social media posts, and responses submitted on websites or apps.

    p.230
  3. Passive digital footprints are created unintentionally when browsing the web, visiting websites, or using mobile apps, and include IP addresses, device details, and browsing history.

    p.230
  4. Digital footprints are predominantly stored on remote servers hosting the applications, meaning a user cannot easily erase them or guarantee their full elimination from the Internet.

    p.230
  5. Digital footprints can be used to trace a user's physical location, device specifications, and online behavior, which may be utilised for targeted advertising or exploitation.

    p.230
  6. A digital citizen or netizen is anyone who uses digital technology along with the Internet and practices safe, ethical, and legal conduct online.

    p.231
  7. Ethical netiquette requires avoiding copyright violations by obtaining permission before using copyrighted material, and sharing only true, verified, and non-redundant expertise.

    p.231
  8. Respectful netiquette entails honouring other users' privacy by never sharing their private communications, images, or documents without mutual consent, and respecting diversity.

    p.232
  9. Cyber bullying is repeated insulting, degrading, threatening, or intimidating online behaviour aimed at publicly ridiculing, hurting, or harassing a victim.

    p.232
  10. An Internet troll deliberately sows discord by posting inflammatory or off-topic messages for amusement; the most effective way to discourage trolls is to ignore their comments.

    p.232
  11. Communication etiquette requires being precise by respecting time and bandwidth limits, avoiding large email attachments by using cloud links, and ignoring unsolicited spam emails.

    p.233
  12. Communication must remain polite and non-aggressive in both synchronous channels like chat or video calls and asynchronous channels like emails or forum posts.

    p.233
  13. Social media etiquette requires maintaining account security with strong, frequently changed passwords and never sharing personal credentials such as usernames and passwords.

    p.234
  14. Users should never arrange to meet an online acquaintance in person because online personas can be fabricated, and one should critically validate news before believing or reposting it.

    p.234
  15. Content uploaded to social media platforms is stored permanently on remote servers even if deleted locally, requiring extreme caution before sharing sensitive personal photos or files.

    p.234
  16. Sensitive data includes biometric, health, financial, or personal records whose breach can cause substantial harm, requiring protection through encryption and authentication.

    p.235
  17. Intellectual Property refers to creations of the human mind, including inventions, literary and artistic expressions, designs, and symbols, which are legally protected through copyrights, patents, and trademarks.

    p.235
  18. Copyright is automatically granted to creators of original works, conferring exclusive legal rights to reproduce, distribute, display, perform, and create derivative works from the material.

    p.236
  19. A patent is an exclusive legal right granted upon application for an invention, protecting it for a period of 20 years and allowing the patentee to control its commercial manufacture and distribution.

    p.236
  20. A trademark protects visual symbols, words, names, logos, or slogans that distinguish the commercial goods or services of one enterprise from another, preventing the use of confusingly similar marks.

    p.236
  21. For software intellectual property, the program code is protected by copyright, the functional expression of the idea is protected by a patent, and the brand name and logo are protected by a registered trademark.

    p.236
  22. Plagiarism is the unethical act of presenting someone else's work, ideas, or derived concepts as one's own without providing adequate citation or acknowledging the original source.

    p.237
  23. Copyright infringement occurs when copyrighted material is used, downloaded, or reproduced without the owner's permission or payment, even if source attribution is given.

    p.237
  24. Trademark infringement is the unauthorized commercial use of a registered trademark on products or services, which can lead to legal proceedings by the trademark owner.

    p.237
  25. Creative Commons licenses grant recipients rights to copy, modify, and redistribute creative works such as websites, music, and text while allowing authors to specify licensing terms.

    p.238
  26. The GNU General Public License provides end users the freedom to run, study, share, and modify software, requiring all derivative works to preserve the same licensing rights.

    p.238
  27. Software piracy is the unauthorized reproduction, use, or distribution of software, which amounts to illegal copyright infringement regardless of whether it is done for sale or personal use.

    p.238
  28. Cyber crime encompasses criminal activities carried out in a digital environment where a computer is either the target of the crime or the tool used to commit the offense.

    p.239
  29. A computer virus is malicious self-replicating code that corrupts systems or destroys data, whereas malware is software designed specifically to gain unauthorized access to computer systems.

    p.239
  30. Ethical hackers (white hat hackers) identify vulnerabilities during software testing and report them to system owners with positive intent, thereby strengthening cybersecurity.

    p.239
  31. Non-ethical hackers (black hat hackers or crackers) break into digital systems without authorization to steal sensitive data, cause system damage, or obtain illicit monetary gain.

    p.240
  32. Phishing is an unlawful attempt to fraudulently obtain sensitive credentials like passwords and banking details using deceptive emails or websites that mimic authentic institutions.

    p.240
  33. Identity theft involves unlawfully obtaining a person's identifiable data—such as banking credentials, Aadhaar, or PAN—to commit financial fraud, criminal evasion, or medical theft.

    p.240
  34. Ransomware is malicious software that encrypts a victim's computer files and demands payment to restore access or stop the public release of confidential information.

    p.241
  35. Cyber crime prevention requires maintaining regular offline data backups, using updated antivirus software, downloading software exclusively from HTTPS sites, and configuring strong unique passwords.

    p.241
  36. The Indian Information Technology Act 2000 (amended in 2008) provides a legal framework for electronic governance by legally recognizing electronic records and digital signatures.

    p.242
  37. Digital signatures are electronic equivalents of paper certificates issued by licensed Certifying Authorities under Section 24 of the Indian IT Act 2000 to authenticate digital records.

    p.242
  38. The Cyber Appellate Tribunal is established under the IT Act to resolve cyber disputes, including hacking, source document tampering, password misuse, and unauthorized data disclosure.

    p.242
  39. Ergonomics is the science of designing workplaces, equipment, and systems to ensure safety and comfort, reducing physical fatigue and repetitive strain injuries from prolonged computer usage.

    p.243
  40. Proper workstation ergonomics requires a viewing distance of 19–24 inches, viewing angle of 30 degrees, lumbar support for the lower back, straight wrists, and 90-degree seat and knee angles.

    p.243
  41. Eye strain caused by digital screen glare can be mitigated by periodically shifting focus to distant objects, taking regular breaks, and engaging in outdoor physical activities.

    p.244
  42. Improper posture, unaligned keyboard usage, and excessive screen time can cause chronic wrist and finger injuries, musculoskeletal pain, physical fatigue, stress, and obesity.

    p.244