1. Home
  2. Explore
  3. Computer Science
  4. How Computers Work

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

How Computers Work

  • 28Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Electrical Fundamentals and Binary

How does a computer represent binary information using voltage?

28 questions

  1. 1

    How does a computer represent binary information using voltage?

    Model answer

    A computer represents binary using two voltage levels: high voltage (e.g., 3.3 or 5 V) represents 1 (on/true), and low voltage (0 V) represents 0 (off/false).

    Explanation

    Electrical circuits in computers have two stable states—high and low voltage—which map directly to binary digits, enabling digital logic.

  2. 2

    What are the two types of MOSFETs in terms of how they behave as switches?

    Model answer

    An N-channel MOSFET closes (conducts) when a high voltage is applied to the gate (like a push-to-make switch); a P-channel MOSFET opens (breaks) when a high voltage is applied (like a push-to-break switch).

    Explanation

    MOSFETs are voltage-controlled switches. N-channel and P-channel are complementary: one turns on when the other turns off with the same gate voltage.

  3. 3

    Explain the structure of a CMOS pair and its function.

    Model answer

    A CMOS pair consists of an N-channel and a P-channel MOSFET with their gates connected. When input is high, the N-channel conducts to output high and the P-channel blocks ground; when input is low, the P-channel conducts to ground and the N-channel blocks high.

    Explanation

    CMOS pairs are the building blocks of logic gates. They use complementary transistors to produce a clean output (high or low) without a direct path from power to ground.

  4. 4

    What is doping in semiconductor manufacturing?

    Model answer

    Doping is the process of adding trace amounts of impurity elements (like gallium or arsenic) to silicon to change its electrical properties, creating either P-type (positive) or N-type (negative) regions.

    Explanation

    Doping increases conductivity by introducing extra holes (P-type) or electrons (N-type), enabling the formation of transistor regions.

  5. 5

    Describe the two main techniques used in lithography to build transistors on a silicon die.

    Model answer

    Deposition builds up a uniform layer of material across the die, and etching removes unwanted material selectively using chemicals or plasma.

    Explanation

    These techniques are used repeatedly with photoresist and masks to pattern the layers that form transistors and interconnects.

  6. 6

    What is a NOT gate and how is it implemented using CMOS transistors?

    Model answer

    A NOT gate outputs the opposite of its input: input 1 gives output 0, and input 0 gives output 1. It is implemented by connecting the drain of an N-channel to the output and the source of a P-channel to the output, with the gates tied together.

    Explanation

    The CMOS NOT gate inverts the input because when input is high, N-channel conducts to ground (0), and when input is low, P-channel conducts to Vdd (1).

  7. 7

    What does the NAND gate output and why is it considered universal?

    Model answer

    A NAND gate outputs 0 only when all inputs are 1, and 1 otherwise. It is universal because any other logic gate (AND, OR, NOT, etc.) can be created using only NAND gates.

    Explanation

    Universality means NAND is sufficient to implement any Boolean function, simplifying the design of digital circuits.

  8. 8

    How is a binary number converted to decimal? Provide an example.

    Model answer

    Binary digits are multiplied by powers of 2 (starting from the rightmost digit as 202^020) and summed. For example, binary 101 = 1×22+0×21+1×20=51 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 51×22+0×21+1×20=5 in decimal.

    Explanation

    This positional system is analogous to base-10, but uses base-2, making it natural for two-state electronic circuits.

  9. 9

    Draw the circuit for adding two 1-bit binary numbers (A and B) to produce a 2-bit sum (C).

    Model answer

    The sum's rightmost bit (least significant) is A XOR B, and the carry bit is A AND B. So C = (A XOR B, A AND B).

    Explanation

    XOR outputs 1 when inputs differ (0+1 or 1+0), and AND outputs 1 only when both are 1, producing a carry.

  10. 10

    How does binary multiplication by a power of two work?

    Model answer

    Multiplying by 2 in binary (10 in binary) is done by shifting all bits one place to the left and appending a 0 to the right—a bit shift left.

    Explanation

    Bit shifting is efficient because it only requires wiring, not a full multiplier circuit.

  11. 11

    Explain how a computer determines whether two numbers are equal using logic gates.

    Model answer

    For each pair of corresponding bits, an XNOR gate outputs 1 if the bits are equal. Then an AND gate takes all XNOR outputs; if all are 1, the numbers are equal.

    Explanation

    XNOR (complement of XOR) returns true when inputs match. ANDing all bitwise equality checks yields a single bit indicating overall equality.

  12. 12

    How does a computer represent signed integers (positive and negative numbers)?

    Model answer

    The most significant bit (leading bit) is used as a sign bit: 0 indicates positive, 1 indicates negative.

    Explanation

    This sign-magnitude representation allows both positive and negative numbers within a fixed number of bits, though modern computers often use two's complement for arithmetic convenience.

  13. 13

    What is a latch and how does it store a single bit of data?

    Model answer

    A latch is a circuit made from NAND gates that, when enabled, holds a stable output value (0 or 1) even after the input changes, using feedback (output fed back to input).

    Explanation

    Feedback creates a bistable circuit that remembers its state until the enable signal is active and a new input is applied.

  14. 14

    What is the purpose of the clock in a computer?

    Model answer

    The clock provides a regular oscillating signal that synchronizes operations, ensuring that each step (e.g., loading inputs, performing addition, storing output) completes before the next begins.

    Explanation

    Clock cycles define the timing of data movement and logic operations, preventing race conditions and ensuring reliable computation.

  15. 15

    In terms of speed and capacity, compare cache, RAM, and hard disk.

    Model answer

    Cache is fast but small (tens of KB), RAM is slower but larger (GB), and hard disk is slowest but stores large amounts of data permanently (hundreds of GB). There's a trade-off between speed and storage capacity.

    Explanation

    This hierarchy balances cost and performance: frequently used data is kept in faster memory closer to the processor.

  16. 16

    What is the difference between 32-bit and 64-bit programs in terms of memory addressing?

    Model answer

    32-bit programs use 32-bit memory addresses, limiting addressable RAM to about 4 GB (since 232=42^{32} = 4232=4 billion bytes). 64-bit programs use 64-bit addresses, allowing access to much more RAM.

    Explanation

    As RAM sizes grew beyond 4 GB, 64-bit addressing became necessary to uniquely address every byte.

  17. 17

    Describe the von Neumann architecture's approach to storing instructions.

    Model answer

    Instructions are stored as binary numbers in the same memory as data. The processor fetches an instruction from memory, decodes it, and executes it, then moves to the next instruction.

    Explanation

    Storing instructions as data allows programs to be modified and loaded flexibly, forming the basis of most modern computers.

  18. 18

    How does a computer know how many bytes an instruction takes?

    Model answer

    Each instruction type has a fixed length (e.g., an add instruction might take 25 bytes: 1 opcode byte plus 8-byte addresses for each operand). The CPU knows the length from the opcode and advances the program counter accordingly.

    Explanation

    Fixed-length instructions allow the processor to locate the next instruction by simply adding the known length to the current address.

  19. 19

    What is a jump instruction and what does it enable?

    Model answer

    A jump instruction tells the computer to go to a specified memory address and execute the instruction there, instead of the next sequential instruction. This enables loops.

    Explanation

    Loops are essential for repetitive tasks like updating a game world or processing input continuously.

  20. 20

    What makes a computer Turing complete?

    Model answer

    A computer is Turing complete if it can perform conditional jumps (jump only if a condition is true) and has unlimited memory and time. With that, it can compute any computable function.

    Explanation

    Conditional jumps provide the ability to make decisions and execute different code paths, which in combination with loops allows arbitrary computations.

  21. 21

    Why do programmers use high-level languages like C instead of writing machine instructions directly?

    Model answer

    High-level languages are human-readable and abstract away details like memory addresses, instruction formats, and bit widths. A compiler translates the high-level code into machine instructions.

    Explanation

    This improves productivity, reduces errors, and makes code portable across different hardware architectures.

  22. 22

    What is a function (or method) in programming and how is it implemented in memory?

    Model answer

    A function is a reusable block of code that performs a specific task, stored once in memory. When called, the program jumps to the function's address, executes it, and jumps back to the caller.

    Explanation

    Functions avoid code duplication and allow modular programming. They are compiled into libraries (e.g., DLL files on Windows).

  23. 23

    How does a computer display produce colors using pixels?

    Model answer

    Each pixel consists of three LEDs (red, green, blue). Varying the brightness of each LED (controlled by a byte value 0-255) creates any perceivable color.

    Explanation

    The human eye has red, green, and blue cones, so additive mixing of these three primaries produces the full color spectrum.

  24. 24

    Explain how a computer determines the memory address corresponding to a pixel at coordinates (x, y).

    Model answer

    If the display width is W pixels and each pixel uses 3 bytes (RGB), the memory offset from the start of the frame buffer is (y×W+x)×3(y \times W + x) \times 3(y×W+x)×3 bytes.

    Explanation

    This linear mapping from 2D coordinates to memory allows easy manipulation of pixel data through arithmetic operations.

  25. 25

    What is the Bresenham algorithm used for?

    Model answer

    It's an algorithm for drawing a straight line between two points on a pixel grid using only integer arithmetic, avoiding floating-point operations.

    Explanation

    Bresenham's algorithm efficiently determines which pixels to fill to approximate a line, fundamental to computer graphics.

  26. 26

    How does a computer produce sound from a speaker?

    Model answer

    The computer sends binary numbers representing the desired current level at each time step to a sound card, which converts digital values to analog currents that oscillate a membrane to create sound waves.

    Explanation

    This digital-to-analog conversion allows reproduction of arbitrary sound waveforms stored as sequences of binary samples.

  27. 27

    How does a keyboard communicate a key press to the computer?

    Model answer

    Keys are arranged in a grid. Pressing a key makes an electrical connection between a horizontal and vertical row, identifying the key. The keyboard sends a message (e.g., a byte indicating the key's code and whether it was pressed or released) to the computer.

    Explanation

    The keyboard controller detects the grid intersection and sends a standardized message (like a scancode) to the system, which places it in memory for the operating system or application to process.

  28. 28

    Describe how a computer mouse tracks movement and communicates it.

    Model answer

    The mouse tracks horizontal and vertical movement (e.g., using optical sensors) and sends relative displacement values to the computer. The operating system updates the cursor's pixel coordinates by adding/subtracting these deltas.

    Explanation

    Mouse inputs are processed as changes in position and button states, which are used by programs to detect clicks and drags.

1 of 28
Question 1 of 28

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent