Upcoming SlideShare
×

# JPC#8 Foundation of Computer Science

388 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
388
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
6
0
Likes
0
Embeds 0
No embeds

No notes for slide

### JPC#8 Foundation of Computer Science

1. 1. Foundation of Computer Science Junior Programmer Camp #8
2. 2. Chapter 1: Number Systems & Radix Number
3. 3. 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
4. 4. 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
5. 5. Base Conversion (cont.) Example: Convert 110112, 5467, 878 to base 10 Result : 27 279 71
6. 6. 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.
7. 7. Base Conversion (cont.) Example: Convert 34510 to base 2,3,16 Result: 1010110012 11021203 15916
8. 8. Base Conversion (cont.) Base 2 (Binary) to Base 8 (Octal) – Group 3 digits from the right side – Convert each group to its octal representation Do you think that number in base 2 can also be converted to Base 16 (Hexadecimal) directly somehow?
9. 9. 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: 0x0=0 1x0=0 0x1=0 1x1=1
10. 10. Binary Arithmetic (Try it!) Example: 101001101 + 111110101 1001001011 - 11011101 11101 x 11001
11. 11. Chapter 2: Logic Gates & Circuits
12. 12. Gates and Circuits Simulator http://logic.ly/demo/
13. 13. NOT Gate Boolean expression : A’ Truth table: Input Output 0 1 1 0
14. 14. AND & NAND Gate Boolean expression : A ∙ B [AND] (A ∙ B)’ [NAND] Truth table: Input Output A B AND NAND 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0
15. 15. OR & NOR Gate Boolean expression : A + B [OR] (A + B)’ [NOR] Truth table: Input Output A B OR NOR 0 0 0 1 0 1 1 0 1 0 1 0 1 1 1 0
16. 16. 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
17. 17. Circuits A circuit is a combination of gates.
18. 18. Boolean expression Boolean expression is D = (A + B)’ E = B ∙ C Q = D + E = (A + B)’+(B ∙ C) NOT (A OR B) B AND C D OR E (NOT (A OR B)) OR (B AND C)
19. 19. Truth table Input 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
20. 20. Give it a try! Find the Boolean expression and the truth table of this circuit.
21. 21. Give it a try! Draw a circuit this Boolean expression: X = ((A B) + (C’∙ D))’ E