🌍 CS50x: Introduction to Computer Science · subject

CS50x: Introduction to Computer Science Foundations and Computational Thinking Syllabus

The Foundations and Computational Thinking syllabus for CS50x: Introduction to Computer Science in full: 2 chapters and 9 topics, every one listed below, plus 50 Foundations and Computational Thinking flashcards with answers.

2Chapters
9Topics
50Flashcards

Foundations and Computational Thinking syllabus: all 2 chapters

Expand any chapter to see its topics and sub-topics.

  1. Binary and Representation

    4 topics
    • Binary and the Bit
    • Representing Data
    • Algorithms and Pseudocode
    • Abstraction
  2. Scratch

    5 topics
    • Functions, Arguments, and Return Values
    • Variables
    • Boolean Expressions and Conditionals
    • Loops
    • Events and Threads

CS50x: Introduction to Computer Science Foundations and Computational Thinking flashcards — 50 questions with answers

  1. What is a bit, and what values can it hold?

    A bit (binary digit) is the smallest unit of information in computing. It can hold exactly one of two values: $0$ or $1$.

  2. What is a byte, and how many distinct values can one byte represent?

    A byte is a group of $8$ bits. It can represent $2^{8} = 256$ distinct values, typically the range $0$ to $255$.

  3. How many distinct values can $n$ bits represent, and what is the largest unsigned integer they can store?

    $n$ bits can represent $2^{n}$ distinct values; the largest unsigned integer is $2^{n} - 1$.

  4. Why do computers use binary (base-2) rather than decimal (base-10)?

    Computer hardware is built from millions of transistors, which are switches with only two reliable states: on ($1$) and off ($0$). Two states map naturally to base-2.

  5. In the binary number system, what does each digit position represent?

    Each position represents a power of $2$: from right to left the place values are $2^{0}, 2^{1}, 2^{2}, 2^{3}, \ldots$ (i.e., $1, 2, 4, 8, \ldots$), just as decimal positions represent powers of $10$.

  6. Convert the binary number $1010_{2}$ to decimal, showing the expansion.

    $1010_{2} = 1 \times 2^{3} + 0 \times 2^{2} + 1 \times 2^{1} + 0 \times 2^{0} = 8 + 0 + 2 + 0 = 10$.

  7. How is the decimal number $7$ written in binary?

    $7 = 4 + 2 + 1 = 1 \times 2^{2} + 1 \times 2^{1} + 1 \times 2^{0}$, so $7_{10} = 111_{2}$.

  8. What is integer overflow?

    Integer overflow occurs when a computed value exceeds the maximum a fixed number of bits can store (e.g., above $2^{n} - 1$ for $n$ unsigned bits), so the value wraps around or becomes incorrect because there are no more bits to carry into.

  9. What is ASCII and what problem does it solve?

    ASCII (American Standard Code for Information Interchange) is a standard that maps numbers to text characters so computers can represent letters, digits, and symbols as bits. For example, capital 'A' is the number $65$.

  10. What are the ASCII codes for 'A' and 'a', and what pattern do the letters follow?

    'A' is $65$ and 'a' is $97$. Letters are numbered consecutively ('B' $= 66$, 'b' $= 98$, etc.), and each lowercase letter is exactly $32$ greater than its uppercase counterpart.

  11. What is Unicode and why was it created?

    Unicode is a character-encoding standard that extends ASCII, using more bits per character so it can represent characters from virtually all human languages plus symbols and emoji—far beyond ASCII's limited English-centric set.

  12. How does a computer represent a color using the RGB model?

    A color is stored as three numbers giving the intensity of red, green, and blue light. With one byte per channel, each value ranges from $0$ to $255$; e.g., $(255, 0, 0)$ is pure red and $(255, 255, 255)$ is white.

  13. How does a computer represent an image?

    An image is a grid of pixels (dots), where each pixel's color is stored as numbers—typically an RGB triple. More pixels and more bits per pixel give higher resolution and color depth.

  14. How are videos and music represented digitally?

    A video is a sequence of images (frames) shown rapidly, e.g., $24$ or $30$ frames per second. Music can be represented as numbers encoding notes, duration, and volume (e.g., MIDI), or as digitized sound waves.

  15. If the byte pattern for $65$ is stored in memory, how does the computer know whether it means the number $65$, the letter 'A', or a color value?

    Context. The bits themselves are just $0$s and $1$s; the program or file format being used (text editor, image viewer, calculator) determines how the pattern is interpreted.

  16. Define 'algorithm'.

    An algorithm is a step-by-step set of precise instructions for solving a problem—transforming an input into a desired output.

  17. In the input-output model of computational thinking, where does the algorithm fit?

    Computing is modeled as: input $\to$ algorithm $\to$ output. The algorithm is the 'black box' of steps that converts the problem's input into the correct output.

  18. What is pseudocode?

    Pseudocode is a human-readable, language-independent description of an algorithm's steps, written in structured plain language rather than actual programming syntax.

  19. What two properties must a good algorithm have?

    Correctness (it always produces the right output) and efficiency (it does so using as little time/as few steps as reasonably possible).

  20. In CS50's phone book example, what are the three searching approaches and how fast is each?

    (1) Linear search one page at a time: up to $n$ steps. (2) Two pages at a time: about $\frac{n}{2}$ steps (and can miss entries without a correction step). (3) Divide-and-conquer (binary search), halving the book each time: about $\log_{2} n$ steps.

Show the other 30 Foundations and Computational Thinking flashcards
  1. What precondition must hold before binary search can be used, and roughly how many steps does it take on $n$ items?

    The data must be sorted. Binary search halves the search space each step, taking about $\log_{2} n$ steps—e.g., a $1024$-page book needs only about $10$ halvings since $2^{10} = 1024$.

  2. Compare linear search and binary search on $n$ items.

    Linear search checks items one by one: works on unsorted data, worst case $n$ steps. Binary search repeatedly halves a sorted collection: requires sorted data, worst case about $\log_{2} n$ steps—much faster for large $n$.

  3. What common building blocks does pseudocode share with real programming languages?

    Functions (verbs/actions), conditionals (branches like 'if/else'), Boolean expressions (yes/no questions), and loops (repeated steps)—the same constructs appear in nearly every language.

  4. Define 'abstraction' in computer science.

    Abstraction is the simplification of a complex system by hiding its implementation details and exposing only what is needed to use it—treating lower-level complexity as a 'black box'.

  5. Why is abstraction such a powerful idea in programming?

    It lets programmers solve problems in layers: once a subproblem is solved (e.g., a function), you can reuse it without rethinking its internals, which reduces complexity, avoids duplication, and makes large systems manageable.

  6. Give an example of layers of abstraction in how a computer works.

    Transistors form logic gates; gates form circuits; circuits run machine code; machine code underlies programming languages; languages implement functions; functions build programs. Each layer hides the details of the layer below.

  7. How is a function an example of abstraction?

    A function wraps a multi-step process behind a single name (e.g., 'get_input' or 'move'). Callers only need to know what it does, its inputs, and its output—not how it works internally.

  8. What is a function in programming?

    A function is a named, reusable block of code that performs a specific task. It may take inputs (arguments) and may produce an output (a return value).

  9. What is an argument to a function?

    An argument is an input value passed to a function that influences its behavior—e.g., in print("hello"), the string "hello" is the argument.

  10. What is a return value?

    A return value is the output a function hands back to the code that called it, so the result can be stored in a variable or used in further computation—e.g., an input function returning what the user typed.

  11. What is the difference between a function's return value and its side effect?

    A return value is data passed back to the caller for later use. A side effect is something observable the function does besides returning (e.g., printing to the screen). A print function has a side effect; an input function has a return value.

  12. What is the difference between a parameter and an argument?

    A parameter is the variable named in the function's definition that receives an input; an argument is the actual value supplied when the function is called.

  13. Why do programmers break programs into functions?

    Functions enable reuse (write once, call many times), abstraction (hide details), readability, and easier testing/debugging since each piece does one well-defined task.

  14. What is a variable?

    A variable is a named storage location in memory that holds a value which the program can read and change—like a labeled box containing data.

  15. In code, what does the statement counter = counter + 1 mean?

    It is assignment, not an equation: evaluate the right side (the current value of counter plus $1$), then store the result back into counter. The value of counter increases by $1$.

  16. What is variable scope?

    Scope is the region of a program where a variable is accessible. A local variable exists only inside the function (or block) where it is defined; a global variable is accessible throughout the program.

  17. What is the typical pattern for using a counter variable with a loop?

    Initialize it once before the loop (e.g., set counter to $0$), then update it inside the loop each iteration (e.g., increase by $1$), and optionally test it in the loop condition to decide when to stop.

  18. What is a Boolean expression?

    A Boolean expression is an expression that evaluates to exactly one of two values—true or false—such as $x < y$ or a question like 'is it raining?'.

  19. What is a conditional statement?

    A conditional lets a program choose between different paths of execution based on a Boolean expression—e.g., if a condition is true, run one block; else, run another. It creates a 'fork in the road'.

  20. List the standard comparison operators used in Boolean expressions.

    Equal to ($==$ in most languages), not equal ($\neq$, written !=), less than ($<$), greater than ($>$), less than or equal ($\leq$, written <=), and greater than or equal ($\geq$, written >=).

  21. In most programming languages, what is the difference between = and ==?

    A single = is assignment (store a value in a variable); a double == is comparison (test whether two values are equal, yielding true or false). Confusing them is a classic bug.

  22. How do the logical operators AND, OR, and NOT combine Boolean values?

    AND (&&) is true only if both operands are true; OR (||) is true if at least one operand is true; NOT (!) inverts a value, turning true into false and vice versa.

  23. In an if / else if / else chain, how many branches execute, and why prefer 'else if' over separate ifs?

    Exactly one branch executes—the first whose condition is true (or the final else). Using else if makes the branches mutually exclusive and avoids wastefully re-checking conditions that separate independent ifs would evaluate.

  24. What is a loop and why are loops useful?

    A loop is a construct that repeats a block of code multiple times. Loops eliminate copy-pasted repetition, make programs shorter and easier to change, and allow repetition a number of times determined at runtime.

  25. How does a while loop work, and what is the minimum number of times its body can run?

    A while loop checks its Boolean condition before each iteration and runs the body only while the condition is true. If the condition is false initially, the body runs zero times.

  26. What three parts appear in a typical for loop, and what does each do?

    (1) Initialization: create/set a counter, e.g., $i = 0$. (2) Condition: checked before each iteration, e.g., $i < n$. (3) Update: runs after each iteration, e.g., increment $i$ by $1$. The body repeats until the condition is false—here, exactly $n$ times.

  27. What is an infinite loop, when is one useful, and how can a program leave it?

    An infinite loop repeats forever because its condition is always true (e.g., while true, or Scratch's 'forever' block). It is useful for programs that must run continuously, such as waiting for events; code can exit early with a break statement (or by stopping the program).

  28. How does a do-while style loop differ from a while loop, and when is it useful?

    A do-while checks its condition after the body, so the body always runs at least once; a while checks before, so it may run zero times. Do-while is ideal for prompting a user repeatedly until the input is valid.

  29. What is an event in programming, and what is event-driven programming?

    An event is an occurrence the program can detect and respond to—a key press, mouse click, or a received message. Event-driven programming structures code as handlers (listeners) that run when their event fires, like Scratch's 'when green flag clicked' or 'when I receive message' blocks.

  30. What is a thread, and what does multithreading enable?

    A thread is an independent sequence of instructions that a computer can execute alongside others. Multithreading lets a program do multiple things concurrently—e.g., in Scratch, multiple sprites (or scripts) each run in their own thread and act simultaneously.

CS50x: Introduction to Computer Science Foundations and Computational Thinking FAQ

What is in the CS50x: Introduction to Computer Science Foundations and Computational Thinking syllabus?

CS50x: Introduction to Computer Science Foundations and Computational Thinking is split into 2 chapters: Binary and Representation and Scratch. Together they contain 9 topics.

How many chapters are in CS50x: Introduction to Computer Science Foundations and Computational Thinking?

2 chapters, containing 9 topics. The largest chapter is Scratch, with 5 topics.

Are there flashcards for CS50x: Introduction to Computer Science Foundations and Computational Thinking?

Yes — a 50-card Foundations and Computational Thinking deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.