You are on page 1of 9

Computer Studies Revision Sheet S1 Grade 10

Q1- What is Binary to Denary Conversion?


To convert an 8-bit binary number into denary, you can start by writing the binary digits in the
place values table. Then, add together the place values of the binary digits that are set to 1.

For example, to convert the binary number 11001101,11001101 into denary, you would perform
the following calculation: 110011012 = 128 + 64 + 8 + 4 + 1 = 20510

Q2- What is Denary to Binary Conversion


1. Write down the place values table for 8-bit numbers.
2. Find the maximum place value that can go into the denary number in question.
3. Set the digit that corresponds to that place value to 1.
4. Subtract the place value from the denary number.
5. Take the result of the subtraction and repeat steps 2 to 5 until you have a result of 0.
6. Set the remaining digits to 0.
7. Read the binary number from left to right.

Suppose that you wanted to convert the denary number 210,210 into binary.

The maximum place value that can go into 210 is 128, so you would set the digit that
corresponds to 128 to 1.

210 − 128 = 82. The maximum place value that can go into 82 is 64, so you would set the digit that
corresponds to 64 to 1.

82 − 64 = 18. The maximum place value that can go into 18 is 16, so you would set the digit that
corresponds to 16 to 1.

1
Computer Studies Revision Sheet S1 Grade 10

18 – 16 = 2. The maximum place value that can go into 2 is 2, so you would set the digit that corresponds
to 2 to 1.

2 – 2 = 0. The subtraction process ends. You would now set all remaining digits to 0.

Therefore, 21010 = 110100102

Q3- What is Binary to Octal Conversion?


Example − Convert binary number 1010111100 into octal number. Since there is no binary point
here and no fractional part. So,

Therefore, Binary to octal is.

= (1010111100)2
= (001 010 111 100)2
421 421 421 421
= (1 2 7 4)8
= (1274)8

2
Computer Studies Revision Sheet S1 Grade 10
Q4- What is Octal to Binary Conversion?
Example- Convert octal number 540 into binary number.

According to above algorithm, equivalent binary number will be,

= (540)8
421 421 421
= (101 100 000)2
= (101100000)2

Q5- What is Binary to Hexadecimal Conversion?


Whereas Hexadecimal number is one of the number systems which has value is 16 and it has only 16
symbols − 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and A, B, C, D, E, F. Where A, B, C, D, E and F are single bit
representations of decimal value 10, 11, 12, 13, 14 and 15 respectively.

Example-1 − Convert binary number 1010101101001 into hexadecimal number. Since there is
no binary point here and no fractional part. So,

Therefore, Binary to hexadecimal is,

= (1010101101001)2
= (1 0101 0110 1001)2
= (0001 0101 0110 1001)2
8421 8421 8421 8421
= (1 5 6 9)16
= (1569)16

3
Computer Studies Revision Sheet S1 Grade 10
Example-2 − Convert binary number 1010101101111 into hexadecimal number. Since there is
no binary point here and no fractional part. So,

Therefore, Binary to hexadecimal is, A 10


= (1010101101111)2 B 11
= (1 0101 0110 1111)2
= (0001 0101 0110 1111)2 C 12
8421 8421 8421 8421
= (1 5 6 15)16 D 13
= (156F)16
E 14

Q6- What is hexadecimal to binary Conversion? F 15

Convert hexadecimal number E5B into binary number. Since there is no binary point here and no
fractional part. So,

Therefore, hexadecimal to binary is, A 10

E5B B 11

E =14 C 12

B =11 D 13

14 5 11 E 14

8421 8421 8421 F 15

=1110 0101 1011

= (1110 0101 1011)2

Q7- Difference between static and


dynamic

4
Computer Studies Revision Sheet S1 Grade 10
Q8- Binary addition
You need to be able to add together two 8-bit binary numbers. When binary numbers are added
together there are four rules that you will need to use:
Rule 1 is 0 + 0 = 0
Rule 2 is 1 + 0 = 1
Rule 3 is 1 + 1 = 10 (this is because 10 in binary is 2)
Rule 4 is 1 + 1 + 1 = 11 (this is because 11 in binary is 3)
You can apply these rules to add the binary numbers 10010100 and 00011110.

5
Computer Studies Revision Sheet S1 Grade 10
You should now know that the largest number that can be stored in an 8-bit binary register is
255. What happens when two 8-bit binary values are added, and the result is larger than 255?
The following example, which is almost complete, is very much like the previous calculation
with a slightly different binary number. Can you spot the difference?

If you now try and do the final calculation, that would be 1 + 1 = 10. You write 0 in the answer
section, but there is nowhere to carry the 1. This is because the two 8-binary binary values are
added the result is 306, which is greater than 255. Therefore, the number cannot fit in the 8-bit
register and an overflow error is created.

Each computer has a predefined limit, for example, 16-bit registers. What is the largest number
that could be stored in a 16-bit register?
If a number larger than this is generated in a process, an overflow error will occur.

6
Computer Studies Revision Sheet S1 Grade 10
Q9- Negative binary numbers
All the binary numbers that you have used so far have been positive binary numbers. Numbers
can sometimes be negatives number though, for example, -150. How are negative numbers
represented as binary? Binary only has two values that can be used, a 0 and a 1, so you can't just
put a minus symbol (-) in front of the number, as that symbol doesn't exist in binary. Therefore, a
method exists that can be used to represent negative binary numbers and it is called two's
complement. Most modern computers use this method.
The method of two's complement is a simple one. First you invert all the values in the binary
number (change the 1s to 0s and the 0s to 1s), then you add 1 to the result. You can use this
process to find out how the denary value -35 is represented as binary.
Convert 35 to a binary number:

Invert each of the values in the binary number:

Then simply add 1:

11011101 is the binary representation of -35 using the two's complement method.

Practical:
Q1.Variable
<!DOCTYPE html>
<html>
<body>
<?php
$txt = "Hello world!";
$x = 5;
$y = 10.5;
echo $txt;
echo "<br>";
echo $x;
echo "<br>";
echo $y;
?>
</body>
</html>

7
Computer Studies Revision Sheet S1 Grade 10
Q2. IF else
<!DOCTYPE html>
<html>
<body>
<?php
$t = date("H");
if ($t < "20") {
echo "Have a good day!";
}
?>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
----------------------
<?php
$t = date("H");
if ($t < "20") {
echo "Have a good day!";
} else {
echo "Have a good night!";
}
?>
</body>
</html>

Q3. Functions
<!DOCTYPE html>
<html>
<body>
<?php
function writeMsg() {
echo "Hello world!";
}
writeMsg();
?>
</body>
</html>

8
Computer Studies Revision Sheet S1 Grade 10
Q4. Date/Time
<!DOCTYPE html>
<html>
<body>
<?php
echo "Today is " . date("Y/m/d") . "<br>";
echo "Today is " . date("Y.m.d") . "<br>";
echo "Today is " . date("Y-m-d") . "<br>";
echo "Today is " . date("l");
?>
</body>
</html>

You might also like