1. Home
  2. Explore
  3. Computer Science
  4. CPU and Memory Basics

Study methods

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

CPU and Memory Basics

  • 75Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: CPU and Memory

What is the central processing unit's primary job in a computing device?

75 questions

  1. 1

    What is the central processing unit's primary job in a computing device?

    Model answer

    The CPU executes programs, or code, by reading and processing instructions.

    Explanation

    The CPU is the central component that executes the program instructions stored in memory.

  2. 2

    What does a CPU do after power is applied?

    Model answer

    It begins reading executable data from external memory and continues program execution while power remains applied.

    Explanation

    The CPU continuously consumes program data from memory and does not stop unless the system is interrupted or powered off.

  3. 3

    How is computer memory organized, and what values can a byte store?

    Model answer

    Memory is organized as an array of numbered bytes, and each byte can store a value from 0 to 255.

    Explanation

    A byte is the basic memory unit described, with 256256256 possible values.

  4. 4

    What is a memory address?

    Model answer

    A memory address is the ordinal number used to identify a particular memory cell.

    Explanation

    Addresses allow the CPU to specify exactly which memory cell it wants to access.

  5. 5

    Why does memory cell number 300 have address 299?

    Model answer

    Memory addressing starts at zero, so the first cell is address 0 and cell number 300 is address 299.

    Explanation

    The address is one less than the ordinary cell number because numbering is zero-based.

  6. 6

    Compare ROM and RAM in terms of their usual contents and capabilities.

    Model answer

    ROM usually stores pre-programmed code and is read-only, whereas RAM stores temporary data and can be both read and written.

    Explanation

    ROM commonly contains code intended for execution, while RAM holds working data generated or loaded during execution.

  7. 7

    What happens to ROM and RAM when power is interrupted?

    Model answer

    ROM retains its data, while RAM loses its data when power is interrupted.

    Explanation

    ROM is nonvolatile, whereas the RAM described is volatile memory.

  8. 8

    Give one example of a physical device containing RAM and one containing ROM.

    Model answer

    A DIMM stick is an example of RAM, and a BIOS chip is an example of ROM.

    Explanation

    DIMMs provide working memory, while the BIOS chip stores firmware used during startup.

  9. 9

    What is BIOS, and when is it executed?

    Model answer

    BIOS is a small program stored in ROM that is executed every time the system boots.

    Explanation

    The BIOS provides startup code that the CPU can execute immediately after power-up or reset.

  10. 10

    What is firmware in the described simple computer?

    Model answer

    Firmware is a program stored in ROM that is designed to run on a particular device.

    Explanation

    The term firmware indicates software closely associated with and intended for specific hardware.

  11. 11

    What is the address bus, and what is its purpose?

    Model answer

    The address bus is a set of electrical wires that carries a binary memory address from the CPU to external devices.

    Explanation

    The CPU uses the address bus to identify the memory cell or device it wants to access.

  12. 12

    Why is the address bus unidirectional?

    Model answer

    It is unidirectional because addresses are sent from the CPU to external devices and not back to the CPU.

    Explanation

    CPU address lines act as outputs, while memory address pins act as inputs.

  13. 13

    How does the CPU represent a memory address on the address bus?

    Model answer

    It represents the address as a pattern of binary ones and zeros, with one bit carried on each address line.

    Explanation

    Computers use binary signals to communicate numerical values between devices.

  14. 14

    How would a CPU place the address 44206 on a 16-line address bus?

    Model answer

    It would convert 44206 to a 16-bit binary number and place those bits on address lines A0A_0A0​ through A15A_{15}A15​.

    Explanation

    Each binary digit is assigned to one address line.

  15. 15

    Where are the least significant and most significant address bits placed on a 16-bit address bus?

    Model answer

    The least significant bit is placed on A0A_0A0​, and the most significant bit is placed on A15A_{15}A15​.

    Explanation

    Address-line numbering begins at zero, matching the zero-based convention used for memory addresses.

  16. 16

    What is the control bus used for?

    Model answer

    The control bus carries signals that specify and coordinate operations such as reading, writing, memory requests, and input-output requests.

    Explanation

    Control signals tell devices what type of operation the CPU is attempting.

  17. 17

    What are the functions of the RD and WR control signals?

    Model answer

    RD indicates a read operation, while WR indicates a write operation.

    Explanation

    The CPU uses these signals to tell memory devices whether data should be supplied or stored.

  18. 18

    What does it mean that RD and WR are active low?

    Model answer

    An active-low signal performs its function when it is at logic zero; therefore, the CPU pulls RD or WR low to activate it.

    Explanation

    A low signal on RD requests reading, and a low signal on WR requests writing.

  19. 19

    Why are the READ and WRITE signals mutually exclusive?

    Model answer

    They are mutually exclusive because the system cannot read from and write to memory simultaneously during the described operation.

    Explanation

    The CPU selects one operation by activating either READ or WRITE, not both.

  20. 20

    Why does the CPU activate READ even when accessing ROM?

    Model answer

    The CPU uses READ for every memory read without needing to know whether the addressed device is ROM or RAM, and ROM uses the signal to know when to place data on the bus.

    Explanation

    The read signal coordinates the timing of the memory device's response.

  21. 21

    What is the data bus, and why is it bidirectional?

    Model answer

    The data bus transfers data between the CPU and other devices in both directions: from memory to the CPU during reads and from the CPU to memory during writes.

    Explanation

    Unlike the address bus, the data bus must support both receiving and sending data.

  22. 22

    How does data direction change during a memory read?

    Model answer

    During a read, the memory device drives the data bus as an output, and the CPU treats its data-bus lines as inputs.

    Explanation

    The memory device supplies the requested value for the CPU to receive.

  23. 23

    How does the width of the data bus affect a computer system?

    Model answer

    The data-bus width determines how many bits can be transferred at once and therefore strongly affects system performance.

    Explanation

    An 8-bit, 16-bit, 32-bit, or 64-bit designation commonly refers to the system's data width.

  24. 24

    What does an 8-bit data bus imply about the size of one memory cell in the example?

    Model answer

    It implies that one memory cell is 8 bits, or 1 byte, in size.

    Explanation

    The example transfers one complete byte through its 8-bit data bus.

  25. 25

    What are operation codes, or opcodes?

    Model answer

    Opcodes are machine-code values that tell the CPU which operation to perform.

    Explanation

    A value read from ROM can represent an instruction rather than ordinary data.

  26. 26

    How does the CPU execute a machine-code instruction stored in ROM?

    Model answer

    It reads the instruction byte from the addressed ROM cell, interprets it as an opcode, and performs the operation specified by that opcode.

    Explanation

    The ROM contains firmware in machine-code form, which the CPU fetches and executes.

  27. 27

    What operation is represented in the example by the value 112?

    Model answer

    In the example, 112 is an opcode instructing the CPU to write the value 205 to address 62088.

    Explanation

    The numerical value is presented as a sample machine-code instruction.

  28. 28

    Why must two memory chips connected to the same buses not drive the data bus simultaneously?

    Model answer

    If both chips respond at once, their outputs can conflict and create a data-bus collision.

    Explanation

    Only the device selected by the address should place data on the shared bus.

  29. 29

    What is address decoding?

    Model answer

    Address decoding is the use of logic gates to activate a device when the address bus contains a specified pattern or falls within an assigned range.

    Explanation

    The decoder determines which device should respond to a particular CPU address.

  30. 30

    How are memory devices assigned within a computer's address space?

    Model answer

    The address space is divided into fixed ranges, with each memory device assigned a particular range that cannot be changed in the designed system.

    Explanation

    The CPU selects a device based on which range contains the requested address.

  31. 31

    What determines the total size of a CPU's address space?

    Model answer

    The number of address-bus lines determines the address space, which is tied to the CPU model.

    Explanation

    Each additional address line increases the number of distinct binary addresses available.

  32. 32

    How large is the address space of a CPU with 16 address lines?

    Model answer

    It can address 216=65,5362^{16} = 65{,}536216=65,536 bytes, or 64 kilobytes.

    Explanation

    Sixteen binary address lines provide 65,53665{,}53665,536 distinct addresses.

  33. 33

    What are the first and last addresses in a 16-bit address space?

    Model answer

    The address space begins at address 0 and ends at address 65,535.

    Explanation

    There are 65,53665{,}53665,536 addresses, numbered from zero through one less than the total.

  34. 34

    If ROM and RAM divide a 16-bit address space equally, how much space does each receive?

    Model answer

    Each chip receives 32 kilobytes, or 32,768 bytes.

    Explanation

    The total 64-kilobyte space is divided into two equal ranges.

  35. 35

    What address ranges are assigned to ROM and RAM in the example?

    Model answer

    ROM occupies addresses 0 through 32,767, and RAM occupies addresses 32,768 through 65,535.

    Explanation

    ROM receives the lower half of the 16-bit address space, while RAM receives the upper half.

  36. 36

    Why is ROM placed at the beginning of the address space in the example?

    Model answer

    The CPU begins execution at address 0 after reset, so the first firmware instruction must be located there.

    Explanation

    Reset clears the program counter, causing the CPU to fetch its next instruction from address 0.

  37. 37

    What happens to the program counter when the CPU is reset?

    Model answer

    The program counter is set to zero.

    Explanation

    Zeroing the program counter causes program execution to restart from address 0.

  38. 38

    How are the example ROM and RAM ranges represented in hexadecimal?

    Model answer

    ROM occupies 0x00000x00000x0000 through 0x7FFF0x7FFF0x7FFF, while RAM occupies 0x80000x80000x8000 through 0xFFFF0xFFFF0xFFFF.

    Explanation

    Hexadecimal provides a compact representation of the same 16-bit address ranges.

  39. 39

    Why is hexadecimal commonly used in computer programming?

    Model answer

    Hexadecimal is a compact and readable way to represent binary values.

    Explanation

    Each hexadecimal digit corresponds directly to a group of four binary bits.

  40. 40

    Which symbols are used as hexadecimal digits?

    Model answer

    Hexadecimal uses the decimal digits 0 through 9 and the letters A through F, for a total of 16 digits.

    Explanation

    The letters represent values from 10 through 15.

  41. 41

    How does one hexadecimal digit correspond to binary digits?

    Model answer

    Each hexadecimal digit represents one group of four binary digits.

    Explanation

    There are 161616 possible four-bit patterns and 161616 hexadecimal digits.

  42. 42

    How many hexadecimal digits are needed to represent 8-bit and 16-bit values?

    Model answer

    An 8-bit value requires two hexadecimal digits, and a 16-bit value requires four hexadecimal digits.

    Explanation

    Every hexadecimal digit represents four bits.

  43. 43

    Define the terms nibble, byte, and word as used in the content.

    Model answer

    A nibble is 4 bits, a byte is 8 bits, and a word is 16 bits or more.

    Explanation

    These terms describe common groupings of binary data.

  44. 44

    How can a hexadecimal number be identified in C and in assembly language?

    Model answer

    C commonly uses the prefix 0x0x0x, while assembly language commonly appends the letter H.

    Explanation

    For example, the same hexadecimal value may be written as 0x80000x80000x8000 in C or 8000H8000H8000H in assembly.

  45. 45

    How does the most significant address bit distinguish the ROM and RAM ranges in the example?

    Model answer

    Addresses below 0x80000x80000x8000 have A15=0A_{15}=0A15​=0 and select ROM, while addresses at or above 0x80000x80000x8000 have A15=1A_{15}=1A15​=1 and select RAM.

    Explanation

    The highest address bit divides the 16-bit address space into its lower and upper halves.

  46. 46

    What are the CS and CE signals used for?

    Model answer

    CS, or CE, activates or selects a memory device.

    Explanation

    A selected chip may respond to the CPU, while an unselected chip must not drive the shared data bus.

  47. 47

    What does it mean that CS or CE is active low?

    Model answer

    The memory chip is selected when its CS or CE input is at logic zero.

    Explanation

    A high signal leaves the chip unselected in the described circuit.

  48. 48

    What is the Z-state of a memory device's output?

    Model answer

    The Z-state, or high-impedance state, makes the output behave as if it were disconnected from the bus.

    Explanation

    Tri-state outputs allow an inactive device to share the bus without interfering with the active device.

  49. 49

    What is the purpose of the OE signal on a memory chip?

    Model answer

    OE, or Output Enable, controls when a memory chip is permitted to place data on the data bus.

    Explanation

    For RAM, active OE indicates that data is being read from memory.

  50. 50

    How are the ROM and RAM chips selected in the simple circuit?

    Model answer

    ROM receives A15A_{15}A15​ directly as its active-low CE signal, while RAM receives the inverted A15A_{15}A15​ signal.

    Explanation

    When A15=0A_{15}=0A15​=0, ROM is selected; when A15=1A_{15}=1A15​=1, the inverter makes RAM's CE low and selects RAM.

  51. 51

    How are the READ and WRITE signals connected to the memory chips?

    Model answer

    READ is connected to the OE inputs of both chips, while WRITE is connected to RAM's Write Enable input and is not used by ROM.

    Explanation

    Both memory types can respond to reads, but only RAM accepts write operations.

  52. 52

    Describe how the simple computer reads its first instruction after reset.

    Model answer

    Reset sets the program counter and address bus to zero; the CPU pulls READ low, ROM is selected because A15=0A_{15}=0A15​=0, and ROM places address 0's contents on the data bus.

    Explanation

    RAM remains inactive and its outputs stay in the high-impedance state.

  53. 53

    Why does RAM not interfere when the CPU reads address 0 in the example?

    Model answer

    RAM is not selected because the address is in ROM's range, so its data lines remain in the high-impedance state.

    Explanation

    Address decoding ensures that only ROM drives the data bus for address 0.

  54. 54

    Describe how the CPU writes 0xAA0xAA0xAA to RAM address 0xB0000xB0000xB000.

    Model answer

    The CPU places 0xB0000xB0000xB000 on the address bus, places 0xAA0xAA0xAA on the data bus, and pulls WRITE low; because A15=1A_{15}=1A15​=1, RAM is selected and stores the byte.

    Explanation

    The address belongs to RAM's upper-half range, and the active write signal causes RAM to record the data.

  55. 55

    Why is 0xAA0xAA0xAA often used in memory testing?

    Model answer

    0xAA0xAA0xAA has the alternating binary pattern 101010101010101010101010, which makes it useful for testing memory lines and storage.

    Explanation

    Alternating zeros and ones can reveal faults involving neighboring or individual signal lines.

  56. 56

    How does the CPU read the value previously stored at RAM address 0xB0000xB0000xB000?

    Model answer

    It places 0xB0000xB0000xB000 on the address bus and pulls READ low; RAM is selected and places the stored value on the data bus for the CPU to receive.

    Explanation

    The same address decoding used during the write selects RAM during the later read.

  57. 57

    Why can the CPU access a contiguous address space even though it contains separate ROM and RAM chips?

    Model answer

    The CPU sees only addresses and data, while decoding logic causes each memory chip to respond only when the requested address belongs to its assigned range.

    Explanation

    The physical division between chips is hidden by the address-decoding scheme.

  58. 58

    How can more complex address decoders create narrower device ranges?

    Model answer

    They can use several address lines and additional control signals to recognize more specific address patterns.

    Explanation

    Using more inputs allows multiple memory and input-output devices to be individually selected.

  59. 59

    Who determines which address range is assigned to each memory device, and who must understand those assignments?

    Model answer

    The system developer determines the ranges, and the firmware programmer must know them when writing software.

    Explanation

    Software must use the correct addresses to communicate with the intended hardware.

  60. 60

    What is video RAM, and how does writing to it affect a computer?

    Model answer

    Video RAM is regular RAM whose contents control the display; writing data to it changes what appears on the screen.

    Explanation

    VRAM is mapped into the system so that stored values correspond to display information.

  61. 61

    How are VRAM addresses typically related to screen positions?

    Model answer

    Lower addresses typically correspond to the upper-left portion of the screen, and higher addresses correspond to the lower-right portion.

    Explanation

    Cells are commonly arranged from left to right and then from top to bottom, although exceptions can exist.

  62. 62

    How do input-output ports differ from memory in the described system?

    Model answer

    Ports use read and write operations in a separate address space and are accessed with separate machine-language instructions.

    Explanation

    Although ports have a distinct address space, they still use the CPU's address and data buses.

  63. 63

    What are MEMREQ and IOREQ used for?

    Model answer

    MEMREQ identifies memory operations, while IOREQ identifies input-output operations; both are traditionally active low.

    Explanation

    These control signals distinguish memory accesses from port accesses that use the same address bus.

  64. 64

    Why must the memory chips also respond to MEMREQ?

    Model answer

    They should be selected only during memory operations, not during input-output operations that happen to use the same address bus.

    Explanation

    Memory chip selection requires both an appropriate address and an active memory-request signal.

  65. 65

    How is a 1-bit output port implemented in the LED example?

    Model answer

    A D-type flip-flop is used, with its data input connected to the data bus and its clock input activated by decoded control signals.

    Explanation

    The flip-flop stores the selected data bit and uses its output to control the LED.

  66. 66

    How is port address 0xFF0xFF0xFF recognized in the LED circuit?

    Model answer

    An 8-input AND gate detects when address lines A0A_0A0​ through A7A_7A7​ are all logic one.

    Explanation

    The binary representation of 0xFF0xFF0xFF is eight ones.

  67. 67

    Which signals must be decoded for the LED port to respond only to output-port writes?

    Model answer

    The circuit must decode the port address, the active-low WRITE signal, and the active-low IOREQ signal.

    Explanation

    Decoding IOREQ prevents the port from responding to a memory write to the same numerical address.

  68. 68

    Why is IOREQ necessary when the LED port and memory can have the same numerical address?

    Model answer

    IOREQ distinguishes an input-output operation from a memory operation, preventing both the port and memory cell from responding to the same write.

    Explanation

    Without IOREQ decoding, a write to port 0xFF0xFF0xFF could also affect memory cell 0xFF0xFF0xFF.

  69. 69

    Which data bit controls the LED in the 1-bit port example?

    Model answer

    The least significant data bit, D0D_0D0​, controls the LED.

    Explanation

    The flip-flop's data input is connected directly to the D0D_0D0​ line.

  70. 70

    What CPU operation turns the LED on?

    Model answer

    The CPU writes the value 1 to port 0xFF0xFF0xFF while pulling WRITE and IOREQ low.

    Explanation

    The decoded write clocks the flip-flop, storing a one and illuminating the LED.

  71. 71

    What CPU operation turns the LED off?

    Model answer

    The CPU performs the same decoded write to port 0xFF0xFF0xFF but sends the value 0.

    Explanation

    Storing zero in the flip-flop changes its output and turns off the LED.

  72. 72

    How do ISA and PCI buses traditionally allow expansion cards to share slots?

    Model answer

    All slots are connected in parallel, and decoding circuitry on each expansion card selects the card's assigned addresses and signals.

    Explanation

    Individual device addressing is achieved through decoding rather than separate communication lines for every card.

  73. 73

    What did configuring an ISA Sound Blaster's address and interrupt line actually configure?

    Model answer

    It configured the settings used by the card's decoder circuitry.

    Explanation

    The decoder used those settings to determine when the card should respond.

  74. 74

    What advantage did the traditional ISA and PCI arrangement provide for expansion cards?

    Model answer

    An expansion card could be inserted into different slots and still operate because the shared bus and card-level decoding handled device selection.

    Explanation

    The parallel connection and local decoding made slot position less central to communication.

  75. 75

    How does PCI Express differ from the traditional shared-bus approach?

    Model answer

    PCI Express provides each motherboard slot with independent communication lines for the individual expansion board installed there.

    Explanation

    It abandons the older principle in which all slots shared parallel bus connections and relied on card-level decoding.

1 of 75
Question 1 of 75

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent