1/8/08 Notes

To Notes

CSC 212 -- 1/8/08

 

Review Questions

  1. What is wrong with these Java variable names?

  2. What do the terms camel casing and Pascal casing mean?

    Ans: Camel casing means that the variable name starts with a lower case letter and that each new word starts with an upper case letter. Pascal casing is like camel casing, except that the first letter is also upper case.

  3. What do each of the following mean in Java?

  4. Rewrite using System.out.printf:

  5. What is wrong with these Java initialization?

  6. Convert the hex number 7B to binary and decimal.

    Ans: 7B hex = 01111011 bin = 64 + 32 + 16 + 8 + 2 + 1 = 123 dec.

  7. Convert the decimal number 98 to binary and hex.

    Ans: 98 dec = 64 + 32 + 2 = 01100010 bin = 62 hex.

  8. How many bits are in one byte? Ans: 8.

  9. How many bytes are in this hex number?

    Ans: 4 bytes. Each hex digit represents a half of a byte.

  10. What are these bitwise operators?

    See this table of operators to see how the bitwise operators fit into the operator precedence hierarchy.

  11. Apply the bitwise operators in question 10 to these binary numbers:

    Ans:
      11011100    11011100    11011100
    & 01101001  | 01101001  ^ 01101001
      --------    --------    --------
      01001000    11111101    10110101
    
 

Why Bitmaps?

 

Hex in Java

 

Negative Binary Numbers

 

Another Bitwise Operator

 

Java Structured Programming Constructs

 

Perfect Numbers

 

Amicable Numbers

 

A Debugging Checklist