Download - JPC#8 Foundation of Computer Science
![Page 1: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/1.jpg)
Foundation of Computer Science
Junior Programmer Camp #8
![Page 2: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/2.jpg)
Chapter 1: Number Systems & Radix Number
![Page 3: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/3.jpg)
Radix Numbers
• Base 2 (Binary)- 0, 1
• Base 8 (Octal)- 0, 1, 2, 3, 4, 5, 6, 7
• Base 10 (Decimal)- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• Base 16 (Hexadecimal)– 0, 1, 2, 3 , …, 8, 9, A, B, C, D, E, F
![Page 4: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/4.jpg)
Base Conversion
Base X to Base 10 (Decimal)– Starting from the last digit, multiply
that digit by X0
– Increase the power of X by 1 and repeat until you have done all digits
– Sum up the results
![Page 5: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/5.jpg)
Base Conversion (cont.)
Example:Convert 110112, 5467, 878 to base 10
Result : 2727971
![Page 6: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/6.jpg)
Base Conversion (cont.)
Base 10 (Decimal) to any base X– Divide the number by X.– Write down the remainder.– Repeat the previous two steps until
the result is 0.– The actual result is the digit sequence
of the remainders from the last to first.
![Page 7: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/7.jpg)
Base Conversion (cont.)
Example:Convert 34510 to base 2,3,16
Result: 1010110012
11021203
15916
![Page 8: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/8.jpg)
Base Conversion (cont.)
Base 2 (Binary) to Base 8 (Octal)– Group 3 digits from the right side– Convert each group to its octal
representationDo you think that number in base 2 can
also be converted to Base 16 (Hexadecimal) directly somehow?
![Page 9: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/9.jpg)
Binary Arithmetic
• Addition:0 + 0 = 0 1 + 0 = 1 0 + 1 = 1 1 + 1 =
10
• Subtraction:0 – 0 = 0 1 – 0 = 1 0 – 1 = 1 1 - 1 =
0
• Multiplication:0 x 0 = 0 1 x 0 = 0 0 x 1 = 0 1 x 1 =
1
![Page 10: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/10.jpg)
Binary Arithmetic (Try it!)
Example:
101001101 + 1111101011001001011 - 1101110111101 x 11001
![Page 11: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/11.jpg)
Chapter 2: Logic Gates & Circuits
![Page 12: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/12.jpg)
Gates and Circuits Simulator
http://logic.ly/demo/
![Page 13: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/13.jpg)
NOT Gate
Boolean expression : A’Truth table: Input Output
0 1
1 0
![Page 14: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/14.jpg)
AND & NAND Gate
Boolean expression : A ∙ B [AND](A ∙ B)’
[NAND]Truth table:
Input OutputA B AND NAND
0 0 0 1
0 1 0 1
1 0 0 1
1 1 1 0
![Page 15: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/15.jpg)
OR & NOR Gate
Boolean expression : A + B [OR](A + B)’ [NOR]
Truth table: Input OutputA B OR NOR
0 0 0 1
0 1 1 0
1 0 1 0
1 1 1 0
![Page 16: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/16.jpg)
XOR & XNOR Gate
Boolean expression : A B [XOR](A B)’ [XNOR]
Truth table: Input Output
A B XOR XNOR
0 0 0 1
0 1 1 0
1 0 1 0
1 1 0 1
![Page 17: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/17.jpg)
Circuits
A circuit is a combination of gates.
![Page 18: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/18.jpg)
Boolean expression
Boolean expression is D = (A + B)’ NOT (A OR B)E = B ∙ C B AND CQ = D + E D OR E
= (A + B)’+(B ∙ C) (NOT (A OR B)) OR (B AND C)
![Page 19: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/19.jpg)
Truth tableInput Output
A B C D (A + B)’
E (B ∙ C )
Q((A + B)’+(B ∙ C) )
0 0 0 1 0 1
0 0 1 1 0 1
0 1 0 0 0 0
0 1 1 0 1 1
1 0 0 0 0 0
1 0 1 0 0 0
1 1 0 0 0 0
1 1 1 0 1 1
![Page 20: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/20.jpg)
Give it a try!
Find the Boolean expression and the truth table of this circuit.
![Page 21: JPC#8 Foundation of Computer Science](https://reader034.vdocuments.net/reader034/viewer/2022052619/555ed530d8b42a772f8b4a3a/html5/thumbnails/21.jpg)
Give it a try!
Draw a circuit this Boolean expression:X = ((A B) + (C’∙ D))’
E