---
title: Problem set 1
heading: "Problem set 1: logic levels, numbers and Boolean algebra"
eyebrow: C7 · Problem set 1
type: problems
---

::: hook
These problems use lessons 1 to 5: logic levels and noise margins, binary, hex and two's complement, Boolean algebra and gates, and canonical forms. Number truth-table rows from 0, with the first-listed input as the top bit.
:::

::: pool
pick: 12

::: check
kind: parts
given: VOH = 2.4 | 2.9; VIH = 1.7 | 2; VIL = 0.7 | 0.9; VOL = 0.2 | 0.4

## A logic family guarantees $V_{OH}$ = {VOH} V and $V_{OL}$ = {VOL} V, and accepts $V_{IH}$ = {VIH} V and $V_{IL}$ = {VIL} V.

::: part
answer: VOH - VIH
unit: V
tolerance: 0.5%

### What is the high noise margin?

::: misses
- [any] $V_{OH} - V_{IH}$.
:::
:::

::: part
answer: VIL - VOL
unit: V
tolerance: 0.5%

### What is the low noise margin?

::: misses
- [any] $V_{IL} - V_{OL}$.
:::
:::
:::

::: check
kind: parts
given: VOH = 2.4 | 3.1 | 3.3; VDD = 3.3 | 5

## A {VOH} V output drives a CMOS input on {VDD} V, whose $V_{IH}$ is 70% of its supply.

::: part
answer: 0.7*VDD
unit: V
tolerance: 0.5%

### What is the input's $V_{IH}$?

::: misses
- [any] $0.7V_{DD}$.
:::
:::

::: part
answer: VOH - 0.7*VDD
unit: V
tolerance: 0.5%

### What is the high noise margin (negative means it won't work)?

::: misses
- [any] $V_{OH} - V_{IH}$.
:::
:::
:::

::: check
kind: parts
given: n = 129..255 int

## An 8-bit register holds the pattern {n:bin8}.

::: part
answer: n
tolerance: 0

### What is its unsigned value?

::: misses
- [any] Add the place values.
:::
:::

::: part
answer: n - 256
tolerance: 0

### What is its two's-complement value?

::: misses
- [any] The top bit weighs −128: subtract 256.
:::
:::
:::

::: check
kind: parts
given: n = 4 | 8 | 12 | 16

## Consider {n}-bit two's-complement numbers.

::: part
answer: -2^(n - 1)
tolerance: 0

### What is the most negative?

::: misses
- [any] $-2^{n-1}$.
:::
:::

::: part
answer: 2^(n - 1) - 1
tolerance: 0

### What is the most positive?

::: misses
- [any] $2^{n-1} - 1$.
:::
:::
:::

::: check
kind: parts
given: N = 100 | 1000 | 5000 | 70000

## The decimal number {N} must be stored in binary.

::: part
answer: ceil(log(N + 1)/log(2))
tolerance: 0.5%

### How many bits does it need?

::: misses
- [any] The smallest k with $2^k > N$.
:::
:::

::: part
answer: ceil(ceil(log(N + 1)/log(2))/4)
tolerance: 0.5%

### How many hex digits?

::: misses
- [any] Four bits per hex digit.
:::
:::
:::

::: check
kind: parts
given: n = 2 | 3 | 5; k = 1 | 3

## Consider functions of {n} inputs.

::: part
answer: 2^(2^n)
tolerance: 0.1%

### How many different functions are there?

::: misses
- [any] $2^{2^n}$.
:::
:::

::: part
answer: 2^n - k
tolerance: 0

### A function with {k} minterms has how many maxterms?

::: misses
- [any] The rest of the rows.
:::
:::
:::

::: check
kind: parts
given: A = 0 | 1; B = 0 | 1; C = 0 | 1

## Inputs A = {A}, B = {B}, C = {C}.

::: part
answer: 1 - A*B*C
tolerance: 0

### What does a 3-input NAND output?

::: misses
- [any] 0 only when all inputs are 1.
:::
:::

::: part
answer: A + B + C - 2*(A*B + B*C + A*C) + 4*A*B*C
tolerance: 0

### What does a 3-input XOR output?

::: misses
- [any] 1 when an odd number of inputs are 1.
:::
:::
:::

::: check
kind: parts
given: k = 2 | 3 | 5; m = 2 | 3

## A sum of products has {k} product terms of {m} literals each, built as NAND–NAND logic (complemented inputs available).

::: part
answer: k + 1
tolerance: 0

### How many NAND gates does it need?

::: misses
- [any] One per product term, plus one to combine them.
:::
:::

::: part
answer: k
tolerance: 0

### How many inputs does the output NAND have?

::: misses
- [any] One per product term.
:::
:::
:::

::: check
kind: boolean
vars: A, B, C
answer: ~A & ~B & ~C | ~A & B & C | A & ~B & C
ops: and, or, not

## Write a function of A, B, C equal to $\sum m(0, 3, 5)$.

::: misses
- [any] One AND term per row: 000, 011, 101.
:::
:::

::: check
kind: boolean
vars: A, B, C, D
answer: (~A | ~B) & ~C & ~D
ops: and, or, not

## Write $\overline{AB + C + D}$ with inversions only on single variables.

::: misses
- [~A & ~B & ~C & ~D] De Morgan turns $\overline{AB}$ into $\bar A + \bar B$.
- [any] Not yet. Apply De Morgan to the OR, then to AB.
:::
:::

::: check
kind: boolean
vars: X, Y, Z
answer: X & Y | ~X & Z
ops: and, or, not

## Simplify $XY + \bar XZ + YZ$.

::: misses
- [any] The consensus term YZ is redundant.
:::
:::

::: check
kind: boolean
vars: A, B, C
answer: (A | B) & (~A | C)
ops: and, or, not

## Write a function equal to $\prod M(0, 1, 4, 6)$.

::: misses
- [any] One OR term per 0 row; it can then simplify.
:::
:::

::: check
kind: parts
given: k = 4 | 11 | 26 | 57

## A Hamming code protects k = {k} data bits.

::: part
answer: ceil(log(k + 1 + ceil(log(k + 1)/log(2)))/log(2))
tolerance: 0

### How many check bits does it need?

::: misses
- [any] The smallest r with $2^r \ge k + r + 1$.
:::
:::

::: part
answer: k + ceil(log(k + 1 + ceil(log(k + 1)/log(2)))/log(2))
tolerance: 0

### How long is each codeword?

::: misses
- [any] $k + r$.
:::
:::
:::

::: check
given: n = 2..15 int
answer: 8*floor(n/8) + 4*(floor(n/4) + floor(n/8) - 2*floor((floor(n/4) + floor(n/8))/2)) + 2*(floor(n/2) + floor(n/4) - 2*floor((floor(n/2) + floor(n/4))/2)) + (n + floor(n/2) - 2*floor((n + floor(n/2))/2))
base: 2
width: 4

## What's the Gray code of {n:bin4}?

::: right
Right: {answer}.
:::

::: misses
- [n] XOR each bit with the one to its left.
- [any] $B \oplus (B \gg 1)$.
:::
:::

::: check
kind: boolean
vars: A, B, C
answer: A & B | ~A & C
ops: and, or, not

## Simplify $AB + \bar AC + BC$.

::: right
Right: the consensus term BC is redundant.
:::

::: misses
- [any] Not yet. BC is covered whichever value A takes.
:::
:::
:::
