Study smarter with Fiveable
Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.
Programming isn't just about memorizing syntax—it's about understanding how computers process information and how you can control that process. Every concept in this guide connects to a fundamental question: How do we store data? How do we make decisions? How do we repeat tasks efficiently? How do we organize code for reuse? These principles appear in every programming language you'll ever learn, making them the true foundation of computer science.
When you're tested on these concepts, you're being evaluated on your ability to choose the right tool for the problem, not just recall definitions. Can you explain why you'd use a loop instead of repeated statements? Do you understand when a function improves your code? Don't just memorize what each concept does—know what problem each one solves and how they work together to create dynamic programs.
Every program needs to hold information somewhere. Data storage concepts determine how your program remembers, organizes, and accesses the information it needs to function.
Compare: Variables vs. Arrays—both store data, but variables hold single values while arrays hold collections. If an exam asks about storing multiple related items (like test scores), arrays are your answer; for single values (like a user's name), use a variable.
Programs need to receive information and present results. Input/output operations form the bridge between your code and the outside world—users, files, and other systems.
input() or scanf(), file reading, or data from other programsprint() or printf(), file writing, or sending data to other systemsCompare: Console I/O vs. File I/O—both move data in and out of your program, but console operations are temporary and interactive while file operations create permanent records. FRQs often ask you to modify programs to save results—that's when file handling becomes essential.
Programs need to evaluate conditions and perform calculations. Operators and control structures give your code the ability to think, compare, and choose different paths.
AND requires both true, OR requires at least one true, NOT inverts the resultfor loops iterate a known number of times, while loops continue until a condition becomes falseCompare: for loops vs. while loops—both repeat code, but for loops are ideal when you know the iteration count in advance (processing each array element), while while loops handle uncertain repetition (waiting for valid input). Choose based on whether the endpoint is known.
As programs grow, organization becomes critical. Functions and object-oriented principles help you write maintainable, modular code that doesn't repeat itself.
Compare: Functions vs. Methods—both are reusable code blocks, but functions stand alone while methods belong to objects and can access that object's internal data. When code needs to operate on object-specific data, use methods; for general-purpose operations, use functions.
Writing code means solving problems. Algorithms provide the logical steps, while debugging ensures those steps work correctly.
Compare: Syntax errors vs. Logic errors—syntax errors are caught by the compiler and prevent your program from running, while logic errors let the program run but produce incorrect results. Logic errors are harder to find because the code "works"—it just doesn't do what you intended.
| Concept | Best Examples |
|---|---|
| Data Storage | Variables, Arrays, Lists |
| Data Types | Integers, Floats, Strings, Booleans |
| User Interaction | Input functions, Print statements, File I/O |
| Decision Making | If-else statements, Comparison operators |
| Repetition | For loops, While loops |
| Code Organization | Functions, Methods, Classes |
| OOP Principles | Encapsulation, Inheritance, Polymorphism |
| Problem Solving | Sorting algorithms, Searching algorithms, Debugging |
Which two data structures both store collections of items, and what key difference determines when you'd choose one over the other?
Compare and contrast for loops and while loops—give a specific scenario where each would be the better choice.
If a program needs to remember user data after closing, which concept from this guide solves that problem, and what are the three basic operations involved?
Which three types of operators would you use to write a condition like "if the score is greater than 90 AND the student is enrolled"? Identify each operator type in that statement.
A student writes a program that runs without errors but produces incorrect output. What type of error is this, and what debugging technique would you recommend they try first?