Preliminary notes on Boolean algebra.
parent
df45254a66
commit
9529d00b38
|
@ -114,7 +114,7 @@
|
|||
"_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
|
||||
"_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
|
||||
"_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
|
||||
"logic/equiv-trans.md": "76f2416d78d6f44e5a7d88b806da6be9",
|
||||
"logic/equiv-trans.md": "ba87bed095b095540393db90ad350da0",
|
||||
"_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889",
|
||||
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
|
||||
"algorithms/loop-invariant.md": "d883dfc997ee28a7a1e24b995377792b",
|
||||
|
@ -145,13 +145,14 @@
|
|||
"_journal/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32",
|
||||
"binary/endianness.md": "29c0aea671aa25aead580e9431aba8cc",
|
||||
"logic/normal-form.md": "f8fd5ea205dfb7e331356b0574f0fe14",
|
||||
"_journal/2024-02-12.md": "808cff0e8c1d9992ed65fed613afc98d",
|
||||
"_journal/2024-02-12.md": "240d17f356305de9c0c00282b2931acd",
|
||||
"_journal/2024-02/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32",
|
||||
"encoding/ascii.md": "c01e50f96d0493d94dc4d520c0b6bb71",
|
||||
"encoding/index.md": "071cfa6a5152efeda127b684f420d438",
|
||||
"c/strings.md": "38f9cf9e2325565589f62e191221a83a",
|
||||
"logic/truth-tables.md": "7892ceaa416c9a65acc79ca1e6ff778f",
|
||||
"logic/short-circuit.md": "26d300f407f14883022d0ef8dc4f7300"
|
||||
"logic/short-circuit.md": "26d300f407f14883022d0ef8dc4f7300",
|
||||
"logic/boolean-algebra.md": "c5d699d407e03d280aa1f201bc3e8b02"
|
||||
},
|
||||
"fields_dict": {
|
||||
"Basic": [
|
||||
|
|
|
@ -11,4 +11,5 @@ title: "2024-02-12"
|
|||
- [ ] Log Work Hours (Max 3 hours)
|
||||
|
||||
* Read 삼 년 고개 (Three-Years Hill).
|
||||
* Notes on ASCII and C-style strings.
|
||||
* Notes on ASCII and C-style strings.
|
||||
* Elaborated on each of the submodules in Gus and my "Soft Skills Workshop".
|
|
@ -0,0 +1,164 @@
|
|||
---
|
||||
title: Boolean Algebra
|
||||
TARGET DECK: Obsidian::STEM
|
||||
FILE TAGS: logic::boolean
|
||||
tags:
|
||||
- logic
|
||||
- boolean
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
**Boolean algebra** refers to an algebraic system characterised by a set of axioms. This is something I'll explore further, probably after reading more on abstract algebra. The basic operations of Boolean algebra are negation ($\neg$), conjunction ($\land$), and disjunction ($\lor$).
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C bit-level operator corresponds to $\neg$?
|
||||
Back: `~`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c
|
||||
<!--ID: 1707774068116-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C bit-level operator corresponds to $\land$?
|
||||
Back: `&`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c
|
||||
<!--ID: 1707774068124-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C bit-level operator corresponds to $\lor$?
|
||||
Back: `|`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c
|
||||
<!--ID: 1707774068132-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C bit-level operator corresponds to $\oplus$?
|
||||
Back: `^`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c
|
||||
<!--ID: 1707774068137-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the value of `~0b00001111`?
|
||||
Back: `0b11110000`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c
|
||||
<!--ID: 1707774068142-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the value of `0b00001111 & 0b11111111`?
|
||||
Back: `0b00001111`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c
|
||||
<!--ID: 1707774068151-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the value of `0b00001111 | 0b11111111?
|
||||
Back: `0b11111111`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c
|
||||
<!--ID: 1707774068161-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the value of `0b00001111 ^ 0b11111111`?
|
||||
Back: `0b11110000`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c
|
||||
<!--ID: 1707774068167-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How do bit vectors represent finite sets?
|
||||
Back: A `1` bit-value indicates membership at the given index.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary
|
||||
<!--ID: 1707774068173-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C bit-level operator corresponds to set complement?
|
||||
Back: `~`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c set
|
||||
<!--ID: 1707774068179-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C bit-level operator corresponds to $\cup$?
|
||||
Back: `|`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c set
|
||||
<!--ID: 1707774068186-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C bit-level operator corresponds to $\cap$?
|
||||
Back: `&`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
Tags: binary c set
|
||||
<!--ID: 1707774068192-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is a bit mask?
|
||||
Back: A bit pattern that selects certain bits of a data type.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707774068217-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What hexadecimal bit mask returns the least significant byte of a word?
|
||||
Back: `0xFF`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707774068225-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What portable expression yields a mask of all ones, regardless of data type?
|
||||
Back: `~0`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707774068229-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Why might you prefer `~0` over e.g. `0xFFFFFFFF`?
|
||||
Back: The former is independent of data type.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707774068233-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Given `int32_t x = 0x89ABCDEF`, what is the value of `x & 0xFF`?
|
||||
Back: `0x000000EF`
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707774068237-->
|
||||
END%%
|
||||
|
||||
## References
|
||||
|
||||
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
@ -122,7 +122,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C operator corresponds to $\neg$?
|
||||
What C logical operator corresponds to $\neg$?
|
||||
Back: `!`
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
Tags: c
|
||||
|
@ -131,7 +131,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C operator corresponds to $\land$?
|
||||
What C logical operator corresponds to $\land$?
|
||||
Back: There isn't one.
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
Tags: c
|
||||
|
@ -140,7 +140,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C operator corresponds to $\lor$?
|
||||
What C logical operator corresponds to $\lor$?
|
||||
Back: There isn't one.
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
Tags: c
|
||||
|
@ -149,7 +149,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C operator corresponds to $\Rightarrow$?
|
||||
What C logical operator corresponds to $\Rightarrow$?
|
||||
Back: There isn't one.
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
Tags: c
|
||||
|
@ -158,7 +158,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
What C operator corresponds to $\Leftrightarrow$?
|
||||
What C logical operator corresponds to $\Leftrightarrow$?
|
||||
Back: `==`
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
Tags: c
|
||||
|
|
Loading…
Reference in New Issue