Exploring Computer Science – Comprehensive Midterm Notes
Planning / Problem-Solving Process
- Ordered Steps (know exact sequence)
- Define / Understand the Problem – clarify goals, constraints, stakeholders.
- Research & Generate Ideas – gather information, data, prior solutions.
- Brainstorm / Make a Plan – sketch multiple approaches; select tools, timeline.
- Explore Possibilities – prototype, simulate, weigh pros & cons.
- Select an Approach / Carry Out the Plan – implement chosen solution.
- Reflection / Review – test, evaluate results, document lessons learned.
Computer Fundamentals
Core Definitions
- Computer – “one that computes; a programmable electronic device that can store, retrieve, and process data.”
- Computing – “to determine or calculate, especially by mathematical means or by using a computer.”
Major Hardware / Software Components
- Central Processing Unit (CPU)
- Executes basic operations, exchanges data with memory & peripherals, orchestrates everything else.
- Operating System (OS)
- The master program that manages hardware, files, user interface, and provides a platform for other programs.
- Memory (RAM)
- Temporarily stores data / instructions for quick CPU access; volatile.
- Hard Drive (Mass Storage)
- Long-term, non-volatile storage using magnetic platters (HDD) or flash (SSD).
- SSD vs. HDD
- SSD – Pro: speed, small size; Con: cost.
- HDD – Pro: low cost, availability; Con: slower, larger physical size.
- Optical Disk Drive – Uses laser/electromagnetic waves to read/write CDs, DVDs, Blu-ray.
- Monitor – Video display screen.
- Video Card (GPU) – Generates the visual output sent to a monitor.
- Sound Card – Generates or reproduces audio; interfaces with speakers.
- Keyboard – Primary text input device.
- Mouse – Hand-held pointing device that controls on-screen pointer.
- Modem – Converts digital computer signals to analog telephone (or other medium) and back.
World Wide Web & Search Engines
- Web 1.0 vs. Web 2.0
- Web 1.0 – static pages, read-only, minimal user interaction.
- Web 2.0 – dynamic, user-generated content, social networking, collaboration.
- Search Engine – Program that indexes the web and returns ranked pages matching a query.
- Main players: Google, Bing, Yahoo, DuckDuckGo, Baidu, Yandex.
- Search Syntax (symbols / keywords)
- Combine keywords →
AND or implicit space. - Exclude words / sites →
-keyword or site:-example.com. - Weather for location →
weather city (e.g., weather Boston). - Dictionary definition →
define:word.
- Website Evaluation Criteria
- Accuracy – correctness, verifiable sources.
- Authority – author’s credentials, domain reputation.
- Objectivity – bias, purpose (inform/persuade/sell).
- Accessibility – ease of use, navigation, ADA compliance, load speed.
Computer Programs
- Program – a set of instructions that tell a computer what to do.
Artificial Intelligence (AI)
- Turing Test – Proposed by Alan Turing; if a human interrogator cannot distinguish the machine’s responses from a human’s, the machine is said to exhibit intelligence.
- Artificial Intelligence – The field concerned with making computers perform tasks that normally require human intelligence.
- Key AI Capabilities
- Acoustic Processing – handling sound waves, filtering noise.
- Speech Recognition – converting spoken words to text.
- Facial Recognition – identifying or verifying persons from images.
Binary Number System
- Concept – base-2 system using digits 0 and 1.
Decimal → Binary (LEFT → RIGHT)
- Show card = 1, hide card = 0.
- Example: 3110
- 16+8+4+2+1=31 → binary: 11111.
Binary → Decimal (LEFT → RIGHT)
- Example: 111112 → 16+8+4+2+1=31.
Capacity Rule
- “Add 1 bit, double patterns.” Mathematically: 2n patterns for n bits.
- 1 bit → 2
- 2 bits → 4
- …
- 8 bits → 256 (one byte)
Decoding Messages
- Convert binary to decimal, map to alphabet table (1 = a, 2 = b, … 26 = z).
Graph Theory: Spanning Trees
- Spanning Tree – A sub-graph that connects all vertices with the minimum possible edges (no cycles).
- The sample graph shown has 16 possible spanning trees.
- Minimum Spanning Tree (MST) – Spanning tree whose total edge weight is minimum; useful in networking, circuit design, clustering, route planning.
Programming Concepts (Code.org)
Debugging
- Process of locating & fixing errors (bugs) that prevent correct software operation.
Coordinate System (Game Lab)
- Uses X (horizontal) & Y (vertical) coordinates.
- Screen origin: top-left (0,0).
Variables
- Container for data.
- Naming Rules
- No spaces.
- Cannot start with number.
- Case-sensitive; spelling must be exact.
- Style
- camelCase:
sizeOfRectangle. - underscores:
size_of_rectangle. - Choose meaningful names; maintain consistency.
Boolean Logic & Conditionals
- Boolean value – true / false.
- Comparison Operators
- Less-than <, greater-than >, equal ==.
- Conditional Statements
if (condition) {…}if … else … – choose between two code blocks.
Draw Loop & Animation
- Program flow in Game Lab
- Run all code outside
draw() once. - Execute code inside
draw() repeatedly (~30 frames per second).
- Definitions
- Animation – series of images (frames) creating motion.
- Frame – single image.
- Frame Rate – frames per second.
- Randomness
- Pseudo-random – algorithmic.
- True random – physical process.
- Velocity Blocks
velocityX, velocityY change position automatically each frame.- Equivalent to counter pattern:
sprite.x = sprite.x + 1;.
Functions
- Group of commands given a name; enables reuse.
- Creating – wrap commands in a
function block, give it a name. - Calling – write
functionName(); wherever needed. - Advantages
- Organizes code (large blocks can sit out of the way).
- Improves readability (names explain purpose).
- Removes repetition (change code in one place).