Built-in: Review and Notes

Screen Shot 2014-09-09 at 10.24.34 PM

Review and quick notes:

  1. What is the difference between compiling and running a program?
  2. Name 5 common built-in types also known as primitive data types.
  3. What are the differences and similarities between char and Strings?
  4. What java type is used to represent a Real Number?
  5. Draw the truth table for && and || for two boolean variables a and b.
  6. Show the truth table for the following expression:
    !( p && ( q || !r))
    for the following values of p, q, and r
    f f f
    f f t
    f t f
    f t t
    t f f
    t f t
  7. Write a code snippet to determine if a number is even.
  8. How do you display a quote as part of a string?
  9. How do you display a backslash as part of a string?
  10. When all the operations in an expression have the same precedence how does the java compiler evaluates the expression?
  11. What does each of the following print? Explain
    1. System.out.println(2 + "bc"); prints: 2bc
    2. System.out.println(2 + 3 + "bc"); prints: 5bc
    3. System.out.println((2+3) + "bc"); prints: 5bc
    4. System.out.println("bc" + (2+3)); prints: bc5
    5. System.out.println("bc" + 2 + 3); prints: bc23
  12. What is the value of  Integer.MAX_VALUE?

Some Help
#5
a b             a && b                  a || b
f f
t f
f t
t t

#6
p q r           q || !r               !( p && ( q || !r))
f f f
f f t
f t f
f t t
t f f
t f t