Assignment #1 (cs101)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Assignment : 1

Introduction to computing

Semester spring 2020

Student Name: Bashart Ali

Student ID:Mc200200284

Question:1

You are required to perform the following stated operations in Binary Number System

(320)10 + (-122)10

Please first convert the stated Decimal Numbers into Binary Numbers.

Perform the Arithmetic operation on Binary Numbers.

Convert the calculated answer back into Decimal Number System.

Note: You are bound to show each, and every step involved in conversions or arithmetic operations
involved.

Solution:

First step:

Please first convert the stated decimal number into binarg number

stated decimal number into binarg number


320

2 160 0 The binary for 320 is (101000000)2

2 80 0

2 40 0

2 20 0 122
22 10 0 61 1
22 5 0 30 0
22 4 0 15 1
22 2 0 7 1
22 1 0 3 1

2 1 1

The binary for 122 is (1111010)2

Perform the Arithmetic operation on binary numbers

101000000 + (-01111010)

101000000 + (10000110)

101000000

10000110

11000110

198

Second step:

Performing Arithmetic operation on binary numbers


=(320)10 + (-122)10

=(101000000)2+(-1111010)2

=(11000110)2

Third step:
Convert the calculated answer back into decimal Number System

(11000110)2

Multiply cach digit of the binary number by the corresponding power of two.
1×2⁷+1×2⁶+0×2⁵+0×2³+1×2²+1×2¹+0×2⁰

Now, solve the power:

=1×128+1×64+0×32+0×16+0×8+1×4+1×2+0×1

=128+64+0+0+0+4+2+0

=128+64+0+0+0+4+2+0

=198

(11000110)2+ (198)10

So,198 is the decimal equivalent of the binary number 11000110

Question:2

For the following Boolean expression you are required to fill the stated table below.

(~A⊕B) ꓥ D) V C)

Symbol to operator mapping

(⊕ = XOR)

(~ NOT)
(V = OR)

(ꓥ = AND)

A B C D (A⊕B) ~(A⊕B) (~(A⊕B) ꓥ D) (~(A⊕B) ꓥ D) V C)

0 0 0 0 0 1 0 0

0 0 0 1 0 1 1 1

0 0 1 0 0 1 0 1

0 0 1 1 0 1 1 1

0 1 0 0 1 0 0 0

0 1 0 1 1 0 0 0

0 1 1 0 1 0 0 1

0 1 1 1 1 0 0 1

1 0 0 0 1 0 0 0

You might also like