Quiz 3 Solution - Thursday June 8, 2000
1. What is the binary equivalent of the decimal number 40?
Since 32 = 25 is the highest power of 2 <= 40, there will be
5+1=6 binary digits in the decimal equivalent of 40.
| 40 |
= |
1*32 + 8 |
| 8 |
= |
0*16 + 8 |
| 8 |
= |
1*8 + 0 |
Since the remainder is 0, all remaining binary digits will be 0. So the
binary equivalent of 40 is 101000.
2. What is the octal equivalent of the binary number 11011?
From the right we break up this binary number into groups of three
digits,
left padding with 0's if necessary. So for this binary number we have the
two groups 011 and 011. So the octal equivalent of the binary number 11011
is 338.
3. Is Java bytecode platform dependent?
Java bytecode is platform independent. The Java interpreter is platform
dependent.
4. What are the three types of errors that can occur in programming?
- Compile-Time
- Run-Time
- Logic