In this lab you will practice with information representation and binary numbers. Feel free to work in pairs.
Answer the following questions:
Add the binary numbers given below:
1010101010 1010111011 + 101011111 + 1101110110 ------------- -------------
Do the subtractions given below:
1010101010 1010101010 - 101011111 - 110111011 ------------- -------------
Convert the following numbers from decimal to binary:
15, 70, and 111.
Convert the following numbers from binary to decimal:
1001, 10011, and 110110.
Suppose we have a fragment of Java code as follows:
boolean a = true; boolean b = false; boolean c = true; boolean b = a || (b && c); boolean d = a && (b || c) || (!a);
What is the resulting value of b
and d
if we execute
these lines in order? Hint: the order of operator precedence is !,
&&, and || in that order ! being the highest. We also evaluate from
left to right.