Binary And Hexadecimal Numeration And Logical Operations Worksheet - Object Oriented Programming In Java, Marian Manyo Page 3

ADVERTISEMENT

J A V A
L A B
M A N U A L
E x e r c i s e 1 . 2 Complete the charts.
decimal
binary
decimal
binary
101101
17
10110
37
11111
127
1001001
198
E x e r c i s e 1 . 3 Answer these questions.
A. The largest value that can be stored in 4 bits is __________________
= __________
2
10
The next number is __________________
= __________
2
10
B. The largest value that can be stored in 6 bits is __________________
= __________
2
10
The next number is __________________
= __________
2
10
C. The largest value that can be stored in 8 bits is __________________
= __________
2
10
The next number is __________________
= __________
2
10
Algorithms
algor thm
i
An
is a step by step process for solving a problem. For example, a recipe for baking a chocolate
case is an algorithm. In this first semester of computer science, you will learn how to write a computer
program, a set of instructions, or algorithm, that the computer follows in order to successfully complete a
task.
An algorithm for converting a decimal whole number to binary involves division by two. The decimal
numeration system groups in tens; the binary numeration system groups in twos. Read this example that
uses the algorithm before the algorithm is actually stated.
The process of grouping by twos is accomplished by dividing by two. To convert the decimal numeral 13 to
a binary numeral, repeatedly divide by 2.
÷
1. 13
2 = 6 (groups of two) with a remainder of 1
2.
6
÷
2 = 3 (groups of four) with a remainder of 0 (groups of two)
3.
3
÷
2 = 1 (group of eight) with a remainder of 1 (group of four)
4.
1
÷
2 = 0 (groups of sixteen) with a remainder of 1 (group of eight)
Notice that this process can be described with instructions that
1
1
0
1
are repeated many times until some condition is met.
8
4
2
1
M A R I A N M A N Y O , M A R Q U E T T E U N I V E R S I T Y
P A G E 1 . 3

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education