Skip to content
Book 1: Theory Fundamentals

Book 1 · Chapter 3

Hardware

§3.1§3.2Banker · ≈ 14.8 m · →B1·3

This chapter is in the ebook.

Read it in full on cswithzak.com. Every question has its mark scheme and every program is ready to run. The free practice for each section is below, with the short code the book prints beside it.

Open in the ebook

For the whole chapter

§3.1 Computers and their components · Memory types · Monitoring and control systems

Short code B1·3·1

§3.2 Logic gates and logic circuits

Short code B1·3·2

Input, output, memory and storage

Short code B1·3·10

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Embedded systems

Short code B1·3·11

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Printing: laser and 3D printers

Short code B1·3·12

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Sound in and out: microphone and speaker

Short code B1·3·13

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Touchscreens and virtual reality headsets

Short code B1·3·14

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Storage devices: magnetic, flash and optical

Short code B1·3·15

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Buffers

Short code B1·3·16

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

RAM and ROM

Short code B1·3·17

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

SRAM and DRAM

Short code B1·3·18

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Monitoring and control systems

Short code B1·3·19

DECLARE Temp : REAL
DECLARE HeaterOn : BOOLEAN
DECLARE Minute : INTEGER
Temp ← 17.0
HeaterOn ← FALSE
FOR Minute ← 1 TO 10
   IF Temp < 18.0 THEN
      HeaterOn ← TRUE
   ENDIF
   IF Temp > 24.0 THEN
      HeaterOn ← FALSE
   ENDIF
   OUTPUT Minute, "  ", Temp, "  ", HeaterOn
   IF HeaterOn = TRUE THEN
      Temp ← Temp + 2.0
   ELSE
      Temp ← Temp - 1.5
   ENDIF
NEXT Minute
Check for the heater trace table (not printed).

Output

1  17  TRUE
2  19  TRUE
3  21  TRUE
4  23  TRUE
5  25  FALSE
6  23.5  FALSE
7  22  FALSE
8  20.5  FALSE
9  19  FALSE
10  17.5  TRUE
Run and checked before printing

The six logic gates

Short code B1·3·20

def NOT(a): return 1 - a
def AND(a, b): return a & b
def OR(a, b): return a | b
def NAND(a, b): return NOT(AND(a, b))
def NOR(a, b): return NOT(OR(a, b))
def XOR(a, b): return a ^ b

print("A B | NOT_A AND OR NAND NOR XOR")
for A in (0, 1):
    for B in (0, 1):
        print(A, B, "|", NOT(A), AND(A, B), OR(A, B), NAND(A, B), NOR(A, B), XOR(A, B))
Every gate's truth table, computed. Each gate is a one-line function; the loops try all four input pairs in binary counting order.

Output · 4 rows

A BNOT_A AND OR NAND NOR XOR
0 01 0 0 1 1 0
0 11 0 1 1 0 1
1 00 0 1 1 0 1
1 10 1 1 0 0 0
Run and checked before printing

From expression to circuit

Short code B1·3·21

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

From circuit to expression and truth table

Short code B1·3·22

def NOT(a): return 1 - a
def AND(a, b): return a & b
def OR(a, b): return a | b
def NAND(a, b): return NOT(AND(a, b))
def NOR(a, b): return NOT(OR(a, b))
def XOR(a, b): return a ^ b

print('A B C P Q X')
for A in (0, 1):
    for B in (0, 1):
        for C in (0, 1):
            P = NAND(A, B)
            Q = XOR(B, C)
            X = AND(NAND(A, B), XOR(B, C))
            print(A, B, C, P, Q, X)
The frost-alarm table by program: one variable per working column, in the same order you would fill them in by hand.
Run and checked before printing

From a problem statement

Short code B1·3·23

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

From a truth table to an expression

Short code B1·3·24

def NOT(a): return 1 - a
def AND(a, b): return a & b
def OR(a, b): return a | b
def NAND(a, b): return NOT(AND(a, b))
def NOR(a, b): return NOT(OR(a, b))
def XOR(a, b): return a ^ b

print("Rows where X = 1:")
for A in (0, 1):
    for B in (0, 1):
        for C in (0, 1):
            X = OR(OR(AND(AND(NOT(A), NOT(B)), C), AND(AND(NOT(A), B), C)),
                   AND(AND(A, B), NOT(C)))
            if X == 1:
                print(A, B, C)
Checking the sum of products: the program prints only the rows where X = 1. They are exactly the three rows of the table.

Output

Rows where X = 1:
0 0 1
0 1 1
1 1 0
Run and checked before printing

Workbook 1: Hardware

Short code W1·3 · Theory Fundamentals Workbook

The write-in workbook for this chapter has drills, exam-style practice, trace tables, fix-the-mistake and mark-it-yourself pages. Its full mark schemes and an interactive version arrive here with the chapter.

Ask Z about Hardware
Buy ZAK's books — WhatsApp the books desk: Buy the booksPrint or ebook