1/32
Flashcards covering key concepts from the lecture notes on how computers work, binary numbers, and the Python environment and basics.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the CPU and what does it do in a computer?
The central processing unit is the computer's brain; it executes the program's instructions.
What are RAM and the hard disk, and how do they differ in speed and volatility?
RAM is fast, volatile memory used while a program runs; the hard disk (or SSD) is slower, permanent storage.
Describe the life cycle of a program from storage to execution.
A program sits on the hard drive, you double-click to load it into RAM, and the CPU executes its steps one at a time.
What is an instruction and how does it relate to an algorithm?
An instruction is a single operation; a correct sequence of instructions forms an algorithm.
What does a compiler do?
Translates symbolic code written by humans into binary instructions that the CPU can execute.
What is the relation between symbols and binary information in computing?
Humans write symbols; computers store and process binary data; a compiler translates symbols to binary.
How is text represented in binary using ASCII in the lecture notes?
ASCII maps symbols to binary patterns; for example, decimal 65 maps to the symbol shown as 'a' in the notes.
What is a bit and how is it physically represented?
A bit is the basic 0 or 1 value, stored by charging or discharging a transistor.
What is a byte and how many bits does it contain?
A byte is eight bits and typically represents a single character.
What is Moore's Law as described in the notes?
Transistors double roughly every year, enabling more RAM, CPU, and storage, with the trend described up to around 2025.
What is the difference between symbolic information and digital information?
Symbolic information (humans' symbols) is translated into digital binary information the computer can process.
What is binary (base-2) and how many digits does it use?
Binary uses digits 0 and 1; each position represents a power of two.
What is the purpose of the binary subscript, such as _2, when writing numbers?
It indicates the number is written in base-2 (binary) rather than decimal.
How is the decimal number 26 represented in binary, using the power-series approach?
26 in binary is 11010.
How do you convert a decimal number to binary using divide-by-two? (Example: 109)
Divide by two repeatedly, recording remainders; read remainders in reverse order to get 109 in binary as 1101101.
What is the purpose of the binary subscript in numbers, and how would you read 1010_2?
The subscript tells you the base; 1010_2 is the binary representation of a number.
What are the basic Python data types mentioned and how do you denote strings?
Int for integers, Float for real numbers, Str for strings (strings are written with quotes).
What is a Python value or object?
A value (or object) is a piece of data that the program manipulates; in Python, value and object are the same concept.
What is a Python function, and what is an example?
A function is a reusable block of code; print() is a built-in function used to display output.
What is a Python comment and how is it written?
A comment starts with # and is ignored by Python; used for human-readable notes.
What is the file extension for Python scripts and how are they run in the example?
Python scripts use the .py extension; run via the IDE's run button or from a Python shell.
What is the difference between division / and floor division // in Python?
/ returns a floating-point result; // returns the floor (integer) result for integers (and a float if any operand is float).
What is the effect of the expression 5 / 2 in Python?
It yields 2.5 as a float.
What is the order of operations in Python?
Exponentiation (**) first, then multiplication/division, then addition/subtraction; use parentheses to override.
What is the purpose of the Python shell in an IDE and why is it useful?
An interactive prompt that lets you try commands before writing a full program; acts as a sandbox.
What is the significance of the 'Hello World' program in Python?
A first simple program to verify the environment by printing a string.
Why are file formats like BMP and PNG mentioned, and what role do file extensions play?
Different formats store binary data in different ways; file extensions help indicate how bits are stored/interpreted.
How does Python represent negative numbers according to the notes?
Python uses an extra bit to indicate sign, with negative numbers shown using that sign bit in the binary representation.
What is the relationship between Python abstractions (integers and characters) and the underlying binary representation?
Python shows integers and characters in a friendly form, but underneath they are stored as binary; Python handles the encoding/decoding automatically.
What is the recommended approach to solving programming problems as described, including breaking into pieces?
Break a complex problem into smaller subproblems, define each subproblem, write and test its algorithm, then integrate.
What is the 'algorithm' in programming language terms?
An algorithm is the correct order of instructions that perform a task when implemented in a programming language.
What is the role of a 'current step' in the CPU diagram in the notes?
It shows the instruction the CPU is about to execute; steps are fetched and executed one at a time in sequence.
What are some examples of common Python types shown and how are they printed or identified?
Examples include int, float, and str; type() reveals the type (e.g., class int, class float, class str).