cs101 assignment 2 idea soloution 2020

cs101 assignment 2 idea soloution 2020
Introduction to Computing (CS101)
Assignment # 02 |
Total marks = 20
Deadline Date
|
Question # 01 10 marks
In CPU all the arithmetic operations are performed in binary numbers (0 and 1). Suppose you have a small CPU which is designed to perform all arithmetic operations using addition only. You will explain how the following operations will be solved out by the CPU.
- Multiplication of 6 and 2
6*2=12
1 1
110 (6)
110 (6)
1100 (12)
- Addition of 7 and 3
1 1 1
111 (7)
+11 (3)
1010 (10)
- Subtraction of 5 and 4
5+(-4)
0101
1100 (2’s complement of 4)
0001
Question # 02 10 marks
You have an image that can be represented in 8 bits. The image is given below:
(00110011)2
You are required to send this image to someone but not in original form. So, nobody can extract the features from the image.
So, we will perform following two operations on the image.
- Masking
You will apply an 8-bit (10101011)2 mask using AND logic operation.