First midterm review

Make sure you can answer all the Review Questions at the end of Chapters 1-4!

Sample questions:
  1. When is public static void main(String[]) executed?
  2. What are the three Java statements we have encountered so far?
  3. Explain the cookies and cookie-cutter metaphor.
  4. What is the actor metaphor?
  5. How do you instantiate an object of type Foo?
  6. What are the three types we have used so far?
  7. How do you send information to a method?
  8. Where is information stored?
  9. How do you declare a variable?
  10. How can you change the value of a variable?
  11. What do the following acronyms mean?
    1. GUI
    2. IDE
    3. API
    4. JDK
    5. CPU
    6. RAM, ROM
    7. JVM
    8. RGB
  12. What method is invoked when a user pushes a Button named Foo?
  13. What message do you send to a TextField to set its text?
  14. What message do you send to a TextField to get its text?
  15. How can you convert:
    1. int to String
    2. String to int
  16. What is Graphics?
  17. Shortest user defined Foo class
    1. Write the simplest (i.e. shortest) possible class named Foo.
    2. What class does your Foo class extend?
    3. What can your Foo class do?
    4. What variables does your Foo class have?
    5. What does "Foo" mean?
  18. What is public String toString() for?
  19. What is public void paint(Graphics) for?
  20. Graphics
    1. Where is (0,0?
    2. What are the parameters for drawOval?
    3. Write a message to draw a circle with radius 100, centered at (100,100).
    4. How do you set the color of a Graphics?
    5. Write a line of code to set the Color of a Graphics named g, to a very light grey
  21. Programming Exercises from C4
    1. Write the pubic void paint(Graphics) method for Circle.
    2. Write the accessors for Circle.
    3. Write the Circle class.
    4. Write the FilledCircle class.
    5. Write a Target class that is displayed as alternating red and white bands of color. Hint; draw the biggest fillOval first and work in.
  • More questions... added 9/19...
    1. What are 5 problem solving techniques covered so far?
    2. What are two techniques for software reuse?
    3. Why is programming so difficult when you first start?
    4. What does cognitive overhead have to do with programming?
    5. Files and disks
      1. What is stored in files?
      2. What is the point of directories?
      3. How do directories differ from ordinary files?
      4. What is the name of the root of your home drive?
      5. What are c:\, e:\, h:\?
      6. Why is a disk called a disk?
    6. Hardware and software
      1. What is the difference between hardware and software?
      2. When you write a Java program, are you creating hardward or software?
      3. Can software act like hardware? If not, explain why; if so, give an example.
      4. Can hardware act like software? If not, explain why; if so, give an example.
      5. Why is reliable, inexpensive software so difficult to make? How does object oriented programming address this issue?
    7. What is the difference between education and accreditation?
    8. How has computing changed our culture?
    9. How will computing change our lives in the future?
    10. Types
      1. What are the types we have used so far in Java?
      2. How do you convert a String to and int?
      3. How do you convert an int to a String?
      4. What is the value of: "I love " + 17?
      5. What is the value of: 17+"I love "?
    11. What is a null pointer exception? Write code to cause one.
    12. You have created a MyFrame class that extends java.awt.frame; but! when you run your program nothing shows up. What are three reasons that this could be?
    13. Syntax and Semantics
      1. What does syntax mean?
      2. What does semantics mean?
      3. Why is syntax important to programming?
      4. What is the form of a message statement?
      5. What is the form of a return statement?
      6. What is the form of an assignment statement?
      7. What is the form of a variable declaration?
      8. What is the form of a method declaration?
      9. What is the form of a method heading?
      10. What is the form of a method body?
    14. Write a complete Account class including variables for name and balance, accessors therefor and a withdraw(int) method.
    15. Assume you have a working Circle class with standard accessors. Write a shrink() method for it which will reduce the radius by 1 pixel.
    16. Assume you have a working FilledCircle class that extends Circle (above). Write a grow() method for it which will double the radius.